/* Tokens from the design canvas. */
:root {
  --rail: #24122F; --rail-on: #4A2A63; --rail-ink: #E3D9EC; --side-dark: #3A2350;
  --accent: #5B2FA6; --accent-dark: #3F1F78; --tint: #F4EEF8; --ground: #F8F6F9; --chip: #F1EEF3;
  --ink: #1C1D1F; --ink2: #4A4E54; --muted: #5B6066; --line: #E0DBE4; --line2: #EFECF1; --line3: #BDB7C2;
  --ok: #1E7B4B; --warn: #9A5B00; --bad: #B3261E; --warn-bg: #FFF4DC; --warn-line: #E5C77A; --warn-ink: #5C3D00;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--ground); color: var(--ink); font: 14px/1.5 Inter, -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif; -webkit-text-size-adjust: 100%; }
#app { height: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
a { color: var(--accent); }
code { background: var(--chip); border-radius: 4px; padding: 1px 5px; font-size: 12px; word-break: break-all; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn { height: 44px; padding: 0 18px; border: 1px solid var(--line3); border-radius: 9px; background: #fff; cursor: pointer; white-space: nowrap; }
.btn.primary { border: 0; background: var(--accent); color: #fff; font-weight: 600; }
.btn.dark { border: 0; background: var(--rail); color: #fff; font-weight: 600; }
.btn.small { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.danger { color: var(--bad); }
.btn:disabled { background: #E6E3E8; color: var(--ink2); border: 0; cursor: default; }
.input, .select, .textarea { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 0 12px; background: #fff; }
.input, .select { height: 44px; }
.textarea { padding: 10px 12px; resize: vertical; min-height: 120px; line-height: 1.6; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); min-width: 0; }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 12px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.grow { flex: 1 1 240px; min-width: 0; }
.err { color: var(--bad); font-size: 13px; white-space: pre-wrap; word-break: break-word; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; }
.chip { background: var(--chip); border-radius: 6px; padding: 2px 8px; }
.tag { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; white-space: nowrap; }
.avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; }
.avatar.s { width: 28px; height: 28px; font-size: 13px; }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--rail-ink); color: var(--rail); font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.badge.on { background: var(--accent); color: #fff; }
.pre { white-space: pre-wrap; word-break: break-word; }

/* shell */
.shell { display: flex; height: 100%; }
.rail { width: 76px; flex: none; background: var(--rail); display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 0; }
.logo { width: 36px; height: 36px; border-radius: 10px; background: #fff; color: var(--rail); display: flex; align-items: center; justify-content: center; font-weight: 700; margin-bottom: 12px; }
.rail button { position: relative; width: 60px; height: 56px; border: 0; border-radius: 10px; background: transparent; color: var(--rail-ink); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; cursor: pointer; }
.rail button[aria-current] { background: var(--rail-on); color: #fff; font-weight: 600; }
.rail .badge { position: absolute; top: 4px; right: 6px; }
.rail .net { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 10px; color: var(--rail-ink); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #8A8F98; }
.dot.online { background: #3DDC97; }
.dot.connecting { background: #F2C14E; }
.side { width: 304px; flex: none; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.side.dark { width: 260px; background: var(--side-dark); color: #fff; border: 0; padding: 16px 12px; gap: 4px; }
.side.dark h1 { font-size: 17px; padding: 4px 8px 12px; }
.side.dark button { text-align: left; height: 44px; border: 0; border-radius: 8px; background: transparent; color: var(--rail-ink); padding: 0 12px; cursor: pointer; }
.side.dark button[aria-pressed="true"] { background: #fff; color: var(--rail); font-weight: 600; }
.side.dark .side-note { margin-top: auto; padding: 8px; font-size: 12px; color: var(--rail-ink); }
.side-head { padding: 16px 16px 12px; display: flex; flex-direction: column; gap: 12px; }
.side-head h1 { font-size: 17px; font-weight: 600; }
.side-list { flex: 1; overflow-y: auto; }
.group-label { font-size: 12px; color: var(--muted); padding: 12px 16px 4px; }
.item { width: 100%; text-align: left; border: 0; background: transparent; padding: 10px 16px; display: flex; align-items: center; gap: 10px; cursor: pointer; border-bottom: 1px solid var(--line2); }
.item[aria-current] { background: var(--tint); }
.item .who { flex: 1; min-width: 0; }
.item .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot { padding: 12px 16px; border-top: 1px solid var(--line2); font-size: 12px; color: var(--muted); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.banner { background: var(--warn-bg); border-bottom: 1px solid var(--warn-line); color: var(--warn-ink); padding: 10px 24px; font-size: 13px; }
.head { padding: 14px 24px; background: #fff; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.head h1 { font-size: 17px; font-weight: 600; }
.head .end { margin-left: auto; display: flex; gap: 8px; }
.back { display: none; }
.body { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.foot { padding: 14px 24px; background: #fff; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.panel { background: #fff; border: 1px solid #E6E3E8; border-radius: 12px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.panel.hot { border: 2px solid var(--accent); }
.panel h2 { font-size: 16px; font-weight: 600; }
.empty { margin: auto; max-width: 420px; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 12px; align-items: center; }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: var(--rail); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13px; z-index: 10; max-width: 90vw; }

/* chat */
.bubble { max-width: min(520px, 85%); border-radius: 12px; padding: 10px 14px; background: #fff; border: 1px solid #E6E3E8; align-self: flex-start; white-space: pre-wrap; word-break: break-word; }
.bubble.me { align-self: flex-end; background: var(--accent); border-color: var(--accent); color: #fff; }
.bubble .meta { font-size: 12px; margin-top: 4px; opacity: .75; }
.sys { align-self: center; font-size: 12px; color: var(--muted); text-align: center; }

/* plaza */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.pcard { background: #fff; border: 1px solid #E6E3E8; border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.pcard .intro { font-size: 13px; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.pcard .act { border-top: 1px solid var(--line2); padding-top: 10px; margin-top: auto; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }

/* report */
.score { flex: none; width: 96px; height: 96px; border-radius: 16px; background: var(--tint); color: var(--accent-dark); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.score b { font-size: 34px; line-height: 1; }
.score span { font-size: 12px; }
.report h3 { font-size: 13px; color: var(--muted); font-weight: 600; margin-top: 4px; }
.report ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }

/* add friend: QR + "agents meet first" animation */
.add { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 28px; }
.add .mine { flex: 1 1 260px; max-width: 320px; display: flex; flex-direction: column; gap: 14px; }
.qr { width: 100%; aspect-ratio: 1; border: 1px solid #E6E3E8; border-radius: 16px; background: #fff; padding: 14px; }
.qr svg { width: 100%; height: 100%; display: block; }
.add .how { flex: 2 1 380px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.stage { position: relative; width: 100%; max-width: 560px; height: 400px; border-radius: 16px; background: var(--tint); overflow: hidden; }
.stage > * { position: absolute; animation: 13s infinite both; }
.stage .lab { top: 16px; background: #fff; border-radius: 16px; padding: 4px 10px; font-size: 12px; font-weight: 600; animation-name: s-agents; }
.stage .lab.l { left: 16px; } .stage .lab.r { right: 16px; }
.stage .say { max-width: 62%; border-radius: 12px; padding: 8px 12px; font-size: 13px; background: #fff; }
.stage .say.me { background: var(--accent); color: #fff; left: 16px; }
.stage .s1 { top: 52px; animation-name: s-1; }
.stage .s2 { top: 100px; right: 16px; animation-name: s-2; }
.stage .s3 { top: 148px; animation-name: s-3; }
.stage .phone { top: 200px; width: 96px; height: 168px; border-radius: 16px; background: var(--rail); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; font-size: 12px; }
.stage .phone i { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-style: normal; background: var(--accent); }
.stage .pa { left: calc(50% - 104px); animation-name: s-pa; }
.stage .pb { left: calc(50% + 8px); animation-name: s-pb; }
.stage .pb i { background: #1F8A63; }
.stage .ring { left: calc(50% - 46px); top: 238px; width: 92px; height: 92px; border-radius: 50%; border: 3px solid var(--accent); animation-name: s-ring; }
.stage .result { left: 50%; top: 190px; width: 300px; max-width: 86%; background: #fff; border: 2px solid var(--accent); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; animation-name: s-res; }
.stage .result b { font-size: 20px; }
.stage .cap { left: 16px; bottom: 12px; font-weight: 600; }
.stage .c1 { animation-name: s-c1; } .stage .c2 { animation-name: s-c2; } .stage .c3 { animation-name: s-c3; } .stage .c4 { animation-name: s-c4; }
@keyframes s-pa { 0%, 12% { transform: translateX(-48px) rotate(-5deg); } 18%, 100% { transform: translateX(0) rotate(-5deg); } }
@keyframes s-pb { 0%, 12% { transform: translateX(48px) rotate(5deg); } 18%, 100% { transform: translateX(0) rotate(5deg); } }
@keyframes s-ring { 0%, 17%, 34%, 100% { opacity: 0; } 20%, 30% { opacity: 1; } }
@keyframes s-agents { 0%, 32% { opacity: 0; } 36%, 96% { opacity: 1; } 100% { opacity: 0; } }
@keyframes s-1 { 0%, 34% { opacity: 0; } 38%, 96% { opacity: 1; } 100% { opacity: 0; } }
@keyframes s-2 { 0%, 42% { opacity: 0; } 46%, 96% { opacity: 1; } 100% { opacity: 0; } }
@keyframes s-3 { 0%, 52% { opacity: 0; } 56%, 96% { opacity: 1; } 100% { opacity: 0; } }
@keyframes s-res { 0%, 66% { opacity: 0; transform: translate(-50%, 24px); } 70%, 96% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, 0); } }
@keyframes s-c1 { 0%, 16% { opacity: 1; } 18%, 100% { opacity: 0; } }
@keyframes s-c2 { 0%, 17% { opacity: 0; } 19%, 32% { opacity: 1; } 34%, 100% { opacity: 0; } }
@keyframes s-c3 { 0%, 33% { opacity: 0; } 35%, 64% { opacity: 1; } 66%, 100% { opacity: 0; } }
@keyframes s-c4 { 0%, 65% { opacity: 0; } 67%, 96% { opacity: 1; } 100% { opacity: 0; } }
.thinking { display: flex; align-items: center; gap: 10px; color: var(--accent-dark); font-weight: 600; }
.thinking i { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: pulse 1s infinite alternate; }
.thinking i:nth-child(2) { animation-delay: .3s; background: #1F8A63; }
@keyframes pulse { from { transform: scale(.6); opacity: .5; } to { transform: scale(1.2); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .stage > *, .thinking i { animation: none; } .stage .ring, .stage .c1, .stage .c2, .stage .c3 { display: none; } }

/* projects table */
.table { background: #fff; border: 1px solid #E6E3E8; border-radius: 12px; overflow: hidden; }
.tr { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line2); }
.tr:last-child { border-bottom: 0; }
.tr .sum { flex-basis: 100%; font-size: 13px; color: var(--ink2); }

/* welcome */
.welcome { display: flex; flex-wrap: wrap; min-height: 100%; }
.welcome .pitch { flex: 1 1 380px; background: var(--rail); color: #fff; padding: 56px 48px; display: flex; flex-direction: column; gap: 20px; }
.welcome .brand { display: flex; align-items: center; gap: 12px; font-size: 18px; font-weight: 600; }
.welcome .brand i { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); }
.welcome h1 { margin-top: 40px; font-size: 34px; line-height: 1.25; font-weight: 600; }
.welcome .pitch p { font-size: 16px; color: #C9CCD2; max-width: 420px; }
.welcome .pitch ul { margin: 16px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; color: #E6E3E8; }
.welcome .pitch .slogan { margin-top: auto; font-size: 13px; color: #C9CCD2; }
.welcome .start { flex: 1 1 480px; padding: 56px 48px; display: flex; flex-direction: column; justify-content: center; gap: 20px; }

/* phones */
@media (max-width: 760px) {
  .shell { flex-direction: column-reverse; }
  .rail { width: 100%; flex-direction: row; justify-content: space-around; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); gap: 0; }
  .rail .logo, .rail .net { display: none; }
  .rail button { width: 19%; height: 52px; }
  .side, .side.dark { width: 100%; border-right: 0; }
  .shell.split .side { flex: 1; }
  .shell.split .main, .shell.split.detail .side { display: none; }
  .shell.split.detail .main { display: flex; }
  .shell.stack .side { flex: none; }
  .back { display: inline-flex; }
  .head { padding: 10px 14px; }
  .body { padding: 14px; }
  .foot { padding: 10px 14px; }
  .welcome .pitch, .welcome .start { padding: 32px 24px; }
  .welcome h1 { margin-top: 12px; font-size: 26px; }
  .stage { height: 380px; }
}

/* operator page (/admin) */
[hidden] { display: none !important; }
.admin-top { background: var(--rail); color: #fff; padding: 14px 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.admin-top .logo { margin: 0; width: 32px; height: 32px; border-radius: 9px; }
.admin-top strong { font-size: 16px; }
.admin-top .small { color: var(--rail-ink); }
.admin-top .btn.ghost { margin-left: auto; background: transparent; color: #fff; border-color: var(--rail-ink); }
.admin, .admin-body { max-width: 960px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.admin { padding: 24px; }
.admin-body { width: 100%; }
.admin .panel h3 { font-size: 13px; color: var(--muted); font-weight: 600; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile { background: var(--ground); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; }
.tile b { font-size: 24px; font-weight: 600; }
.tile span { font-size: 12px; color: var(--muted); }
.admin table { border-collapse: collapse; width: 100%; }
.admin th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.admin td { padding: 8px 12px; border-bottom: 1px solid var(--line2); font-size: 13px; }
.ok-text { color: var(--ok); font-size: 13px; }
.warn-text { color: var(--warn); font-size: 13px; word-break: break-word; }

/* home page (/) */
body.land { background: #fff; font-size: 16px; }
.land-wrap { max-width: 1200px; margin: 0 auto; padding: 0 32px; }
.land-top { max-width: 1200px; margin: 0 auto; padding: 18px 32px; display: flex; flex-wrap: wrap; align-items: center; gap: 28px; }
.land-brand { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 800; color: var(--ink); text-decoration: none; }
.land-brand img { border-radius: 9px; }
.land-top nav { display: flex; flex-wrap: wrap; gap: 24px; font-size: 15px; font-weight: 600; }
.land-top nav a { color: var(--ink); text-decoration: none; min-height: 28px; display: inline-flex; align-items: center; }
.land-cta { margin-left: auto; display: flex; flex-wrap: wrap; gap: 12px; }
.land a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; font-weight: 700; font-size: 14px; color: var(--accent); border-color: var(--accent); }
.land a.btn.primary { color: #fff; }
.land a.btn.big { height: 52px; padding: 0 26px; border-radius: 10px; font-size: 16px; }
.land-hero { background: var(--tint); }
.land-hero .land-wrap { padding-top: 72px; padding-bottom: 72px; display: flex; flex-wrap: wrap; align-items: center; gap: 56px; }
.land-pitch { flex: 1 1 440px; min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.land-pitch h1 { font-size: 54px; line-height: 1.15; font-weight: 800; letter-spacing: -.5px; }
.land-pitch p { font-size: 19px; color: #454147; max-width: 520px; }
.land-buttons { display: flex; flex-wrap: wrap; gap: 14px; }
.land-note { font-size: 14px; color: #5E5A61; }
.land-demo { flex: 1 1 440px; min-width: 0; display: flex; justify-content: center; }
.stage.white { background: #fff; border: 1px solid #E0D6E8; border-radius: 20px; height: 430px; }
.stage.white .lab, .stage.white .say:not(.me) { background: var(--tint); }
.land-how { padding-top: 64px; padding-bottom: 64px; display: flex; flex-direction: column; gap: 32px; }
.land-how h2 { font-size: 34px; font-weight: 800; }
.land-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; }
.land-steps > div { background: var(--ground); border-radius: 16px; padding: 28px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.land-steps span { font-size: 14px; font-weight: 700; color: var(--accent); }
.land-steps h3 { font-size: 20px; font-weight: 700; }
.land-steps p { color: #454147; }
.land-get { background: var(--tint); }
.land-get .land-steps > div { background: #fff; }
.land-slogan { font-size: 15px; font-weight: 700; }
@media (max-width: 760px) {
  .land-wrap, .land-top { padding-left: 20px; padding-right: 20px; }
  .land-top { gap: 12px; }
  .land-top nav { display: none; }
  .land-hero .land-wrap { padding-top: 40px; padding-bottom: 40px; gap: 32px; }
  .land-pitch h1 { font-size: 34px; }
  .land-pitch p { font-size: 17px; }
  .land-how { padding-top: 40px; padding-bottom: 40px; }
  .land-how h2 { font-size: 26px; }
}
