/* ============================================================
   路灯集控 AI 助手 · 视觉规范
   基调：深海军蓝 + 冷灰 + 钢蓝，细边框、小圆角、少装饰
   ============================================================ */
:root {
  --navy: #0d1b2a;
  --navy-2: #13273b;
  --navy-3: #1b3550;
  --steel: #2c5f86;
  --steel-2: #1f4a6b;
  --steel-soft: #e9f1f7;
  --ink: #152435;
  --slate: #405468;
  --muted: #708294;
  --line: #d9e0e7;
  --line-soft: #e8edf2;
  --bg: #eef2f6;
  --paper: #ffffff;
  --panel: #f7f9fb;
  --amber: #a86412;
  --amber-soft: #fbf3e3;
  --green: #1c7a4d;
  --red: #a52a1f;
  --radius: 10px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; overflow-x: clip; }

body {
  margin: 0;
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
::selection { background: rgba(44, 95, 134, .2); }

:focus-visible {
  outline: 2px solid var(--steel);
  outline-offset: 2px;
}

/* ============ 通用品牌件 ============ */
.brand-mark {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .07);
  color: #dce9f3;
}
.brand-mark svg { width: 23px; height: 23px; }

.eyebrow {
  margin: 0;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #7f97ad;
}

/* ============================================================
   登录页
   ============================================================ */
.login-body { min-height: 100dvh; background: var(--bg); }

.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
  min-height: 100dvh;
}

.login-intro {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 52px 64px 36px;
  color: #eaf1f7;
  background: linear-gradient(155deg, #0a1725 0%, #0f2437 52%, #143149 100%);
}
.login-intro::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 84%);
  mask-image: linear-gradient(to bottom, #000 0%, transparent 84%);
  pointer-events: none;
}
.login-intro::after {
  content: "";
  position: absolute;
  width: 560px;
  height: 560px;
  right: -200px;
  bottom: -250px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(52, 122, 174, .32), transparent 65%);
  pointer-events: none;
}

.intro-brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-text strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .03em;
}
.brand-text small {
  display: block;
  margin-top: 3px;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #829bb0;
}

.intro-copy {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: auto 0;
  padding: 40px 0;
}
.intro-copy .eyebrow { color: #7f9db6; }
.intro-copy h1 {
  margin: 14px 0 20px;
  font-size: clamp(34px, 3.4vw, 46px);
  line-height: 1.28;
  font-weight: 600;
  letter-spacing: -.015em;
}
.intro-desc {
  max-width: 440px;
  margin: 0;
  font-size: 13.5px;
  line-height: 1.9;
  color: #a9bccd;
}
.intro-points {
  display: grid;
  gap: 12px;
  margin: 30px 0 0;
  padding: 0;
  list-style: none;
}
.intro-points li {
  position: relative;
  padding-left: 16px;
  font-size: 12.5px;
  color: #c3d3e0;
}
.intro-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 5px;
  height: 5px;
  background: #5d90b8;
  border-radius: 1px;
}
.intro-foot {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: 11px;
  letter-spacing: .05em;
  color: #6f8aa3;
}

.login-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 40px 36px;
  background:
    radial-gradient(700px 420px at 100% 0%, #e7edf3 0%, rgba(231, 237, 243, 0) 60%),
    #f4f6f8;
}

.login-card {
  width: min(404px, 100%);
  padding: 34px 32px 24px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--steel);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 60px -40px rgba(13, 27, 42, .45);
  animation: card-in .4s ease both;
}
.login-card-head .eyebrow { color: var(--steel); }
.login-card-head h2 {
  margin: 8px 0 6px;
  font-size: 25px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -.01em;
}
.login-sub {
  margin: 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--muted);
}

