:root {
  --bg: #f7f9fc;
  --card: #fff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5eaf2;
  --brand: #2f6bff;
  --brand-2: #5b8cff;
  --danger: #dc2626;
  --mid: #d97706;
  --low: #2563eb;
  --gradient: linear-gradient(90deg, #5b8cff, #8b7cf8, #f0abfc);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}
#app { height: 100%; display: flex; min-height: 0; }

/* Sidebar — keep menu structure */
.sidebar {
  width: 220px;
  background: #fafbfc;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 14px 10px;
  flex-shrink: 0;
  height: 100%;
  min-height: 0;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 16px; }
.logo {
  width: 36px; height: 36px; border-radius: 10px; background: #fff;
  display: grid; place-items: center; overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.logo img { width: 30px; height: 30px; object-fit: contain; }
.brand h1 { font-size: 13px; margin: 0; color: #111827; font-weight: 700; }
.brand p { margin: 2px 0 0; font-size: 11px; color: #9ca3af; }
.nav-btn, .nav-item {
  border: 0; width: 100%; text-align: left; color: #374151;
  background: transparent; border-radius: 8px; padding: 9px 10px;
  font-size: 13px; cursor: pointer; margin-bottom: 2px;
}
.nav-btn {
  background: linear-gradient(90deg, #2f6bff, #5b8cff);
  color: #fff; font-weight: 600; margin-bottom: 10px;
}
.nav-item.on, .nav-item:hover { background: #eef2ff; color: #1d4ed8; }
a.nav-item, a.nav-link {
  display: block;
  text-decoration: none;
  color: inherit;
}
.hist { margin-top: 14px; font-size: 11px; color: #9ca3af; padding: 0 8px; flex-shrink: 0; }
.hist-list { flex: 1; overflow: auto; min-height: 0; margin-bottom: 8px; }
.hist-item {
  font-size: 12px; padding: 7px 10px; border-radius: 8px; cursor: pointer;
  color: #4b5563; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hist-item:hover { background: #f3f4f6; }
.hist-item.on { background: #eef2ff; color: #1d4ed8; font-weight: 600; }
.sidebar-bottom {
  margin-top: auto;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-mobile {
  display: flex !important;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  border-radius: 8px;
  flex-shrink: 0;
}
.nav-ico { font-size: 16px; line-height: 1; }

/* User footer (Doubao / Cursor style) */
.user-footer {
  flex-shrink: 0;
  margin-top: 6px;
  padding: 10px 8px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  border-radius: 10px;
}
.user-footer:hover { background: #f3f4f6; }
.user-footer.guest {
  cursor: default;
  gap: 8px;
}
.user-footer.guest:hover { background: transparent; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: #dbeafe; color: #1e40af;
  display: grid; place-items: center; font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.user-avatar.lg { width: 48px; height: 48px; font-size: 18px; }
.user-meta { min-width: 0; flex: 1; }
.user-name {
  font-size: 13px; font-weight: 600; color: #111827;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-name .chev { color: #9ca3af; font-weight: 400; margin-left: 2px; }
.user-plan { font-size: 11px; color: #9ca3af; margin-top: 2px; }
.auth-btn { flex: 1; padding: 8px 0; font-size: 13px; }

.auth-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.45);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.auth-card {
  width: min(360px, calc(100vw - 32px));
  background: #fff; border-radius: 14px; padding: 20px 18px 16px;
  position: relative; box-shadow: 0 16px 40px rgba(0,0,0,.18);
}
.auth-card h3 { margin: 0 0 4px; font-size: 18px; }
.auth-field { display: block; margin-bottom: 10px; font-size: 12px; color: var(--muted); }
.auth-field span { display: block; margin-bottom: 6px; }
.auth-field input {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font: inherit; font-size: 14px;
}
.auth-close {
  position: absolute; top: 10px; right: 12px; border: 0; background: transparent;
  font-size: 20px; color: #9ca3af; cursor: pointer; line-height: 1;
}
.auth-profile { display: flex; gap: 12px; align-items: center; margin-top: 12px; }
.auth-name { font-size: 16px; font-weight: 650; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); height: 100%; }
.top {
  height: 56px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 20px; flex-shrink: 0;
}
.top h2 { margin: 0; font-size: 16px; font-weight: 650; }
.search {
  border: 1px solid var(--line); border-radius: 20px; padding: 8px 14px;
  width: 260px; font-size: 13px; background: #fff;
}
.search:focus { outline: none; border-color: var(--brand); }
.content { flex: 1; overflow: auto; padding: 16px 24px 28px; }

/* Skills page (ref screenshot 2) */
.skills-page { display: flex; flex-direction: column; height: 100%; }
.skills-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 20px 24px 8px; background: #fff; border-bottom: 1px solid var(--line);
}
.skills-header h2 { margin: 0 0 4px; font-size: 22px; font-weight: 700; }
.featured-scenes {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px;
}
.scene-card {
  border-radius: 12px; padding: 16px; min-height: 110px; cursor: pointer;
  background: linear-gradient(145deg, color-mix(in srgb, var(--scene) 12%, #fff), #fff);
  border: 1px solid color-mix(in srgb, var(--scene) 25%, var(--line));
  transition: transform .15s, box-shadow .15s;
}
.scene-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(15,23,42,.08); }
.scene-label { font-weight: 700; color: var(--scene); margin-bottom: 8px; font-size: 14px; }
.scene-card p { margin: 0 0 10px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.scene-meta { font-size: 11px; color: #9ca3af; }
.skill-tabs {
  display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 16px;
  border-bottom: 1px solid var(--line); padding-bottom: 0;
}
.skill-tabs button {
  border: 0; background: transparent; padding: 10px 14px; font-size: 13px;
  color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.skill-tabs button.on { color: var(--text); font-weight: 650; border-bottom-color: var(--brand); }
.notice-bar {
  flex: 0 0 auto;
  width: 100%;
  margin: 0 0 6px;
  padding: 0 12px;
  box-sizing: border-box;
}
.notice-bar a,
.notice-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-sizing: border-box;
  width: auto;
  padding: 6px 4px;
  border-radius: 0;
  background: transparent;
  color: #1f2937;
  font-size: 14px;
  text-decoration: none;
}
.notice-bar a:hover,
.notice-link:hover {
  color: var(--brand);
  text-decoration: none;
}
.notice-word { flex-shrink: 0; display: block; }
.skill-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px;
}
.skill-card {
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px;
  cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.skill-card:hover { border-color: #c7d2fe; box-shadow: 0 6px 16px rgba(47,107,255,.08); }
.skill-card-head { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.skill-avatar {
  width: 40px; height: 40px; border-radius: 50%; color: #fff;
  display: grid; place-items: center; font-weight: 700; flex-shrink: 0;
}
.skill-card h3 { margin: 0; font-size: 14px; }
.skill-card p { margin: 0 0 10px; font-size: 12px; color: var(--muted); line-height: 1.55; min-height: 36px; }
.skill-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: #f3f4f6; color: #6b7280;
}

/* Chat page (ref screenshot 1) */
.chat-page { display: flex; flex-direction: column; flex: 1; min-height: 0; height: 100%; }
.chat-topbar {
  height: 48px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  background: #fff; border-bottom: 1px solid var(--line); padding: 0 16px;
}
.chat-topbar .chat-agent-name { font-size: 12px; }
.speak-btn {
  width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: transparent; color: #334155; cursor: pointer;
  display: grid; place-items: center;
}
.speak-btn:hover, .speak-btn.on { background: #e0ecff; color: #1d4ed8; }
.suggest-row {
  display: flex; flex-wrap: nowrap; gap: 8px;
  width: 100%; box-sizing: border-box; padding: 8px 12px 4px;
  overflow: hidden;
}
.suggest-chip {
  border: 1px solid #dbe3f0; background: #fff; color: #1f2937;
  border-radius: 999px; padding: 8px 12px; font-size: 13px;
  cursor: pointer; text-align: left; line-height: 1.4;
  flex: 1 1 0; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.suggest-chip:hover { border-color: #93c5fd; color: #1d4ed8; }
.chat {
  display: flex; flex-direction: column; flex: 1; min-height: 0;
  background:
    radial-gradient(ellipse 70% 45% at 50% 100%, rgba(91,140,255,.10), transparent 60%),
    radial-gradient(ellipse 50% 35% at 85% 80%, rgba(240,171,252,.08), transparent 55%),
    #fbfcfe;
}
.chat-home { justify-content: flex-end; }
.chat-talk { justify-content: flex-start; }
.chat-welcome {
  max-width: 720px; margin: 0 auto; width: calc(100% - 16%);
  display: flex; align-items: center; justify-content: center;
  flex: 1 1 auto; min-height: 0;
}
.welcome-hi { margin: 0 0 8px; font-size: 15px; color: var(--muted); }
.chat-welcome h2 { margin: 0 0 10px; font-size: 30px; font-weight: 700; color: #111827; }
.chat-welcome .accent { color: var(--brand); }
.welcome-text { text-align: center; }
.welcome-sub { margin: 0 auto; font-size: 14px; color: var(--muted); line-height: 1.6; max-width: 520px; }
.msgs {
  flex: 1; overflow: auto; min-height: 0;
  padding: 16px 12px 12px;
}
.chat-home .msgs { flex: 0; max-height: 0; padding: 0; overflow: hidden; }
.chat-talk .msgs { flex: 1 1 auto; }
.bubble-row { max-width: none; width: 100%; margin: 0 0 12px; display: flex; }
.bubble-row.user { justify-content: flex-end; }
.bubble-row.assistant { justify-content: flex-start; }
.bubble {
  max-width: 100%; width: 100%; padding: 12px 16px; border-radius: 14px;
  white-space: pre-wrap; line-height: 1.65; font-size: 14px;
  box-sizing: border-box;
}
.bubble.user { background: #e8eef8; color: #1f2937; border-radius: 14px 14px 4px 14px; max-width: 88%; width: auto; }
.bubble.assistant { background: #fff; border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; }
.bubble.stream { min-height: 24px; }
.stream-status { color: #64748b; font-size: 13px; margin-bottom: 6px; }
.stream-caret {
  display: inline-block; width: 8px; height: 1em; margin-left: 2px;
  background: #1d4ed8; vertical-align: -2px;
  animation: stream-blink 1s step-end infinite;
}
@keyframes stream-blink { 50% { opacity: 0; } }
.finding-mini { font-size: 12px; margin-top: 6px; color: #4b5563; }
.findings.inline { margin-top: 8px; }
.findings { max-width: none; width: 100%; margin: 0 0 12px; box-sizing: border-box; }
.finding {
  background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px;
  display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: start;
}
.sev { font-size: 12px; font-weight: 700; }
.sev.high { color: var(--danger); }
.sev.medium { color: var(--mid); }
.sev.low { color: var(--low); }
.citations { max-width: none; width: 100%; margin: 0 0 12px; display: grid; gap: 8px; box-sizing: border-box; }
.cite { background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.cite-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.cite p { margin: 0; color: #444; line-height: 1.5; }
.preview { max-width: none; width: 100%; margin: 0 0 12px; box-sizing: border-box; }
.preview img { max-width: 100%; border-radius: 10px; border: 1px solid var(--line); }
.preview-multi {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px;
}
.preview-multi img { width: 100%; height: 160px; object-fit: cover; }
.bubble-imgs {
  display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px;
}
.bubble-img {
  width: 96px; height: 96px; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--line); display: block;
}
.bubble.user .bubble-imgs { justify-content: flex-end; }

.composer-wrap {
  max-width: none; margin: 0; width: 100%; flex-shrink: 0;
  padding: 0 12px 8px; box-sizing: border-box;
}
.chat-home .composer-wrap { margin-top: 0; margin-bottom: 0; }
.chat-talk .composer-wrap { max-width: none; width: 100%; }
.chat-talk .skill-pills,
.chat-talk .composer-disclaimer { display: none; }
.composer {
  background: #fff;
  border: 2px solid transparent;
  border-radius: 18px;
  padding: 14px 16px 10px;
  background-image: linear-gradient(#fff, #fff), var(--gradient);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow: 0 10px 36px rgba(47,107,255,.10);
}
.composer textarea {
  width: 100%; border: 0; resize: none; min-height: 96px; outline: none;
  font: inherit; font-size: 15px; line-height: 1.55; background: transparent;
}
.composer-addr {
  border: 0; width: 100%; outline: none; font: inherit; font-size: 12px;
  color: var(--muted); margin: 4px 0 6px; background: transparent;
}
.composer-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  margin-top: 4px; padding-top: 8px;
}
.composer-tools { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; flex-wrap: wrap; }
.chip-toggle {
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px;
  font-size: 12px; background: #f8fafc; color: #4b5563; cursor: pointer;
}
.chip-toggle:hover { border-color: #c7d2fe; color: var(--brand); }
.chip-toggle.static { cursor: default; }
.model-select-inline {
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px;
  font: inherit; font-size: 12px; background: #f8fafc; color: #4b5563;
  max-width: 180px;
}
.btn.ghost.is-done {
  background: #e5e7eb;
  color: #9ca3af;
  border-color: #e5e7eb;
  pointer-events: none;
  cursor: not-allowed;
  opacity: 1;
}
.btn.ghost.is-done.is-picked {
  background: #d1d5db;
  color: #6b7280;
}
.composer-previews {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 4px;
}
.composer-thumb {
  position: relative; width: 56px; height: 56px; border-radius: 8px;
  overflow: hidden; border: 1px solid var(--line); background: #f3f4f6;
  display: grid; place-items: center;
}
.composer-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.composer-thumb .file-name { font-size: 10px; padding: 4px; text-align: center; color: #6b7280; }
.thumb-x {
  position: absolute; top: 2px; right: 2px; width: 16px; height: 16px;
  border: 0; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff;
  font-size: 11px; line-height: 16px; padding: 0; cursor: pointer;
}
.tool-btn {
  width: 32px; height: 32px; border-radius: 50%; background: #f3f4f6;
  display: grid; place-items: center; cursor: pointer; font-size: 16px; font-weight: 700;
  border: 1px solid var(--line); color: #6b7280; flex-shrink: 0;
}
.file-hint { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.send-btn {
  position: relative;
  border: 0; border-radius: 50%; width: 40px; height: 40px; padding: 0;
  background: #d1d5db; color: #fff; font-size: 16px; font-weight: 700;
  cursor: pointer; flex-shrink: 0; box-shadow: none;
  transition: transform .14s cubic-bezier(.2,.8,.3,1), background .16s, box-shadow .16s;
}
.send-btn.ready {
  background: var(--brand);
  box-shadow: 0 4px 14px rgba(47,107,255,.38);
  cursor: pointer;
}
.send-btn.ready:hover { filter: brightness(1.08); }
.send-btn.pressed { transform: scale(0.78); }
.send-btn.sending {
  background: var(--brand);
  box-shadow: 0 4px 14px rgba(47,107,255,.38);
  pointer-events: none;
  transform: scale(0.9);
}
.send-btn.sending::after {
  content: "";
  position: absolute;
  inset: 9px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: send-spin .65s linear infinite;
}
@keyframes send-spin { to { transform: rotate(360deg); } }

.model-row-below {
  margin-top: 10px; padding: 8px 12px;
  background: #fff; border-radius: 10px; border: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.model-label { font-size: 13px; color: #555; white-space: nowrap; font-weight: 500; }
.model-select {
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px;
  font: inherit; background: #fafcff;
}
.model-hint { font-size: 12px; flex: 1; min-width: 120px; }

.skill-pills {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(32px, auto));
  grid-auto-flow: row;
  gap: 8px;
  margin: 10px auto 0;
  width: calc(100% - 16%);
  max-width: 1180px;
  flex-shrink: 0;
  align-content: end;
}
.skill-pill {
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 8px;
  font-size: 11px; background: rgba(255,255,255,.95); color: #374151; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  min-width: 0; width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.skill-pill .dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #5b8cff, #a78bfa);
}
.skill-pill:hover { border-color: #c7d2fe; color: var(--brand); }
.composer-disclaimer {
  text-align: center; font-size: 11px; color: #a0aec0; margin: 8px 0 10px; flex-shrink: 0;
}

.btn {
  border: 0; border-radius: 8px; padding: 8px 14px; cursor: pointer; font-size: 13px;
  background: var(--brand); color: #fff;
}
.btn.ghost { background: #eef2f7; color: var(--text); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: #fff; border-radius: 12px; padding: 14px; border: 1px solid var(--line); }
.stat b { display: block; font-size: 22px; margin-top: 6px; }
.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13px; }
.muted { color: var(--muted); font-size: 12px; }
.promo-banner {
  margin: 0 20px 12px; border-radius: 12px;
  background: linear-gradient(90deg, #2f6bff, #5b8cff);
  color: #fff; padding: 16px 22px;
  box-shadow: 0 6px 18px rgba(47,107,255,.18);
}
.promo-banner h3 { margin: 0 0 4px; font-size: 18px; font-weight: 700; }
.promo-banner p { margin: 0; font-size: 13px; opacity: 0.92; }

@media (max-width: 1100px) {
  .featured-scenes { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 960px) {
  .sidebar { display: none; }
  .featured-scenes { grid-template-columns: 1fr; }
  .skills-header { flex-direction: column; }
  .search { width: 100%; }
  .chat-welcome { flex-direction: column; text-align: center; }
  .chat-welcome h2 { font-size: 22px; }
  .composer-wrap { width: calc(100% - 24px); }
  .skill-pills { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .stats { grid-template-columns: 1fr 1fr; }
}
