/* ═══════════════════════════════════════════════════════════════
   交易银行 AI 伙伴 — Treasury Command Terminal
   Aesthetic: Deep Navy Command / Cyan Data Glow / Amber Alert
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700&family=Noto+Serif+SC:wght@400;700&display=swap');

/* ─── Design Tokens ─────────────────────────────────────────────── */
:root {
  /* Atmosphere layers */
  --void:        #f0f2f5;
  --deep:        #f4f6f8;
  --abyss:       #ffffff;
  --trench:      #fafafa;
  --shallows:    #f5f5f5;

  /* Borders & Lines */
  --grid:        rgba(0, 0, 0, 0.06);
  --grid-bright: rgba(0, 0, 0, 0.12);
  --line:        rgba(0, 0, 0, 0.08);
  --line-hover:  rgba(0, 0, 0, 0.15);

  /* Text hierarchy */
  --text-void:   #ffffff;
  --text-dim:    #707070;
  --text-sub:    #4d4d4d;
  --text-body:   #333333;
  --text-peak:   #1f1f1f;
  --text-haze:   #111111;

  /* Cyan — primary data / action */
  --cyan-dim:    rgba(22, 119, 255, 0.10);
  --cyan-glow:   rgba(22, 119, 255, 0.25);
  --cyan-peak:   #1677ff;
  --cyan-flash:  #69b1ff;

  /* Amber — warning / attention */
  --amber-dim:   rgba(250, 140, 22, 0.10);
  --amber-glow:  rgba(250, 140, 22, 0.25);
  --amber-peak:  #fa8c16;
  --amber-flash: #ffd591;

  /* Red — risk / danger */
  --red-dim:     rgba(255, 77, 79, 0.10);
  --red-glow:    rgba(255, 77, 79, 0.25);
  --red-peak:    #ff4d4f;
  --red-flash:   #ffccc7;

  /* Green — ok / useful */
  --ok-dim:      rgba(82, 196, 26, 0.10);
  --ok-glow:     rgba(82, 196, 26, 0.25);
  --ok-peak:     #52c41a;

  /* Typography */
  --font-term:  'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei UI', sans-serif;
  --font-print: 'Noto Serif SC', 'STZhongsong', 'Songti SC', serif;

  /* Spacing scale */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.25rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;
  --sp-12: 3rem;

  /* Radius scale */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 14px;
  --r-xl: 20px;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Compatibility aliases used by later panels */
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --accent: var(--cyan-peak);
  --text: var(--text-body);
  --text-muted: var(--text-dim);
  --text-secondary: var(--text-sub);
  --amber: var(--amber-peak);
}

/* ─── Reset & Base ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 14px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-term);
  color: var(--text-body);
  background-color: var(--void);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── Noise Overlay ──────────────────────────────────────────────── */
.noise {
  display: none;
}

/* ─── App Shell ─────────────────────────────────────────────────── */
.app {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--sp-4) var(--sp-4) var(--sp-8);
  position: relative;
  z-index: 1;
}

/* ─── Top Bar ───────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-6);
  background: #ffffff;
  border: 1px solid var(--grid-bright);
  border-radius: var(--r-xl);
  backdrop-filter: blur(20px);
  box-shadow:
    0 0 0 1px rgba(59, 210, 228, 0.04),
    0 8px 32px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 var(--line);
  animation: slideDown 0.5s var(--ease-out) both;
}

.mode-switch {
  display: inline-flex;
  gap: var(--sp-2);
  margin: var(--sp-4) 0 0;
  padding: 6px;
  border: 1px solid var(--grid);
  border-radius: 999px;
  background: rgba(255, 252, 246, 0.72);
}

.mode-btn {
  border: none;
  border-radius: 999px;
  padding: 0.55rem 1rem;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-term);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
}

.mode-btn.active {
  background: linear-gradient(135deg, rgba(47, 122, 123, 0.12), rgba(181, 106, 28, 0.12));
  color: var(--text-peak);
  box-shadow: inset 0 0 0 1px rgba(137, 104, 69, 0.12);
}

.topbar-brand {
  font-family: var(--font-print);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-haze);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.brand-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, var(--cyan-peak), #1a8a8e);
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  box-shadow: 0 2px 8px rgba(22, 119, 255, 0.15);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.role-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-3);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--cyan-peak), #1a9a9e);
  color: var(--text-void);
  box-shadow: 0 2px 10px rgba(22, 119, 255, 0.15);
  transition: all 0.3s var(--ease-out);
}

.role-badge.risk  { background: linear-gradient(135deg, var(--red-peak), #aa2020); box-shadow: 0 2px 10px rgba(255, 77, 79, 0.15); }
.role-badge.branch { background: linear-gradient(135deg, var(--amber-peak), #aa7010); box-shadow: 0 2px 10px rgba(250, 140, 22, 0.15); }

.role-switcher {
  appearance: none;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--text-sub);
  padding: var(--sp-1) var(--sp-4) var(--sp-1) var(--sp-3);
  font-family: var(--font-term);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234a7a9e' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
}
.role-switcher:hover { border-color: var(--cyan-glow); color: var(--text-peak); }
.role-switcher:focus { outline: none; border-color: var(--cyan-peak); box-shadow: 0 0 0 3px var(--cyan-dim); }

/* ─── Navigation ─────────────────────────────────────────────────── */
.main-nav {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--sp-2);
  margin: var(--sp-4) 0 var(--sp-6);
  animation: slideUp 0.5s var(--ease-out) 0.1s both;
}

.nav-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-3) var(--sp-2);
  border: 1px solid var(--grid);
  border-radius: var(--r-lg);
  background: #ffffff;
  color: var(--text-dim);
  cursor: pointer;
  font-family: var(--font-term);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  transition: all 0.25s var(--ease-out);
  overflow: hidden;
}

.nav-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--cyan-dim), transparent);
  opacity: 0;
  transition: opacity 0.25s;
}

.nav-btn:hover { border-color: var(--grid-bright); color: var(--text-sub); transform: translateY(-2px); }
.nav-btn:hover::before { opacity: 1; }
.nav-btn.active {
  border-color: var(--amber-glow);
  color: var(--amber-peak);
  background: linear-gradient(135deg, rgba(255, 190, 60, 0.08), rgba(255, 190, 60, 0.03));
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
.nav-btn.active::before { background: linear-gradient(135deg, var(--amber-dim), transparent); opacity: 1; }

.nav-icon { font-size: 1.1rem; line-height: 1; }
.nav-label { font-size: 0.76rem; }

/* ─── Panel ────────────────────────────────────────────────────── */
.panel {
  display: none;
  animation: panelIn 0.4s var(--ease-out) both;
}
.panel.active { display: block; }

.overview-hero {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(137, 104, 69, 0.14);
  border-radius: var(--r-xl);
  padding: var(--sp-8);
  margin-bottom: var(--sp-4);
  background:
    radial-gradient(circle at top right, rgba(47, 122, 123, 0.14), transparent 30%),
    radial-gradient(circle at bottom left, rgba(181, 106, 28, 0.12), transparent 35%),
    linear-gradient(135deg, rgba(255, 252, 246, 0.98), rgba(248, 240, 228, 0.94));
}

.overview-hero-title {
  font-family: var(--font-print);
  font-size: 1.9rem;
  line-height: 1.2;
  color: var(--text-haze);
}

.overview-hero-focus {
  max-width: 840px;
  font-family: var(--font-print);
  font-size: 1.28rem;
  line-height: 1.7;
  color: var(--text-haze);
}

.overview-hero-subtitle {
  max-width: 760px;
  margin-top: var(--sp-3);
  color: var(--text-sub);
  font-size: 1rem;
  line-height: 1.7;
}

.overview-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-4);
}