.field { display: block; margin-top: 18px; }
.field span {
  display: block;
  margin-bottom: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--slate);
}
.field input {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  font-size: 14.5px;
  outline: none;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
.field input::placeholder { color: #a4b0bb; }
.field input:focus {
  border-color: var(--steel);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(44, 95, 134, .12);
}

.btn-primary {
  position: relative;
  width: 100%;
  height: 46px;
  margin-top: 22px;
  border: 1px solid var(--navy-2);
  border-radius: 6px;
  background: var(--navy-2);
  color: #f2f7fb;
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: .04em;
  transition: background .16s, transform .12s;
}
.btn-primary:hover { background: var(--navy); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: .72; cursor: default; }
.btn-label { transition: opacity .15s; }
.btn-primary.loading .btn-label { opacity: 0; }
.spinner {
  display: none;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 17px;
  height: 17px;
  margin: -8.5px 0 0 -8.5px;
  border: 2px solid rgba(255, 255, 255, .3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.btn-primary.loading .spinner { display: block; }

.form-error {
  min-height: 19px;
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--red);
}

.login-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 22px 0 0;
  padding-top: 17px;
  border-top: 1px solid var(--line-soft);
  font-size: 11px;
  color: #8a99a7;
}
.login-foot svg { width: 13px; height: 13px; }

.login-copyright {
  margin: 22px 0 0;
  font-size: 10.5px;
  letter-spacing: .03em;
  color: #8e9caa;
  text-align: center;
}

/* ============================================================
   聊天工作台
   ============================================================ */
.app-body {
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: hidden;
  background: var(--bg);
}

.app-shell {
  width: min(1180px, 100%);
  height: min(880px, calc(100dvh - 40px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 24px 60px -45px rgba(13, 27, 42, .55);
}

.app-header {
  flex: none;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 22px;
  color: #eef5fa;
  background: var(--navy);
}
.app-header .brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}
.app-header .brand-text h1 {
  margin: 0;
  overflow: hidden;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: .03em;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.app-header .brand-text p {
  margin: 3px 0 0;
  font-size: 10.5px;
  letter-spacing: .06em;
  color: #8fa7ba;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: none;
}
.service-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: 5px;
  font-size: 11px;
  color: #a9c0d2;
}
.service-status .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3ecf8e;
  box-shadow: 0 0 0 3px rgba(62, 207, 142, .13);
}
.header-btn {
  height: 32px;
  padding: 0 11px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 6px;
  background: transparent;
  color: #d7e3ed;
  font-size: 12px;
  transition: background .15s, border-color .15s;
}
.header-btn:hover { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .26); }
.icon-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #b9cbd9;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.icon-btn svg { width: 17px; height: 17px; }
.panel-toggle { display: none; }

.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 336px;
}

.chat-col {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
}

.banner {
  flex: none;
  padding: 7px 22px;
  border-bottom: 1px solid #ead9b6;
  background: #fdf6e6;
  color: #7d5310;
  font-size: 11.5px;
  line-height: 1.5;
  text-align: center;
}

