:root {
  --ink: #13233f;
  --muted: #66738a;
  --line: #e2e8f0;
  --soft: #f4f7fb;
  --paper: #ffffff;
  --navy: #0a3472;
  --navy-deep: #062655;
  --navy-soft: #eaf1fb;
  --yellow: #ffc107;
  --green: #2b9a6f;
  --shadow: 0 18px 55px rgba(10, 52, 114, 0.12);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
[hidden] { display: none !important; }
body { background: var(--soft); }
button, input, textarea, select { font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; }

.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font-size: 17px; }
.brand b { color: var(--navy); }
.brand-mark { width: 31px; height: 31px; border-radius: 10px; background: var(--navy); display: grid; place-items: center; transform: rotate(-5deg); box-shadow: 0 8px 18px rgba(18, 52, 107, .22); }
.brand-mark i, .empty-mark span, .agent-avatar span { display: block; width: 12px; height: 12px; border: 3px solid var(--yellow); border-top-color: transparent; border-radius: 50%; transform: rotate(-30deg); }
.eyebrow { color: var(--navy); font-size: 11px; line-height: 1; font-weight: 800; letter-spacing: .17em; }

.login-page { min-height: 100vh; background: linear-gradient(115deg, #f4f6fb 0 52%, #fff 52%); display: grid; place-items: center; padding: 38px; }
.login-shell { width: min(1120px, 100%); min-height: 680px; background: var(--paper); border: 1px solid rgba(18,52,107,.08); border-radius: 28px; box-shadow: var(--shadow); overflow: hidden; display: grid; grid-template-columns: 1.1fr .9fr; }
.login-brand { background: var(--navy-deep); color: white; padding: 48px 55px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-brand::after { content: ""; position: absolute; width: 460px; height: 460px; border: 1px solid rgba(255,255,255,.1); border-radius: 50%; right: -220px; bottom: -180px; box-shadow: 0 0 0 70px rgba(255,255,255,.025), 0 0 0 140px rgba(255,255,255,.018); }
.login-brand .brand { color: white; position: relative; z-index: 1; }
.login-brand .brand b { color: var(--yellow); }
.login-brand .brand-mark { background: white; }
.login-brand h1 { margin: 20px 0 22px; font-size: clamp(42px, 5vw, 68px); line-height: 1.08; letter-spacing: -.055em; max-width: 600px; }
.login-brand > div > p:last-child { color: #c9d5e9; font-size: 17px; line-height: 1.8; max-width: 500px; }
.login-brand .eyebrow { color: var(--yellow); }
.trust-line { display: flex; gap: 25px; color: #b9c7dc; font-size: 12px; position: relative; z-index: 1; }
.trust-line span { display: flex; align-items: center; gap: 7px; }
.trust-line span::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--yellow); }
.login-card { padding: 80px 65px; display: flex; flex-direction: column; justify-content: center; }
.login-card h2 { margin: 12px 0 10px; font-size: 32px; letter-spacing: -.03em; }
.login-card > div > p:last-child, .privacy-note { color: var(--muted); line-height: 1.65; }
.login-card form { display: grid; gap: 19px; margin: 38px 0 25px; }
.login-card label { display: grid; gap: 9px; font-size: 13px; font-weight: 700; }
.login-card input { width: 100%; border: 1px solid var(--line); border-radius: 13px; padding: 15px 16px; color: var(--ink); background: #fbfcfe; outline: none; transition: .2s; }
.login-card input:focus { border-color: var(--navy); box-shadow: 0 0 0 4px rgba(18,52,107,.08); background: white; }
.primary-button { border: 0; border-radius: 13px; padding: 16px; color: white; background: var(--navy); font-weight: 750; margin-top: 5px; box-shadow: 0 9px 22px rgba(18,52,107,.21); }
.primary-button:hover { background: var(--navy-deep); }
.primary-button:disabled { opacity: .62; }
.form-error { color: #a53030; background: #fff3f1; padding: 11px 13px; border-radius: 10px; margin: 0; font-size: 13px; }
.privacy-note { font-size: 12px; border-top: 1px solid var(--line); padding-top: 18px; margin-top: 8px; }

.app-page { height: 100vh; overflow: hidden; background: white; }
.app-shell { display: grid; grid-template-columns: 285px minmax(0, 1fr); height: 100vh; overflow: hidden; }
.sidebar { background: linear-gradient(180deg, #0a3472 0%, #062655 100%); border-right: 0; color: white; display: flex; flex-direction: column; min-height: 0; box-shadow: 8px 0 28px rgba(6,38,85,.08); }
.sidebar-top { padding: 24px 20px 17px; }
.sidebar .brand { color: white; }
.sidebar .brand b { color: var(--yellow); }
.sidebar .brand-mark { background: white; box-shadow: 0 8px 20px rgba(0,0,0,.15); }
.new-chat-button { width: 100%; border: 0; border-radius: 11px; background: var(--yellow); padding: 12px 13px; margin-top: 25px; color: var(--navy-deep); font-weight: 800; text-align: left; box-shadow: 0 9px 22px rgba(0,0,0,.14); transition: .18s; }
.new-chat-button:hover { transform: translateY(-1px); background: #ffd044; }
.new-chat-button span { margin-right: 8px; font-size: 17px; }
.onboarding-button { width: 100%; border: 1px solid rgba(255,255,255,.16); border-radius: 10px; background: rgba(255,255,255,.075); padding: 10px 12px; margin-top: 9px; color: white; font-size: 11px; font-weight: 750; text-align: left; display: flex; justify-content: space-between; transition: .18s; }
.onboarding-button span { color: #a9bddc; font-size: 9px; font-weight: 600; }
.onboarding-button:hover { background: rgba(255,255,255,.13); border-color: rgba(255,193,7,.5); }
.history-panel { flex: 1; overflow: auto; padding: 9px 13px; }
.section-label { padding: 0 8px 8px; color: #9fb4d5; font-size: 11px; font-weight: 750; letter-spacing: .09em; }
.conversation-list { display: grid; gap: 3px; }
.conversation-list button { border: 0; background: transparent; border-radius: 9px; padding: 10px; text-align: left; color: #d7e1f1; display: grid; gap: 4px; }
.conversation-list button:hover, .conversation-list button.active { background: rgba(255,255,255,.11); color: white; box-shadow: 0 3px 12px rgba(0,0,0,.06); }
.conversation-list span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conversation-list small, .history-empty { color: #91a7ca; font-size: 10px; }
.history-empty { padding: 12px 9px; }
.sidebar-footer { padding: 15px 18px 18px; border-top: 1px solid rgba(255,255,255,.12); display: grid; gap: 3px; }
.sidebar-footer > a { color: #c1cee2; text-decoration: none; font-size: 12px; padding: 8px 3px; display: flex; justify-content: space-between; }
.sidebar-footer > a:hover { color: var(--yellow); }
.user-row { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; border-top: 1px solid rgba(255,255,255,.12); margin-top: 7px; padding-top: 15px; }
.user-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--yellow); color: var(--navy-deep); display: grid; place-items: center; font-size: 12px; font-weight: 800; }
.user-row div { display: grid; gap: 2px; min-width: 0; }
.user-row b { font-size: 12px; }
.user-row small { font-size: 9px; color: #9fb4d5; }
.user-row button { border: 0; color: #aebed6; background: transparent; font-size: 10px; padding: 5px; }
.user-row button:hover { color: var(--yellow); }
.chat-main { min-width: 0; min-height: 0; height: 100vh; overflow: hidden; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: white; }
.chat-header { height: 72px; border-bottom: 1px solid var(--line); padding: 0 28px; display: flex; align-items: center; justify-content: space-between; }
.chat-header > div:first-of-type > p { margin: 0 0 5px; font-weight: 750; font-size: 14px; }
#system-status { color: var(--green); font-size: 10px; display: flex; align-items: center; gap: 6px; }
#system-status i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px rgba(43,154,111,.1); }
#system-status.warning { color: #a06b14; }
.mode-control { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 11px; }
.mode-control select { border: 1px solid var(--line); border-radius: 8px; padding: 7px 25px 7px 9px; background: #fafbfc; color: var(--ink); }
.header-guide { color: #7d889b; font-size: 10px; margin: 0; }
.sidebar-toggle { display: none; border: 0; background: transparent; font-size: 19px; }
.chat-stream { overflow-y: auto; padding: 25px max(28px, calc((100% - 850px) / 2)); scroll-behavior: smooth; background: radial-gradient(circle at 52% 18%, rgba(10,52,114,.055), transparent 31%), linear-gradient(180deg, #fff 0%, #fbfcff 100%); }
.empty-chat { min-height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 28px 0 42px; }
.empty-mark { width: 55px; height: 55px; background: var(--navy); border-radius: 19px; transform: rotate(-6deg); display: grid; place-items: center; box-shadow: 0 16px 30px rgba(10,52,114,.22); margin-bottom: 20px; }
.empty-mark span { width: 20px; height: 20px; border-width: 4px; }
.empty-chat h1 { font-size: clamp(35px, 4vw, 52px); line-height: 1.1; letter-spacing: -.055em; margin: 10px 0 14px; }
.empty-chat h1 em { color: var(--navy); font-style: normal; position: relative; }
.empty-chat h1 em::after { content: ""; position: absolute; left: 2px; right: 2px; bottom: -5px; height: 5px; border-radius: 4px; background: var(--yellow); opacity: .9; }
.empty-chat > p:not(.eyebrow) { color: var(--muted); max-width: 610px; line-height: 1.75; margin: 0; }
.intent-grid { display: grid; grid-template-columns: 1.18fr 1fr 1fr; width: min(850px, 100%); gap: 11px; margin-top: 29px; }
.intent-grid button { min-height: 119px; border: 1px solid #dce4ef; background: rgba(255,255,255,.94); border-radius: 14px; color: #34445e; text-align: left; padding: 16px 17px; transition: .18s; display: flex; flex-direction: column; align-items: flex-start; box-shadow: 0 5px 16px rgba(10,52,114,.035); }
.intent-grid button:hover { border-color: #aebdd2; box-shadow: 0 10px 25px rgba(10,52,114,.09); transform: translateY(-2px); }
.intent-grid button.primary-intent { background: var(--navy); border-color: var(--navy); color: white; box-shadow: 0 12px 28px rgba(10,52,114,.2); }
.intent-grid button.primary-intent:hover { border-color: var(--navy-deep); background: var(--navy-deep); }
.intent-grid span { color: var(--navy); font-size: 9px; font-weight: 800; letter-spacing: .08em; margin-bottom: 10px; }
.intent-grid .primary-intent span { color: var(--yellow); }
.intent-grid b { font-size: 14px; line-height: 1.35; }
.intent-grid small { color: #7b879a; font-size: 10px; line-height: 1.55; margin-top: 8px; }
.intent-grid .primary-intent small { color: #c5d2e5; }
.question-example { color: #8b95a6 !important; font-size: 10px; margin-top: 17px !important; }
.question-example b { color: var(--navy); }
.message { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 13px; margin: 0 auto 28px; max-width: 850px; }
.message-avatar { width: 32px; height: 32px; border-radius: 10px; background: #e7ebf2; color: #576176; display: grid; place-items: center; font-size: 11px; font-weight: 750; }
.agent-avatar { background: var(--navy); transform: rotate(-4deg); }
.agent-avatar span { width: 12px; height: 12px; }
.message-body { min-width: 0; }
.message-label { font-size: 11px; font-weight: 750; color: var(--navy); margin: 1px 0 8px; }
.message-content { color: #2e374b; font-size: 14px; line-height: 1.85; white-space: pre-wrap; overflow-wrap: anywhere; }
.user .message-content { background: #f4f6fa; border-radius: 2px 14px 14px 14px; padding: 12px 15px; display: inline-block; white-space: pre-wrap; }
.answer-content { white-space: normal; }
.answer-content > :first-child { margin-top: 0; }
.answer-content p { margin: 0 0 12px; }
.answer-content h3, .answer-content h4 { margin: 18px 0 7px; color: var(--ink); }
.answer-content h3 { font-size: 16px; }
.answer-content h4 { font-size: 14px; }
.answer-content a { color: var(--navy); text-underline-offset: 3px; }
.answer-content a span { font-size: 9px; margin-left: 3px; }
.answer-content code { padding: 2px 5px; border-radius: 5px; background: #f1f4f8; color: #304669; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }
.answer-content blockquote { margin: 8px 0 14px; padding: 10px 13px; border-left: 3px solid var(--yellow); border-radius: 0 8px 8px 0; background: #f7f9fc; color: #34445e; }
.answer-content hr { margin: 18px 0; border: 0; border-top: 1px solid #e8edf3; }
.bullet, .numbered { display: grid; grid-template-columns: 12px 1fr; gap: 7px; align-items: start; }
.answer-content .bullet, .answer-content .numbered { margin: 5px 0; }
.bullet i { width: 4px; height: 4px; background: var(--yellow); border-radius: 50%; margin-top: 11px; }
.answer-meta { border-top: 1px solid #eef0f4; margin-top: 18px; padding-top: 9px; display: flex; justify-content: space-between; align-items: center; color: #9299a8; font-size: 9px; }
.answer-meta > span { display: flex; align-items: center; gap: 5px; }
.answer-meta > span i { width: 5px; height: 5px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(43,154,111,.1); }
.answer-meta button { border: 0; background: transparent; color: #7f8798; font-size: 10px; margin-left: 9px; padding: 2px; }
.answer-meta button:hover { color: var(--navy); }
.answer-meta button:disabled { color: var(--green); cursor: default; }
.thinking { display: flex; align-items: center; gap: 4px; color: #8b93a3; font-size: 12px; padding-top: 4px; }
.thinking i { width: 5px; height: 5px; border-radius: 50%; background: #8b93a3; animation: pulse 1s infinite alternate; }
.thinking i:nth-child(2) { animation-delay: .18s; }.thinking i:nth-child(3) { animation-delay: .36s; margin-right: 5px; }
@keyframes pulse { to { opacity: .2; transform: translateY(-2px); } }
.chat-error { max-width: 850px; margin: 0 auto 22px 47px; background: #fff4f1; color: #a23e31; border: 1px solid #f1d6d1; border-radius: 10px; padding: 11px 13px; font-size: 12px; }
.composer-wrap { padding: 15px max(28px, calc((100% - 850px) / 2)) 20px; background: linear-gradient(to bottom, rgba(255,255,255,.65), white 20%); }
.composer { border: 1px solid #d8e0eb; border-radius: 16px; padding: 13px 13px 9px 16px; box-shadow: 0 10px 30px rgba(10,52,114,.09); background: white; transition: .18s; }
.composer:focus-within { border-color: #a7b9d1; box-shadow: 0 12px 34px rgba(10,52,114,.13), 0 0 0 3px rgba(255,193,7,.12); }
.composer textarea { width: 100%; min-height: 27px; max-height: 180px; resize: none; border: 0; outline: 0; color: var(--ink); line-height: 1.6; padding: 0; }
.composer textarea::placeholder { color: #a0a7b5; }
.composer-toolbar { display: flex; justify-content: space-between; align-items: center; margin-top: 7px; }
.advanced-options { color: #8b93a2; font-size: 10px; position: relative; }
.advanced-options summary { cursor: pointer; list-style: none; padding: 6px 8px; border-radius: 7px; background: #f4f6f9; user-select: none; }
.advanced-options summary::-webkit-details-marker { display: none; }
.advanced-options summary::after { content: "＋"; margin-left: 5px; color: #98a2b2; }
.advanced-options[open] summary::after { content: "−"; }
.advanced-options > div { position: absolute; left: 0; bottom: 35px; z-index: 5; width: 275px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: white; box-shadow: 0 12px 30px rgba(10,52,114,.13); display: grid; gap: 10px; }
.advanced-options label { display: grid; gap: 5px; color: #707c90; }
.advanced-options select { width: 100%; border: 1px solid var(--line); background: #f8fafc; color: #435069; border-radius: 7px; padding: 7px 8px; font-size: 10px; }
.send-button { width: 34px; height: 34px; border: 0; border-radius: 10px; background: var(--yellow); color: var(--navy-deep); font-size: 19px; font-weight: 850; box-shadow: 0 7px 16px rgba(255,193,7,.25); }
.send-button:hover { background: #ffd044; transform: translateY(-1px); }
.send-button:disabled { opacity: .45; }
.composer-wrap > p { color: #9aa1af; text-align: center; font-size: 9px; margin: 9px 0 0; }

@media (max-width: 800px) {
  .login-page { padding: 0; background: white; }
  .login-shell { min-height: 100vh; border: 0; border-radius: 0; grid-template-columns: 1fr; }
  .login-brand { min-height: 360px; padding: 35px 28px; }
  .login-brand h1 { font-size: 42px; }
  .trust-line { display: none; }
  .login-card { padding: 45px 28px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 10; width: 285px; height: 100vh; transform: translateX(-101%); transition: .2s; box-shadow: 18px 0 45px rgba(23,32,56,.16); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: block; }
  .chat-header { padding: 0 16px; justify-content: flex-start; gap: 12px; }
  .header-actions { margin-left: auto; }
  .mode-control > span { display: none; }
  .header-guide { display: none; }
  .chat-stream { padding: 23px 16px; }
  .composer-wrap { padding: 12px 14px 14px; }
  .intent-grid { grid-template-columns: 1fr; }
  .intent-grid button { min-height: 100px; }
  .empty-chat { justify-content: flex-start; padding-top: 45px; }
  .empty-chat h1 { font-size: 38px; }
}