.overview-pillars,
.scorecard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
}

.overview-pillar,
.scorecard {
  border: 1px solid rgba(137, 104, 69, 0.14);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.98), rgba(251, 246, 239, 0.96));
}

.overview-pillar h3,
.scorecard-label {
  font-family: var(--font-print);
  color: var(--text-peak);
}

.overview-pillar p {
  color: var(--text-sub);
  line-height: 1.6;
  margin-top: var(--sp-2);
}

.overview-pillar-metrics,
.scorecard-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: var(--sp-3);
}

.scorecard {
  position: relative;
  overflow: hidden;
}

.scorecard-value {
  margin-top: 10px;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-haze);
}

.scorecard.tone-red .scorecard-value { color: var(--red-peak); }
.scorecard.tone-amber .scorecard-value { color: var(--amber-peak); }
.scorecard.tone-cyan .scorecard-value { color: var(--cyan-peak); }
.scorecard.tone-ok .scorecard-value { color: var(--ok-peak); }
.knowledge-toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.knowledge-search {
  max-width: 420px;
}
.knowledge-sections {
  display: grid;
  gap: var(--sp-4);
}
.knowledge-section {
  border: 1px solid rgba(137, 104, 69, 0.14);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.98), rgba(247, 239, 228, 0.94));
  padding: var(--sp-5);
}
.knowledge-section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
}
.knowledge-section-title {
  font-family: var(--font-print);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-peak);
}
.knowledge-section-summary {
  margin-top: 0.35rem;
  color: var(--text-dim);
  font-size: 0.8rem;
  line-height: 1.6;
}
.knowledge-section-count {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cyan-peak);
  font-weight: 700;
}
.knowledge-entry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-3);
}
.knowledge-entry {
  border: 1px solid rgba(137, 104, 69, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  padding: var(--sp-4);
  display: grid;
  gap: 0.45rem;
}
.knowledge-entry-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}
.knowledge-entry-title {
  font-size: 0.9rem;
  color: var(--text-peak);
  font-weight: 700;
}
.btn-knowledge-edit {
  padding: 0.22rem 0.6rem;
  font-size: 0.72rem;
  flex-shrink: 0;
}
.knowledge-entry-sub {
  font-size: 0.7rem;
  color: var(--cyan-peak);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.knowledge-entry-summary {
  font-size: 0.78rem;
  color: var(--text-sub);
  line-height: 1.55;
}
.knowledge-entry-detail {
  font-size: 0.74rem;
  color: var(--text-dim);
  line-height: 1.5;
}
.knowledge-entry-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.3rem;
}
.knowledge-empty {
  padding: var(--sp-5);
  border-radius: 16px;
  border: 1px dashed rgba(137, 104, 69, 0.18);
  color: var(--text-dim);
  text-align: center;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid var(--line);
}

.panel-title {
  font-family: var(--font-print);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-haze);
  letter-spacing: 0.02em;
}

.panel-desc {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-top: var(--sp-1);
  line-height: 1.5;
}

.panel-actions { display: flex; gap: var(--sp-2); flex-shrink: 0; }

/* ─── Tab Bar ──────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-4);
  border: 1px solid var(--grid);
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-term);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.tab-btn:hover { border-color: var(--grid-bright); color: var(--text-sub); }
.tab-btn.active {
  background: var(--cyan-dim);
  border-color: var(--cyan-glow);
  color: var(--cyan-peak);
}
.tab-btn .count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  background: rgba(59, 210, 228, 0.15);
  color: var(--cyan-peak);
}
.tab-btn.active .count { background: rgba(59, 210, 228, 0.25); }

/* ─── Push Card Grid ───────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-4);
}

.push-card {
  position: relative;
  border: 1px solid var(--grid);
  border-radius: var(--r-lg);
  background: #ffffff;
  padding: var(--sp-4) var(--sp-6);
  cursor: pointer;
  transition: all 0.28s var(--ease-out);
  overflow: hidden;
  animation: cardIn 0.4s var(--ease-out) both;
}

.push-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan-peak), transparent);
  opacity: 0;
  transition: opacity 0.28s;
}

.push-card:hover {
  border-color: var(--grid-bright);
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(59, 210, 228, 0.06);
}
.push-card:hover::before { opacity: 1; }

.push-card.type-risk::before { background: linear-gradient(90deg, transparent, var(--red-peak), transparent); }
.push-card.type-branch::before { background: linear-gradient(90deg, transparent, var(--amber-peak), transparent); }

/* New card indicator */
.push-card.new-card::after {
  content: '';
  position: absolute;
  top: var(--sp-3); right: var(--sp-3);
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--cyan-peak);
  box-shadow: 0 0 8px var(--cyan-peak);
  animation: pulse 2s ease-in-out infinite;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
}

.type-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.type-customer { background: linear-gradient(135deg, rgba(59, 210, 228, 0.2), rgba(59, 210, 228, 0.1)); color: var(--cyan-peak); border: 1px solid rgba(59, 210, 228, 0.3); }
.type-branch   { background: linear-gradient(135deg, rgba(255, 190, 60, 0.2), rgba(255, 190, 60, 0.1)); color: var(--amber-peak); border: 1px solid rgba(255, 190, 60, 0.3); }
.type-risk     { background: linear-gradient(135deg, rgba(255, 80, 80, 0.2), rgba(255, 80, 80, 0.1)); color: var(--red-peak); border: 1px solid rgba(255, 80, 80, 0.3); }
.type-product  { background: linear-gradient(135deg, rgba(140, 100, 255, 0.2), rgba(140, 100, 255, 0.1)); color: #722ed1; border: 1px solid rgba(114, 46, 209, 0.3); }

.card-time {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.card-title {
  font-family: var(--font-print);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-peak);
  margin-bottom: var(--sp-2);
  line-height: 1.35;
  letter-spacing: 0.01em;
}

.card-summary {
  font-size: 0.85rem;
  color: var(--text-body);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--line);
}

.skill-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  color: var(--text-dim);
  background: rgba(59, 210, 228, 0.05);
  border: 1px solid rgba(59, 210, 228, 0.12);
  border-radius: var(--r-sm);
  padding: 2px 8px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
}
.status-pending   { background: var(--amber-dim); color: var(--amber-peak); border: 1px solid rgba(255,190,60,0.25); }
.status-viewed    { background: var(--cyan-dim); color: var(--cyan-peak); border: 1px solid rgba(59,210,228,0.25); }
.status-useful    { background: var(--ok-dim); color: var(--ok-peak); border: 1px solid rgba(60,220,130,0.25); }
.status-next_step { background: var(--red-dim); color: var(--red-peak); border: 1px solid rgba(255,80,80,0.25); }