.messages {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding: 26px 30px 10px;
  background-color: #f6f8fa;
  background-image:
    linear-gradient(rgba(13, 27, 42, .022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(13, 27, 42, .022) 1px, transparent 1px);
  background-size: 28px 28px;
  scroll-behavior: smooth;
}
.messages::-webkit-scrollbar { width: 8px; }
.messages::-webkit-scrollbar-thumb {
  background: #c9d4de;
  border-radius: 8px;
  border: 2px solid #f6f8fa;
}
.messages::-webkit-scrollbar-track { background: transparent; }

/* 欢迎区 */
.welcome {
  margin: auto;
  width: 100%;
  max-width: 640px;
  padding: 18px 6px 30px;
  text-align: left;
  animation: rise .35s ease both;
}
.welcome-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border-radius: 10px;
  background: var(--navy);
  color: #dfeaf3;
  box-shadow: 0 12px 26px -18px rgba(13, 27, 42, .8);
}
.welcome-mark svg { width: 28px; height: 28px; }
.welcome .eyebrow { color: var(--steel); }
.welcome h2 {
  margin: 8px 0 10px;
  font-size: 24px;
  line-height: 1.35;
  font-weight: 600;
  letter-spacing: -.01em;
}
.welcome-desc {
  max-width: 540px;
  margin: 0;
  font-size: 13px;
  line-height: 1.8;
  color: var(--slate);
}
.welcome-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 22px;
}
.welcome-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
  transition: border-color .16s, box-shadow .16s, transform .16s;
}
.welcome-card:hover {
  border-color: #9db8cc;
  box-shadow: 0 6px 16px -12px rgba(13, 27, 42, .45);
  transform: translateY(-1px);
}
.wc-icon { color: var(--steel); }
.wc-icon svg { width: 18px; height: 18px; display: block; }
.welcome-card strong { font-size: 13px; font-weight: 600; color: var(--ink); }
.welcome-card small { font-size: 11px; color: var(--muted); }
.steps {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--muted);
}
.steps b {
  margin-right: 5px;
  color: var(--steel);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10.5px;
  font-weight: 600;
}
.welcome-note {
  margin: 16px 0 0;
  font-size: 11px;
  line-height: 1.6;
  color: var(--amber);
}

/* 消息 */
.msg {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  max-width: 100%;
  animation: rise .2s ease both;
}
.msg.user { justify-content: flex-end; }
.msg .mini-avatar {
  width: 28px;
  height: 28px;
  flex: none;
  display: grid;
  place-items: center;
  margin-top: 2px;
  border-radius: 6px;
  border: 1px solid #d8e2ea;
  background: #eaf1f6;
  color: var(--steel-2);
}
.msg .mini-avatar svg { width: 16px; height: 16px; }

.bubble {
  max-width: min(78%, 680px);
  padding: 11px 15px;
  border: 1px solid var(--line);
  border-radius: 2px 8px 8px 8px;
  background: #fff;
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.75;
  overflow-wrap: anywhere;
  box-shadow: 0 1px 2px rgba(13, 27, 42, .03);
}
.msg.user .bubble {
  border-color: var(--navy-2);
  border-radius: 8px 2px 8px 8px;
  background: var(--navy-2);
  color: #edf4f9;
}
.msg.error .bubble {
  border-color: #eccac5;
  background: #fff6f5;
  color: #8f241a;
}
.bubble p { margin: 0 0 8px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble h3, .bubble h4, .bubble h5, .bubble h6 {
  margin: 10px 0 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.bubble ul, .bubble ol { margin: 6px 0 8px; padding-left: 19px; }
.bubble li { margin: 2px 0; }
.bubble strong { font-weight: 600; }
.bubble code {
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #f3f6f9;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: .92em;
}
.bubble blockquote {
  margin: 8px 0;
  padding: 6px 10px;
  border-left: 3px solid var(--steel);
  background: #f4f7fa;
  color: var(--slate);
}
.bubble .table-wrap {
  margin: 8px 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 4px;
}
.bubble table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  line-height: 1.6;
}
.bubble th, .bubble td {
  padding: 6px 9px;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
}
.bubble th {
  background: #f1f5f8;
  font-weight: 600;
  white-space: nowrap;
}
.bubble tr:last-child td { border-bottom: 0; }
.bubble th:last-child, .bubble td:last-child { border-right: 0; }

.typing .bubble {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px 16px;
}
.typing i {
  width: 5px;
  height: 5px;
  display: block;
  border-radius: 50%;
  background: #8aa0b2;
  animation: blink 1.2s infinite;
}
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }

.composer {
  flex: none;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 13px 22px 7px;
  border-top: 1px solid var(--line);
  background: #fff;
}
.composer textarea {
  flex: 1;
  min-height: 46px;
  max-height: 132px;
  padding: 11px 13px;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  font-size: 13.5px;
  line-height: 1.6;
  outline: none;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
.composer textarea::placeholder { color: #a4b0bb; }
.composer textarea:focus {
  border-color: var(--steel);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(44, 95, 134, .1);
}
.send-btn {
  flex: none;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid var(--steel);
  border-radius: 6px;
  background: var(--steel);
  color: #fff;
  transition: background .16s, opacity .16s, transform .12s;
}
.send-btn:hover { background: var(--steel-2); }
.send-btn:active { transform: translateY(1px); }
.send-btn:disabled { opacity: .42; cursor: not-allowed; }
.send-btn svg { width: 19px; height: 19px; }

.footnote {
  flex: none;
  margin: 0;
  padding: 0 22px 11px;
  background: #fff;
  color: #93a1ae;
  font-size: 10.5px;
  text-align: center;
}

/* ============ 右侧重点查询 ============ */
.query-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 22px 20px 20px;
  border-left: 1px solid var(--line);
  background: var(--panel);
}
.query-panel::-webkit-scrollbar { width: 7px; }
.query-panel::-webkit-scrollbar-thumb { background: #c9d4de; border-radius: 8px; }

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.panel-head .eyebrow { color: #7b90a4; }
.panel-head h2 {
  margin: 4px 0 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .01em;
}
.panel-close {
  display: none;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--slate);
  font-size: 19px;
  line-height: 1;
}
.panel-desc {
  margin: 8px 0 0;
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--muted);
}

.panel-field { display: block; margin-top: 18px; }
.panel-field > span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 7px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--slate);
}
.panel-field em {
  font-style: normal;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--amber);
}
.panel-field input {
  width: 100%;
  height: 40px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
  outline: none;
  transition: border-color .16s, box-shadow .16s;
}
.panel-field input::placeholder { color: #a4b0bb; }
.panel-field input:focus {
  border-color: var(--steel);
  box-shadow: 0 0 0 3px rgba(44, 95, 134, .1);
}
.panel-error {
  min-height: 17px;
  margin: 6px 0 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--red);
}