/* ─── Deep Analysis Page ───────────────────────────────────────── */
.analysis-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--grid);
  border-radius: var(--r-md);
  background: #ffffff;
  color: var(--text-sub);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-back:hover { border-color: var(--grid-bright); color: var(--text-peak); }

/* Conclusion Card — hero section */
.conclusion-card {
  position: relative;
  border: 1px solid rgba(59, 210, 228, 0.25);
  border-radius: var(--r-xl);
  padding: var(--sp-6) var(--sp-8);
  margin-bottom: var(--sp-4);
  background:
    linear-gradient(135deg, rgba(59, 210, 228, 0.06) 0%, rgba(255, 190, 60, 0.04) 100%),
    #ffffff;
  overflow: hidden;
  animation: slideUp 0.5s var(--ease-out) 0.15s both;
}

.conclusion-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--cyan-peak), var(--amber-peak));
  box-shadow: 0 0 20px var(--cyan-glow);
}

.conclusion-card::after {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59, 210, 228, 0.04) 0%, transparent 70%);
  pointer-events: none;
}

.conclusion-eyebrow {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}

.skill-source-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--cyan-dim);
  border: 1px solid rgba(59, 210, 228, 0.25);
  color: var(--cyan-peak);
  letter-spacing: 0.05em;
}

.conclusion-main {
  font-family: var(--font-print);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-haze);
  line-height: 1.5;
  margin-bottom: var(--sp-4);
  letter-spacing: 0.01em;
}

.trigger-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: var(--sp-3);
}

.trigger-strip.compact {
  margin-top: 10px;
  margin-bottom: 0;
}

.trigger-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  line-height: 1.2;
  color: var(--text-sub);
  background: rgba(59, 210, 228, 0.08);
  border: 1px solid rgba(59, 210, 228, 0.16);
}

.trigger-pill.highlight {
  color: var(--amber-peak);
  background: rgba(255, 190, 60, 0.08);
  border-color: rgba(255, 190, 60, 0.2);
}

.reasoning-chain {
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  margin-top: var(--sp-3);
}

.reasoning-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 0.8rem;
  user-select: none;
}

.reasoning-toggle:hover { color: var(--text-sub); }

.reasoning-content {
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
  color: var(--text-sub);
  line-height: 1.7;
  display: none;
}
.reasoning-content.open { display: block; }

.reasoning-step {
  opacity: 0;
  animation: fadeSlideIn 0.4s var(--ease-out) forwards;
}
.reasoning-step:nth-child(1) { animation-delay: 0.05s; }
.reasoning-step:nth-child(2) { animation-delay: 0.12s; }
.reasoning-step:nth-child(3) { animation-delay: 0.19s; }
.reasoning-step:nth-child(4) { animation-delay: 0.26s; }

/* ─── Analysis Body Grid ────────────────────────────────────────── */
.analysis-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
}

.analysis-subnav {
  margin-bottom: var(--sp-4);
}

.analysis-tab-panel {
  display: none;
}

.analysis-tab-panel.active {
  display: block;
}

.drilldown-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-3);
}

.chain-graph {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: var(--sp-3);
  align-items: start;
}

.chain-graph-col {
  display: grid;
  gap: var(--sp-3);
}

.chain-graph-center {
  border: 1px solid rgba(59, 210, 228, 0.22);
  background: linear-gradient(160deg, rgba(59, 210, 228, 0.08), rgba(255, 190, 60, 0.04));
}

.chain-graph-node {
  position: relative;
}

.chain-graph-node::after {
  content: '';
  position: absolute;
  top: 50%;
  right: -20px;
  width: 20px;
  height: 1px;
  background: rgba(59, 210, 228, 0.25);
}

.chain-graph-col:last-child .chain-graph-node::after {
  left: -20px;
  right: auto;
}

.drilldown-card.clickable {
  cursor: pointer;
  transition: transform 0.2s var(--ease-out), border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}

.drilldown-card.clickable:hover {
  transform: translateY(-2px);
  border-color: var(--grid-bright);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
}

.drilldown-card {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  background: rgba(0, 0, 0, 0.02);
}

.drilldown-card-title {
  color: var(--text-peak);
  font-size: 0.86rem;
  font-weight: 600;
}

.drilldown-card-subtitle {
  color: var(--text-sub);
  font-size: 0.76rem;
  line-height: 1.5;
  margin-top: 4px;
}

.drilldown-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.drilldown-group {
  margin-bottom: var(--sp-4);
}

.drilldown-group-title {
  font-family: var(--font-print);
  color: var(--text-haze);
  margin-bottom: var(--sp-3);
  font-size: 0.96rem;
}

.analysis-card {
  border: 1px solid var(--grid);
  border-radius: var(--r-lg);
  background: #ffffff;
  padding: var(--sp-4) var(--sp-6);
  animation: slideUp 0.5s var(--ease-out) both;
}
.analysis-card:nth-child(1) { animation-delay: 0.1s; }
.analysis-card:nth-child(2) { animation-delay: 0.18s; }
.analysis-card:nth-child(3) { animation-delay: 0.26s; }
.analysis-card:nth-child(4) { animation-delay: 0.34s; }

.analysis-card-header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--line);
}

.analysis-card-icon {
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.analysis-card-title {
  font-family: var(--font-print);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-peak);
  letter-spacing: 0.05em;
}

.analysis-card h4 { font-size: 0.78rem; color: var(--text-dim); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: var(--sp-3); }

/* Evidence list */
.evidence-list { list-style: none; display: grid; gap: var(--sp-3); }
.evidence-item {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  font-size: 0.84rem;
  color: var(--text-body);
  line-height: 1.5;
  padding: var(--sp-2) var(--sp-3);
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--r-sm);
  border-left: 2px solid var(--cyan-glow);
}
.evidence-metric { font-weight: 700; color: var(--cyan-peak); font-variant-numeric: tabular-nums; min-width: 60px; }
.evidence-label { color: var(--text-sub); }

/* Opportunities & Risks */
.opp-list, .risk-list { display: grid; gap: var(--sp-2); }
.opp-item, .risk-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 0.84rem;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
}
.opp-item { background: rgba(60, 220, 130, 0.06); border: 1px solid rgba(60, 220, 130, 0.18); color: var(--ok-peak); }
.risk-item { background: rgba(255, 80, 80, 0.06); border: 1px solid rgba(255, 80, 80, 0.18); color: var(--red-peak); }
.opp-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok-peak); flex-shrink: 0; }
.risk-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--red-peak); flex-shrink: 0; animation: pulse 2.5s ease-in-out infinite; }

/* Actions */
.action-list { list-style: none; display: grid; gap: var(--sp-2); }
.action-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: 0.84rem;
  color: var(--text-body);
  padding: var(--sp-2) var(--sp-3);
  background: rgba(255, 190, 60, 0.04);
  border: 1px solid rgba(255, 190, 60, 0.15);
  border-radius: var(--r-sm);
}
.action-priority {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px; height: 22px;
  border-radius: 50%;
  font-size: 0.68rem;
  font-weight: 800;
  flex-shrink: 0;
}
.priority-p1 { background: var(--red-peak); color: var(--text-void); }
.priority-p2 { background: var(--amber-peak); color: var(--text-void); }
.priority-p3 { background: var(--cyan-peak); color: var(--text-void); }

/* ─── Q&A Section ──────────────────────────────────────────────── */
.qa-section {
  border: 1px solid var(--grid);
  border-radius: var(--r-lg);
  background: #ffffff;
  overflow: hidden;
  animation: slideUp 0.5s var(--ease-out) 0.35s both;
}

.qa-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-6);
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.15);
}

.qa-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-6);
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.06);
}

.qa-title {
  font-family: var(--font-print);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-peak);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.qa-badge {
  font-size: 0.72rem;
  color: var(--text-dim);
  background: rgba(59, 210, 228, 0.06);
  border: 1px solid rgba(59, 210, 228, 0.12);
  border-radius: var(--r-sm);
  padding: 3px 10px;
  font-family: var(--font-term);
  font-weight: 400;
}

.qa-messages {
  max-height: 35vh;
  overflow-y: auto;
  padding: var(--sp-4) var(--sp-6);
  display: grid;
  gap: var(--sp-3);
}

.qa-msg {
  display: grid;
  gap: var(--sp-1);
  max-width: 82%;
  animation: fadeSlideIn 0.3s var(--ease-out) both;
}
.qa-msg.user { justify-self: end; }
.qa-msg.assistant { justify-self: start; }

.qa-bubble {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-lg);
  font-size: 0.86rem;
  line-height: 1.65;
  white-space: pre-wrap;
}
.qa-msg.user .qa-bubble {
  background: linear-gradient(135deg, var(--cyan-dim), rgba(59, 210, 228, 0.08));
  border: 1px solid rgba(59, 210, 228, 0.3);
  color: var(--text-peak);
  border-bottom-right-radius: var(--r-sm);
}
.qa-msg.assistant .qa-bubble {
  background: linear-gradient(135deg, var(--amber-dim), rgba(255, 190, 60, 0.06));
  border: 1px solid rgba(255, 190, 60, 0.25);
  color: var(--text-body);
  border-bottom-left-radius: var(--r-sm);
}

.qa-followup-card {
  border: 1px solid rgba(59, 210, 228, 0.16);
  background: linear-gradient(160deg, rgba(6, 24, 46, 0.88), rgba(6, 24, 46, 0.68));
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  display: grid;
  gap: var(--sp-2);
}

.qa-followup-card.is-confirmed {
  border-color: rgba(60, 220, 130, 0.24);
  background: linear-gradient(160deg, rgba(14, 38, 28, 0.88), rgba(8, 28, 22, 0.72));
}

.qa-followup-card.is-collecting {
  border-color: rgba(255, 190, 60, 0.22);
}

.qa-followup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}

.qa-followup-title {
  color: var(--text-void);
  font-size: 0.8rem;
  font-weight: 700;
}

.qa-followup-desc,
.qa-followup-foot {
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.76rem;
  line-height: 1.55;
}

.qa-followup-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.qa-followup-actions {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-top: 2px;
}

.qa-followup-btn {
  min-width: 96px;
}

.qa-meta {
  font-size: 0.68rem;
  color: var(--text-dim);
  padding: 0 var(--sp-2);
}
.qa-msg.user .qa-meta { text-align: right; }

.qa-thinking {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 0.8rem;
  color: var(--text-dim);
  padding: var(--sp-2) var(--sp-4);
}
.thinking-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--amber-peak);
  animation: thinkingPulse 1.2s ease-in-out infinite;
}

.qa-input-area {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.15);
}

.qa-input {
  flex: 1;
  background: rgba(5, 15, 30, 0.8);
  border: 1px solid rgba(59, 210, 228, 0.22);
  border-radius: var(--r-lg);
  padding: var(--sp-3) var(--sp-4);
  color: var(--text-void);
  font-family: var(--font-term);
  font-size: 0.88rem;
  resize: none;
  transition: border-color 0.2s;
  min-height: 44px;
  max-height: 120px;
}
.qa-input:focus { outline: none; border-color: var(--cyan-glow); box-shadow: 0 0 0 3px var(--cyan-dim); }
.qa-input::placeholder { color: #8090a8; }

/* Quick question chips */
.quick-questions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-6) 0;
}
.quick-q {
  display: inline-flex;
  padding: var(--sp-1) var(--sp-3);
  border: 1px solid var(--grid);
  border-radius: 16px;
  font-size: 0.75rem;
  color: var(--text-sub);
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s;
}
.quick-q:hover { border-color: var(--cyan-glow); color: var(--cyan-peak); background: var(--cyan-dim); }

/* ─── Action Buttons Row ────────────────────────────────────────── */
.action-row {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-bottom: var(--sp-4);
}

.generated-box {
  margin-top: var(--sp-4);
  padding: var(--sp-4) var(--sp-6);
  border: 1px solid rgba(60, 220, 130, 0.3);
  border-radius: var(--r-lg);
  background: rgba(255, 251, 245, 0.96);
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text-body);
  white-space: pre-wrap;
  animation: fadeSlideIn 0.3s var(--ease-out);
}

.generated-section + .generated-section {
  margin-top: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 1px dashed rgba(137, 104, 69, 0.16);
}

.generated-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}

.generated-title {
  font-family: var(--font-print);
  font-size: 1rem;
  color: var(--text-peak);
  font-weight: 700;
}

.generated-meta {
  font-size: 0.76rem;
  color: var(--text-dim);
}

.generated-content {
  background: rgba(248, 240, 230, 0.58);
  border: 1px solid rgba(137, 104, 69, 0.12);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  white-space: pre-wrap;
}

/* ─── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-5);
  border-radius: var(--r-md);
  font-family: var(--font-term);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.22s var(--ease-out);
  border: 1px solid transparent;
  white-space: nowrap;
  min-height: 40px;
  letter-spacing: 0.02em;
}
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-primary {
  background: linear-gradient(135deg, var(--cyan-peak), #1a9a9e);
  border-color: rgba(59, 210, 228, 0.4);
  color: var(--text-void);
  box-shadow: 0 0 16px rgba(59, 210, 228, 0.2);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(59, 210, 228, 0.4);
}

.btn-amber {
  background: linear-gradient(135deg, var(--amber-peak), #aa7010);
  border-color: rgba(255, 190, 60, 0.4);
  color: var(--text-void);
  box-shadow: 0 0 16px rgba(255, 190, 60, 0.15);
}
.btn-amber:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(255, 190, 60, 0.3); }

.btn-ghost {
  background: #ffffff;
  border-color: var(--grid);
  color: var(--text-sub);
}
.btn-ghost:hover { border-color: var(--grid-bright); color: var(--text-peak); transform: translateY(-2px); }

.btn-danger {
  background: rgba(255, 80, 80, 0.1);
  border-color: rgba(255, 80, 80, 0.3);
  color: var(--red-peak);
}
.btn-danger:hover { background: rgba(255, 80, 80, 0.18); transform: translateY(-2px); }

.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }
.btn:active:not(:disabled) { transform: translateY(0) scale(0.98); }

/* ─── Skill Center ──────────────────────────────────────────────── */
.skill-table-wrap {
  border: 1px solid var(--grid);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: #ffffff;
}