.panel-block { margin-top: 12px; }
.panel-label {
  display: block;
  margin-bottom: 7px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--slate);
}
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.segmented button {
  padding: 8px 6px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  transition: background .15s, color .15s;
}
.segmented button + button { border-left: 1px solid var(--line); }
.segmented button.active { background: var(--navy-2); color: #fff; }

.query-btn {
  width: 100%;
  height: 40px;
  margin-top: 9px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 500;
  transition: background .16s, border-color .16s;
}
.query-primary {
  margin-top: 16px;
  border: 1px solid var(--steel);
  background: var(--steel);
  color: #fff;
}
.query-primary:hover { background: var(--steel-2); border-color: var(--steel-2); }
.query-secondary {
  border: 1px solid #b9cad8;
  background: #fff;
  color: var(--steel-2);
}
.query-secondary:hover { background: var(--steel-soft); }
.query-btn:disabled { opacity: .45; cursor: not-allowed; }

.scope-note {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.scope-note h3 {
  margin: 0 0 7px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #8b9cab;
}
.scope-note ul {
  margin: 0;
  padding-left: 15px;
  font-size: 11px;
  line-height: 1.7;
  color: var(--slate);
}
.scope-note li + li { margin-top: 4px; }

.safety-note {
  display: flex;
  gap: 8px;
  margin-top: 18px;
  padding: 11px 12px;
  border: 1px solid #ecdcbf;
  border-radius: 6px;
  background: var(--amber-soft);
  color: #7a4d12;
  font-size: 10.5px;
  line-height: 1.65;
}
.safety-note svg { width: 15px; height: 15px; flex: none; margin-top: 1px; }
.safety-note p { margin: 0; }
.safety-note strong { font-weight: 600; }

.panel-backdrop {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(13, 27, 42, .46);
}

/* ============ 风险确认弹窗 ============ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(13, 27, 42, .58);
}
.modal {
  width: min(430px, 100%);
  padding: 24px 24px 20px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--amber);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 30px 70px -30px rgba(0, 0, 0, .5);
  animation: modal-in .2s ease both;
}
.modal-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  margin-bottom: 13px;
  border-radius: 50%;
  background: var(--amber-soft);
  color: var(--amber);
  font-weight: 700;
}
.modal h2 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
}
.modal p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--slate);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 20px;
}
.btn-ghost, .btn-warn {
  height: 36px;
  padding: 0 14px;
  border-radius: 6px;
  font-size: 12.5px;
}
.btn-ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--slate);
}
.btn-ghost:hover { background: #f4f6f8; }
.btn-warn {
  border: 1px solid var(--amber);
  background: var(--amber);
  color: #fff;
}
.btn-warn:hover { background: #8f540e; }

/* ============ Toast ============ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 80;
  max-width: calc(100% - 32px);
  padding: 9px 15px;
  border-radius: 6px;
  background: var(--navy);
  color: #fff;
  font-size: 12px;
  line-height: 1.5;
  box-shadow: 0 14px 30px -12px rgba(0, 0, 0, .5);
  opacity: 0;
  transform: translate(-50%, 10px);
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ============ 动效 ============ */
@keyframes card-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(6px) scale(.995); }
  to { opacity: 1; transform: none; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink {
  0%, 60%, 100% { opacity: .25; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}
.shake { animation: shake .32s ease; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============ 响应式 ============ */
@media (max-width: 980px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-intro { min-height: 0; padding: 24px 22px 22px; }
  .login-intro::after { display: none; }
  .intro-brand { margin-bottom: 16px; }
  .intro-copy { margin: 0; padding: 0; }
  .intro-copy h1 { margin: 8px 0 0; font-size: 27px; line-height: 1.35; }
  .intro-desc, .intro-points, .intro-foot { display: none; }
  .login-panel { min-height: 0; padding: 24px 16px 30px; justify-content: flex-start; }
  .login-card { padding: 28px 22px 20px; }
  .login-copyright { margin-top: 16px; }
}

@media (max-width: 900px) {
  .app-body { padding: 0; }
  .app-shell { width: 100%; height: 100dvh; border: 0; border-radius: 0; }
  .app-header { height: 60px; padding: 0 14px; }
  .app-header .brand-text p { display: none; }
  .service-status { display: none; }
  .panel-toggle { display: inline-flex; align-items: center; }
  .workspace { grid-template-columns: 1fr; }

  .query-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    width: min(360px, 92vw);
    border-left: 1px solid var(--line);
    transform: translateX(100%);
    transition: transform .24s ease;
    box-shadow: -20px 0 50px -30px rgba(13, 27, 42, .6);
  }
  .query-panel.open { transform: none; }
  .panel-close { display: grid; }
  body.panel-open { overflow: hidden; }

  .messages { padding: 18px 16px 6px; }
  .welcome { padding: 12px 2px 24px; }
  .field input,
  .panel-field input,
  .composer textarea { font-size: 16px; }
  .welcome h2 { font-size: 21px; }
  .welcome-grid { grid-template-columns: 1fr; }
  .steps { gap: 8px 16px; }
  .bubble { max-width: 86%; font-size: 13px; }
  .composer { padding: 10px 12px 5px; }
  .footnote { padding: 0 14px 9px; }
}

@media (max-width: 520px) {
  .app-header { gap: 8px; }
  .app-header .brand-mark { width: 34px; height: 34px; }
  .app-header .brand-text h1 { font-size: 13.5px; }
  .header-actions { gap: 3px; }
  .header-btn { padding: 0 9px; font-size: 11.5px; }
  .icon-btn { width: 30px; }
  .panel-toggle { padding: 0 9px; }
}

@media (max-height: 640px) and (min-width: 901px) {
  .welcome-mark { display: none; }
  .welcome { padding-top: 6px; }
}