.skill-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.skill-table thead {
  background: rgba(0, 0, 0, 0.04);
  border-bottom: 1px solid var(--grid-bright);
}

.skill-table th {
  text-align: left;
  padding: var(--sp-3) var(--sp-4);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.skill-table td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.skill-table tr:last-child td { border-bottom: none; }
.skill-table tbody tr { transition: background 0.15s; }
.skill-table tbody tr:hover { background: rgba(59, 210, 228, 0.04); }

.skill-name { font-weight: 600; color: var(--text-peak); }
.skill-desc { color: var(--text-dim); font-size: 0.78rem; margin-top: 2px; }

/* ─── Memory Page ───────────────────────────────────────────────── */
.memory-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}

.memory-card {
  border: 1px solid var(--grid);
  border-radius: var(--r-lg);
  background: #ffffff;
  padding: var(--sp-5) var(--sp-6);
}
.memory-card.full { grid-column: 1 / -1; }

.memory-card-title {
  font-family: var(--font-print);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-peak);
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* Toggle switch */
.toggle-list { display: grid; gap: var(--sp-3); }
.toggle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3);
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all 0.2s;
  gap: var(--sp-4);
}
.toggle-item:hover { border-color: var(--grid-bright); }
.toggle-item.active { border-color: var(--cyan-glow); background: rgba(59, 210, 228, 0.05); }

.toggle-label { font-size: 0.86rem; color: var(--text-body); flex: 1; }
.toggle-sub { font-size: 0.72rem; color: var(--text-dim); margin-top: 2px; }

.toggle-switch {
  position: relative;
  width: 36px; height: 20px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(89, 158, 206, 0.2);
  border: 1px solid var(--grid);
  cursor: pointer;
  transition: all 0.25s;
}
.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: all 0.25s var(--ease-spring);
}
.toggle-switch input:checked + .toggle-track { background: var(--cyan-dim); border-color: var(--cyan-glow); }
.toggle-switch input:checked + .toggle-track::after { transform: translateX(16px); background: var(--cyan-peak); box-shadow: 0 0 8px var(--cyan-glow); }

/* Subscription list */
.sub-list { display: grid; gap: var(--sp-3); }
.sub-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: border-color 0.2s;
}
.sub-item:hover { border-color: var(--grid-bright); }
.sub-info { flex: 1; }
.sub-type { font-size: 0.68rem; color: var(--cyan-peak); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; }
.sub-name { font-size: 0.86rem; color: var(--text-peak); margin-top: 2px; }
.sub-freq { font-size: 0.72rem; color: var(--text-dim); margin-top: 2px; }
.field-help {
  font-size: 0.76rem;
  color: var(--text-dim);
  line-height: 1.6;
}
.preset-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-3);
}
.preset-card {
  border: 1px solid rgba(137, 104, 69, 0.14);
  border-radius: 18px;
  padding: var(--sp-4);
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.98), rgba(247, 239, 228, 0.94));
  display: grid;
  gap: 0.7rem;
}
.preset-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-2);
}
.preset-head > div:first-child {
  flex: 1;
  min-width: 0;
}
.preset-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-peak);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.preset-sub {
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.preset-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.24rem 0.62rem;
  border-radius: 999px;
  background: rgba(52, 125, 126, 0.1);
  color: var(--cyan-peak);
  border: 1px solid rgba(52, 125, 126, 0.16);
  font-size: 0.74rem;
  white-space: nowrap;
}
.preset-desc,
.preset-tip {
  font-size: 0.82rem;
  line-height: 1.65;
}
.preset-desc { color: var(--text-sub); }
.preset-tip { color: var(--amber-peak); }
.preset-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}
.preset-actions .btn {
  flex: 1 1 140px;
}

/* ─── Simulation Page ───────────────────────────────────────────── */
.sim-panel {
  border: 1px solid var(--grid);
  border-radius: var(--r-lg);
  background: #ffffff;
  padding: var(--sp-5) var(--sp-6);
  margin-bottom: var(--sp-4);
}

.sim-result {
  margin-top: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  font-size: 0.84rem;
  display: none;
  animation: fadeSlideIn 0.3s var(--ease-out);
}
.sim-result.show { display: block; }
.sim-result.ok { background: rgba(14, 47, 41, 0.5); border: 1px solid rgba(60, 220, 130, 0.3); color: var(--ok-peak); }
.sim-result.error { background: rgba(51, 14, 14, 0.5); border: 1px solid rgba(255, 80, 80, 0.3); color: var(--red-peak); }

/* ─── Modal ────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 12, 24, 0.88);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: var(--sp-4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal-panel {
  width: min(760px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  border: 1px solid var(--grid-bright);
  border-radius: var(--r-xl);
  background: #ffffff;
  padding: var(--sp-6) var(--sp-8);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(59, 210, 228, 0.05);
  transform: scale(0.96) translateY(8px);
  transition: transform 0.25s var(--ease-out);
}
.modal-overlay.open .modal-panel { transform: scale(1) translateY(0); }

.modal-title {
  font-family: var(--font-print);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-haze);
  margin-bottom: var(--sp-5);
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.modal-actions { display: flex; gap: var(--sp-3); justify-content: flex-end; margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px solid var(--line); }

/* ─── Form Elements ─────────────────────────────────────────────── */
.field { display: grid; gap: var(--sp-1); }
.field-label { font-size: 0.76rem; font-weight: 600; color: var(--text-dim); letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: var(--sp-1); }

.input, .select, .textarea {
  background: rgba(3, 10, 22, 0.85);
  border: 1px solid rgba(59, 210, 228, 0.22);
  border-radius: var(--r-md);
  color: var(--text-void);
  font-family: var(--font-term);
  font-size: 0.88rem;
  padding: var(--sp-3) var(--sp-4);
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}
.select option {
  background: #0f172a;
  color: #f8fafc;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--cyan-glow);
  box-shadow: 0 0 0 3px var(--cyan-dim);
}
.input::placeholder, .textarea::placeholder { color: var(--text-dim); }
.select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234a7a9e' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }
.textarea { resize: vertical; min-height: 100px; font-family: 'Courier New', monospace; font-size: 0.82rem; line-height: 1.6; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }

/* ─── Toast ─────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  right: var(--sp-6);
  bottom: var(--sp-6);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-lg);
  font-size: 0.84rem;
  font-weight: 500;
  background: #ffffff;
  border: 1px solid var(--cyan-glow);
  color: var(--cyan-peak);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08), 0 0 20px rgba(59, 210, 228, 0.15);
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s var(--ease-spring);
}
.toast.show { opacity: 1; transform: translateY(0) scale(1); }
.toast.error { border-color: var(--red-glow); color: var(--red-peak); box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08), 0 0 20px rgba(255, 80, 80, 0.15); }
.toast.ok { border-color: var(--ok-glow); color: var(--ok-peak); box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08), 0 0 20px rgba(60, 220, 130, 0.15); }

/* ─── Empty State ───────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--sp-12) var(--sp-4);
  color: var(--text-dim);
}
.empty-icon { font-size: 2.5rem; margin-bottom: var(--sp-3); opacity: 0.5; }
.empty-state p { font-size: 0.9rem; }

/* ─── Loading Skeleton ─────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--trench) 25%, rgba(59, 210, 228, 0.05) 50%, var(--trench) 75%);
  background-size: 400% 100%;
  animation: shimmer 2s ease-in-out infinite;
  border-radius: var(--r-sm);
}

/* ─── Animations ───────────────────────────────────────────────── */
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes panelIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.85); }
}

@keyframes thinkingPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.7); }
}

/* ─── Thinking Panel ───────────────────────────────────────────── */
.thinking-overlay {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(3,12,24,0.5);
  backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
}
.thinking-overlay.open { opacity: 1; pointer-events: auto; }

.thinking-panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 1000;
  width: 340px; max-width: 90vw;
  background: var(--bg-secondary);
  border-left: 1px solid rgba(59,221,217,0.2);
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
  display: flex; flex-direction: column;
  box-shadow: -8px 0 40px rgba(0,0,0,0.5);
}
.thinking-panel.open { transform: translateX(0); }

.thinking-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(59,221,217,0.15);
  background: rgba(59,221,217,0.05);
  font-weight: 600; font-size: 0.95rem; color: var(--accent);
}
.btn-close-think {
  background: none; border: none; color: var(--text-muted);
  font-size: 1.5rem; cursor: pointer; line-height: 1; padding: 0 4px;
  transition: color 0.2s;
}
.btn-close-think:hover { color: var(--accent); }

.thinking-content {
  flex: 1; overflow-y: auto; padding: 1rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(59,221,217,0.3) transparent;
}
.thinking-content::-webkit-scrollbar { width: 4px; }
.thinking-content::-webkit-scrollbar-thumb { background: rgba(59,221,217,0.3); border-radius: 2px; }

.think-section {
  background: rgba(59,221,217,0.04);
  border: 1px solid rgba(59,221,217,0.12);
  border-radius: 8px; padding: 0.875rem;
  margin-bottom: 0.75rem;
}
.think-section-title {
  font-size: 0.7rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--accent);
  margin-bottom: 0.5rem; display: flex; align-items: center; gap: 0.4rem;
}
.think-section-title::before {
  content: ''; display: inline-block;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 8px var(--accent);
}
.think-row {
  display: flex; gap: 0.5rem; margin-bottom: 0.35rem; font-size: 0.82rem;
}
.think-label { color: var(--text-muted); min-width: 70px; flex-shrink: 0; }
.think-value { color: var(--text); word-break: break-all; }
.think-tag {
  display: inline-block; padding: 1px 6px; border-radius: 4px;
  font-size: 0.72rem; background: rgba(59,221,217,0.1); color: var(--accent);
  border: 1px solid rgba(59,221,217,0.2);
}
.think-tag.warn {
  background: rgba(255,190,60,0.1); color: var(--amber);
  border-color: rgba(255,190,60,0.2);
}
.think-tag.match {
  background: rgba(47,122,123,0.12);
  color: var(--cyan-peak);
  border-color: rgba(47,122,123,0.22);
}
.think-block {
  background: rgba(0,0,0,0.3); border-radius: 6px;
  padding: 0.6rem 0.75rem; font-size: 0.78rem;
  color: var(--text-secondary); font-family: 'Noto Sans SC', monospace;
  white-space: pre-wrap; word-break: break-all;
  max-height: 150px; overflow-y: auto;
  border: 1px solid rgba(59,221,217,0.06);
  scrollbar-width: thin;
  scrollbar-color: rgba(59,221,217,0.2) transparent;
}
.think-chat-item {
  background: rgba(59,221,217,0.04);
  border: 1px solid rgba(59,221,217,0.1);
  border-radius: 8px; padding: 0.75rem; margin-bottom: 0.5rem;
}
.think-chat-q { color: var(--text-muted); font-size: 0.8rem; margin-bottom: 0.3rem; }
.think-chat-a { color: var(--text); font-size: 0.82rem; line-height: 1.5; }
.think-empty { text-align: center; color: var(--text-muted); font-size: 0.85rem; padding: 1rem; }
.think-knowledge-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}
.think-knowledge-column {
  border: 1px solid rgba(59,221,217,0.12);
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  padding: 0.75rem;
  display: grid;
  gap: 0.6rem;
}
.think-knowledge-head {
  padding-bottom: 0.45rem;
  border-bottom: 1px solid rgba(59,221,217,0.08);
}
.think-knowledge-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-peak);
}
.think-knowledge-meta {
  font-size: 0.68rem;
  color: var(--text-dim);
  margin-top: 0.18rem;
  line-height: 1.45;
}
.think-knowledge-list {
  display: grid;
  gap: 0.5rem;
}
.think-knowledge-item {
  border-radius: 8px;
  padding: 0.6rem;
  background: rgba(59,221,217,0.04);
  border: 1px solid rgba(59,221,217,0.08);
}
.think-knowledge-item-title {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text);
}
.think-knowledge-item-sub {
  font-size: 0.67rem;
  color: var(--cyan-peak);
  margin-top: 0.12rem;
}
.think-knowledge-item-detail {
  font-size: 0.73rem;
  color: var(--text-sub);
  margin-top: 0.35rem;
  line-height: 1.45;
}
.think-knowledge-why {
  margin-top: 0.45rem;
  padding: 0.48rem 0.55rem;
  border-radius: 8px;
  background: rgba(47, 122, 123, 0.08);
  border: 1px solid rgba(47, 122, 123, 0.14);
  font-size: 0.72rem;
  color: var(--text-sub);
  line-height: 1.55;
}
.term-hit {
  background: rgba(181, 106, 28, 0.18);
  color: var(--amber-peak);
  padding: 0 2px;
  border-radius: 4px;
}
.think-knowledge-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.45rem;
}
.think-link-map {
  display: grid;
  gap: 0.7rem;
}
.think-link-row {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) auto minmax(0, 1.35fr);
  gap: 0.55rem;
  align-items: stretch;
}
.think-link-sentence,
.think-link-target {
  border: 1px solid rgba(137, 104, 69, 0.12);
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  padding: 0.65rem;
}
.think-link-source {
  font-size: 0.66rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.3rem;
}
.think-link-text,
.think-link-target-why {
  font-size: 0.76rem;
  color: var(--text-sub);
  line-height: 1.55;
}
.think-link-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--amber-peak);
  font-size: 1rem;
  font-weight: 700;
}
.think-link-targets {
  display: grid;
  gap: 0.45rem;
}
.think-link-target-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.35rem;
}
.think-link-target-title {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text);
}
.think-link-target-sub {
  font-size: 0.68rem;
  color: var(--cyan-peak);
  margin-top: 0.12rem;
  margin-bottom: 0.28rem;
}
.think-link-target-why {
  margin-top: 0.2rem;
}

/* ─── Admin Panel ─────────────────────────────────────────────── */
.admin-toolbar {
  display: flex; gap: 0.75rem; align-items: center;
  margin-bottom: 1.25rem; flex-wrap: wrap;
}
.admin-table-wrap {
  background: var(--bg-card);
  border: 1px solid rgba(59,221,217,0.1);
  border-radius: 12px; overflow: hidden;
}
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.admin-table th {
  background: rgba(59,221,217,0.06); padding: 0.6rem 0.75rem;
  text-align: left; font-weight: 600; color: var(--accent);
  border-bottom: 1px solid rgba(59,221,217,0.15);
  white-space: nowrap; position: sticky; top: 0;
}
.admin-table td {
  padding: 0.55rem 0.75rem; border-bottom: 1px solid rgba(59,221,217,0.05);
  color: var(--text); max-width: 200px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: rgba(59,221,217,0.04); }
.admin-table tr.row-readonly td { color: var(--text-muted); font-style: italic; }
.admin-table .col-id { color: var(--text-secondary); font-size: 0.75rem; max-width: 100px; }
.admin-table .cell-json { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.admin-table .cell-json:hover { color: var(--accent); }
.admin-table .cell-actions { white-space: nowrap; }
.admin-table .btn-edit-row {
  background: none; border: 1px solid rgba(59,221,217,0.3);
  color: var(--accent); padding: 2px 8px; border-radius: 4px;
  cursor: pointer; font-size: 0.75rem; transition: all 0.2s;
}
.admin-table .btn-edit-row:hover { background: rgba(59,221,217,0.1); }
.admin-table .btn-edit-row:disabled { opacity: 0.3; cursor: not-allowed; }
.admin-pagination {
  display: flex; gap: 0.5rem; align-items: center; justify-content: center;
  padding: 0.75rem; border-top: 1px solid rgba(59,221,217,0.05);
}
.admin-pagination .btn {
  padding: 4px 12px; font-size: 0.8rem;
}
.admin-info { font-size: 0.78rem; color: var(--text-muted); margin-left: auto; }
.admin-table-wrap .empty-state { color: var(--text-muted); font-size: 0.85rem; }
.admin-badge-readonly {
  font-size: 0.68rem; padding: 1px 5px; border-radius: 3px;
  background: rgba(255,190,60,0.15); color: var(--amber);
  border: 1px solid rgba(255,190,60,0.2); margin-left: 6px;
}
.admin-badge-loading {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-muted); font-size: 0.85rem; padding: 2rem;
}
.admin-badge-loading::before {
  content: ''; display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; background: var(--accent);
  animation: thinkingPulse 1s ease-in-out infinite;
}
.admin-detail-row {
  display: grid;
  gap: 0.45rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid rgba(59,221,217,0.08);
}
.admin-detail-row:last-child { border-bottom: none; }
.admin-detail-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.05em;
}
.admin-detail-value {
  margin: 0;
  padding: 0.8rem 0.95rem;
  background: rgba(59,221,217,0.04);
  border: 1px solid rgba(59,221,217,0.08);
  border-radius: 10px;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.8rem;
  line-height: 1.55;
  max-height: 260px;
  overflow: auto;
}

/* ─── Bright Theme Overrides + Persistent Whitebox ────────────── */
:root {
  --void: #f4eee3;
  --deep: #fbf7ef;
  --abyss: #fffdf8;
  --trench: #f6efe4;
  --shallows: #ede3d4;
  --grid: rgba(137, 104, 69, 0.12);
  --grid-bright: rgba(137, 104, 69, 0.24);
  --line: rgba(137, 104, 69, 0.14);
  --line-hover: rgba(137, 104, 69, 0.3);
  --text-void: #fffdf9;
  --text-dim: #8b755f;
  --text-sub: #64513f;
  --text-body: #3f2f22;
  --text-peak: #261b12;
  --text-haze: #1f150f;
  --cyan-dim: rgba(52, 125, 126, 0.08);
  --cyan-glow: rgba(52, 125, 126, 0.2);
  --cyan-peak: #2f7a7b;
  --amber-dim: rgba(210, 145, 64, 0.1);
  --amber-glow: rgba(210, 145, 64, 0.26);
  --amber-peak: #b56a1c;
  --red-dim: rgba(201, 82, 56, 0.08);
  --red-glow: rgba(201, 82, 56, 0.18);
  --red-peak: #bf4e31;
  --ok-dim: rgba(77, 142, 91, 0.1);
  --ok-glow: rgba(77, 142, 91, 0.2);
  --ok-peak: #497b53;
  --bg-secondary: rgba(255, 252, 247, 0.98);
  --bg-card: rgba(255, 253, 249, 0.94);
  --accent: var(--cyan-peak);
}

html { font-size: 15px; }

body {
  background-color: #f8f3ea;
  background-image:
    radial-gradient(circle at 10% 10%, rgba(210, 145, 64, 0.08), transparent 30%),
    radial-gradient(circle at 90% 8%, rgba(52, 125, 126, 0.08), transparent 26%),
    linear-gradient(180deg, #fffdf8 0%, #f7efe3 100%);
  padding-right: 408px;
}

.noise { opacity: 0.025; mix-blend-mode: multiply; }

.topbar,
.nav-btn,
.push-card,
.analysis-card,
.conclusion-card,
.qa-section,
.memory-card,
.sim-panel,
.skill-table-wrap,
.admin-table-wrap,
.modal-panel {
  box-shadow: 0 18px 42px rgba(146, 120, 85, 0.08);
}

.topbar {
  background: rgba(255, 252, 246, 0.92);
  border-color: rgba(137, 104, 69, 0.16);
}

.role-switcher,
.btn-back,
.nav-btn,
.push-card,
.analysis-card,
.qa-section,
.memory-card,
.sim-panel,
.modal-panel,
.drilldown-card,
.thinking-panel,
.admin-table-wrap {
  background: rgba(255, 252, 246, 0.9);
}

.main-nav { gap: var(--sp-3); }
.nav-btn { min-height: 74px; padding: var(--sp-4) var(--sp-3); }
.nav-label { font-size: 0.82rem; }

.panel-title { font-size: 1.5rem; }
.panel-desc { font-size: 0.92rem; color: var(--text-sub); }

.tab-bar { flex-wrap: wrap; }
.tab-btn { padding: 0.45rem 0.95rem; font-size: 0.84rem; }

.push-card {
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.98), rgba(251, 246, 239, 0.96));
}

.card-title { font-size: 1.02rem; }
.card-summary { font-size: 0.9rem; color: var(--text-sub); }

.analysis-card,
.conclusion-card,
.qa-section,
.memory-card,
.sim-panel {
  border-color: rgba(137, 104, 69, 0.12);
}

.analysis-card,
.conclusion-card {
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.98), rgba(250, 244, 236, 0.96));
}

.qa-badge,
.quick-q {
  background: rgba(255, 249, 240, 0.92);
  color: var(--text-sub);
  border-color: rgba(137, 104, 69, 0.16);
}

.quick-q:hover,
.qa-badge:hover {
  color: var(--text-peak);
}

.reasoning-chain,
.qa-input-area,
.think-section,
.think-chat-item {
  background: rgba(248, 240, 230, 0.64);
}

.btn {
  min-height: 42px;
  font-size: 0.86rem;
  padding: 0.65rem 1rem;
}

.action-row {
  flex-wrap: wrap;
  gap: var(--sp-3);
}

.action-row .btn {
  flex: 1 1 180px;
}

.thinking-overlay { display: none; }

.thinking-panel {
  position: fixed;
  top: 20px;
  right: 20px;
  bottom: 20px;
  width: 380px;
  max-width: 380px;
  border: 1px solid rgba(137, 104, 69, 0.16);
  border-radius: 24px;
  border-left: 1px solid rgba(137, 104, 69, 0.16);
  transform: none;
  box-shadow: 0 28px 60px rgba(90, 63, 36, 0.12);
}

.thinking-panel.open { transform: none; }

.thinking-panel.collapsed {
  width: 72px;
  overflow: hidden;
}

.thinking-panel.collapsed .thinking-content,
.thinking-panel.collapsed .thinking-context {
  display: none;
}

.thinking-header {
  background: linear-gradient(180deg, rgba(255, 250, 242, 0.96), rgba(247, 238, 225, 0.96));
  color: var(--text-peak);
}

.thinking-context {
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 500;
}

.btn-close-think {
  font-size: 0.78rem;
  border: 1px solid rgba(137, 104, 69, 0.14);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  background: rgba(255, 255, 255, 0.75);
  color: var(--text-sub);
}

.think-section {
  border-color: rgba(137, 104, 69, 0.12);
}
.logic-note {
  background: linear-gradient(180deg, rgba(255, 247, 231, 0.96), rgba(255, 252, 246, 0.96));
  border-color: rgba(181, 106, 28, 0.2);
}
.logic-note .think-section-title,
.logic-note .think-chat-a {
  color: var(--amber-peak);
}

.think-value,
.think-chat-a {
  color: var(--text-sub);
}

.think-label,
.think-chat-q {
  color: var(--text-dim);
}

.whitebox-skill-line {
  margin-bottom: 8px;
  line-height: 1.55;
}

/* ─── Responsive ───────────────────────────────────────────────── */
@media (max-width: 1024px) {
  body { padding-right: 0; }
  .main-nav { grid-template-columns: repeat(3, 1fr); }
  .card-grid { grid-template-columns: 1fr; }
  .analysis-grid { grid-template-columns: 1fr; }
  .overview-pillars,
  .scorecard-grid { grid-template-columns: 1fr; }
  .knowledge-entry-grid { grid-template-columns: 1fr; }
  .think-link-row { grid-template-columns: 1fr; }
  .memory-grid { grid-template-columns: 1fr; }
  .preset-grid { grid-template-columns: 1fr; }
  .drilldown-grid { grid-template-columns: 1fr; }
  .chain-graph { grid-template-columns: 1fr; }
  .chain-graph-node::after,
  .chain-graph-col:last-child .chain-graph-node::after { display: none; }
  .thinking-overlay { display: block; }
  .thinking-panel {
    top: auto;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 24px 24px 0 0;
    transform: translateY(100%);
  }
  .thinking-panel.open { transform: translateY(0); }
  .thinking-panel.collapsed {
    width: 100%;
    transform: translateY(calc(100% - 64px));
  }
}

@media (max-width: 640px) {
  .app { padding: var(--sp-3) var(--sp-3) var(--sp-6); }
  .topbar { flex-direction: column; gap: var(--sp-3); }
  .main-nav { grid-template-columns: repeat(2, 1fr); }
  .panel-header { flex-direction: column; }
  .form-row { grid-template-columns: 1fr; }
  .modal-panel { padding: var(--sp-4); }
  .qa-toolbar { padding: var(--sp-2) var(--sp-4); }
  .qa-input-area { padding: var(--sp-3) var(--sp-4); }
  .quick-questions { padding: var(--sp-2) var(--sp-4) 0; }
  .card-footer { flex-wrap: wrap; gap: 8px; }
  .action-row .btn { flex-basis: 100%; }
  .thinking-panel.collapsed { transform: translateY(calc(100% - 58px)); }
  .think-knowledge-grid {
    grid-template-columns: 1fr;
  }
}


/* ─── Responsive & Hamburger Menu ──────────────────────────────── */

/* 移动端汉堡包菜单按钮 */
.mobile-menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--grid-bright);
  border-radius: var(--r-sm);
  font-size: 1.2rem;
  color: var(--text-peak);
  cursor: pointer;
  padding: 4px 10px;
}

@media (max-width: 768px) {
  .app {
    padding: var(--sp-2) var(--sp-2) var(--sp-6);
  }
  
  .topbar {
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--r-md);
  }
  
  .topbar-right {
    display: none; /* 在手机视窗上隐藏右侧以节约空间 */
  }
  
  .mobile-menu-toggle {
    display: block;
  }
  
  .main-nav {
    display: none; 
    position: absolute;
    top: 60px; 
    left: var(--sp-2);
    right: var(--sp-2);
    background: #ffffff;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    z-index: 1000;
    flex-direction: column;
    padding: var(--sp-2);
    border-radius: var(--r-md);
    border: 1px solid var(--grid);
    animation: fadeIn 0.2s ease-out forwards;
  }
  
  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
  }
  
  .main-nav.menu-open {
    display: flex;
  }
  
  .main-nav .nav-btn {
    flex-direction: row;
    justify-content: flex-start;
    padding: var(--sp-3) var(--sp-4);
    border-color: transparent;
    border-radius: var(--r-sm);
    margin-bottom: 2px;
  }
  
  .main-nav .nav-icon {
    margin-right: var(--sp-2);
  }

  .main-nav .nav-label {
    font-size: 1rem;
  }
  
  .card-grid,
  .analysis-grid,
  .drilldown-grid,
  .memory-grid {
    grid-template-columns: 1fr !important;
  }
  
  .chain-graph {
    grid-template-columns: 1fr;
    gap: var(--sp-4);
  }
  
  .chain-graph-node::after {
    display: none;
  }

  .panel-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-2);
  }
  
  .panel-actions {
    width: 100%;
    margin-top: var(--sp-2);
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
  }

  .panel-actions .btn {
    flex: 1;
    justify-content: center;
  }
  
  .push-card {
    padding: var(--sp-3);
  }
  
  .conclusion-card {
    padding: var(--sp-4);
    border-radius: var(--r-md);
  }
  .conclusion-card::after { display: none; }
  
  .action-row {
    flex-direction: column;
  }
  
  .action-row .btn {
    width: 100%;
    justify-content: center;
  }
  
  .thinking-panel {
    width: 100%;
    max-width: 100%;
    border-radius: 0;
    bottom: 0;
    top: 30%;
  }

  /* Some analysis panel subnav adjustment for mobile */
  .analysis-subnav {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 4px;
  }
  
  .analysis-subnav::-webkit-scrollbar {
    height: 4px;
  }
  .analysis-subnav::-webkit-scrollbar-thumb {
    background: var(--grid-bright);
    border-radius: 4px;
  }
}
