/* ============================================================
 * 学科数据审计监测平台 — 全局样式
 * ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #2a78d6;
  --primary-deep: #1c5cab;
  --primary-soft: #e3eefc;
  --ink: #0b0b0b;
  --ink2: #52514e;
  --muted: #898781;
  --line: #e1e0d9;
  --surface: #fcfcfb;
  --page: #f4f4f1;
  --up: #006300;
  --down: #d03b3b;
  --danger: #d03b3b;
  --sidebar: #122a47;
  --sidebar-hover: #1b3a5f;
  --shadow: 0 1px 3px rgba(11, 11, 11, .07), 0 1px 2px rgba(11, 11, 11, .05);
}
html, body { height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--ink);
  background: var(--page);
  font-size: 14px;
  line-height: 1.6;
}
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- 顶栏 ---------- */
.topbar {
  height: 56px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; padding: 0 20px; gap: 12px;
  position: sticky; top: 0; z-index: 50;
}
.topbar .title { font-size: 16px; font-weight: 700; }
.topbar .title small { display: block; font-size: 11px; font-weight: 400; color: var(--muted); line-height: 1.2; }
.topbar .spacer { flex: 1; }
.topbar .ver-tag {
  font-size: 12px; color: var(--primary-deep); background: var(--primary-soft);
  border: 1px solid #b7d3f6; padding: 2px 10px; border-radius: 999px;
}
.topbar .user { display: flex; align-items: center; gap: 8px; color: var(--ink2); font-size: 13px; }
.topbar .avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--primary-soft);
  color: var(--primary-deep); font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: calc(100vh - 56px); }
.sidebar {
  width: 216px; flex: none; background: var(--sidebar); color: #cfd9e6;
  padding: 14px 10px 24px;
}
.nav-group-title { font-size: 11px; color: #7e93ad; padding: 14px 12px 6px; letter-spacing: .08em; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px; border-radius: 8px; cursor: pointer; user-select: none;
  font-size: 14px; margin-bottom: 2px; color: #cfd9e6; text-decoration: none;
}
.nav-item:hover { background: var(--sidebar-hover); }
.nav-item.active { background: var(--primary); color: #fff; font-weight: 600; }
.nav-item .ni-icon { width: 18px; text-align: center; flex: none; opacity: .9; }
.main { flex: 1; min-width: 0; padding: 20px 24px 48px; }

/* ---------- 页头 ---------- */
.page { display: none; }
.page.active { display: block; }
.page-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h2 { font-size: 20px; font-weight: 700; }
.page-head .sub { width: 100%; color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ---------- 卡片 ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card-head {
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.card-head h3 { font-size: 15px; font-weight: 700; }
.card-head .hint { color: var(--muted); font-size: 12px; }
.card-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card-body { padding: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- 统计卡片 ---------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-tile { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); }
.stat-tile .st-label { color: var(--ink2); font-size: 13px; }
.stat-tile .st-value { font-size: 26px; font-weight: 650; margin-top: 2px; }
.stat-tile .st-value small { font-size: 13px; font-weight: 400; color: var(--muted); margin-left: 2px; }
.stat-tile .st-delta { font-size: 12px; margin-top: 2px; }
.delta-up { color: var(--up); }
.delta-down { color: var(--down); }

/* ---------- 筛选条 ---------- */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end;
  padding: 12px 16px; border-bottom: 1px solid var(--line); background: #fbfbfa;
  border-radius: 12px 12px 0 0;
}
.f-item { display: flex; flex-direction: column; gap: 3px; }
.f-item label { font-size: 12px; color: var(--muted); }
.f-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* ---------- 控件 ---------- */
select, input[type=text], input[type=number], input[type=date], textarea {
  font: inherit; color: var(--ink);
  border: 1px solid #d4d3cc; border-radius: 8px; background: #fff;
  padding: 6px 10px; min-height: 34px; outline: none;
}
select:focus, input:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(42, 120, 214, .15); }
textarea { width: 100%; resize: vertical; }
input.err, select.err, textarea.err, .rich-editor.err { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(208, 59, 59, .12); }
.field-err { color: var(--danger); font-size: 12px; margin-top: 3px; display: none; }
.field-err.show { display: block; }

.btn {
  font: inherit; cursor: pointer; user-select: none;
  border: 1px solid #d4d3cc; background: #fff; color: var(--ink2);
  padding: 6px 14px; border-radius: 8px; min-height: 34px;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { border-color: var(--primary); color: var(--primary-deep); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--primary-deep); border-color: var(--primary-deep); color: #fff; }
.btn-danger { color: var(--danger); border-color: #ecc8c8; }
.btn-danger:hover { background: #fdf3f3; border-color: var(--danger); color: var(--danger); }
.btn-sm { min-height: 26px; padding: 1px 10px; font-size: 12px; border-radius: 6px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- 标签 ---------- */
.tag { display: inline-block; font-size: 12px; padding: 1px 9px; border-radius: 999px; border: 1px solid transparent; white-space: nowrap; }
.tag-peak { background: #fdf3d8; color: #8a5a00; border-color: #f0d9a0; }
.tag-a { background: #e3eefc; color: #1c5cab; border-color: #b7d3f6; }
.tag-b { background: #ddf5ec; color: #0e7a55; border-color: #b2e4d1; }
.tag-bp { background: #fde8df; color: #b4441d; border-color: #f6c6b3; }
.tag-prov { background: #e9e6f9; color: #4a3aa7; border-color: #cdc7ef; }
.tag-nat { background: #fdf3d8; color: #8a5a00; border-color: #f0d9a0; }
.tag-min { background: #e3eefc; color: #1c5cab; border-color: #b7d3f6; }
.tag-pro { background: #ddf5ec; color: #0e7a55; border-color: #b2e4d1; }
.tag-gray { background: #f0efec; color: var(--ink2); border-color: var(--line); }

/* ---------- 表格 ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; color: var(--ink2); font-weight: 600; white-space: nowrap;
  background: #f7f7f4; border-bottom: 1px solid var(--line);
  padding: 9px 12px;
}
.tbl td { padding: 8px 12px; border-bottom: 1px solid #eeede8; vertical-align: middle; }
.tbl tbody tr:hover { background: #f7faff; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl th.sortable { cursor: pointer; }
.tbl th.sortable:hover { color: var(--primary-deep); }
.tbl th .sort-ind { font-size: 10px; color: var(--primary); margin-left: 3px; }
.tbl .group-row td {
  background: #f2f6fc; font-weight: 700; color: var(--primary-deep);
  border-top: 1px solid var(--line);
}
.tbl .clickable { cursor: pointer; }
.tbl .clickable:hover { text-decoration: underline; color: var(--primary-deep); }
.tbl-empty { text-align: center; color: var(--muted); padding: 28px 0 !important; }

/* ---------- 分页 ---------- */
.pager { display: flex; align-items: center; gap: 8px; padding: 12px 16px; justify-content: flex-end; font-size: 13px; color: var(--ink2); flex-wrap: wrap; }
.pager .pg-btn {
  min-width: 28px; height: 28px; border: 1px solid var(--line); background: #fff; border-radius: 6px;
  cursor: pointer; font: inherit; color: var(--ink2); padding: 0 6px;
}
.pager .pg-btn.cur { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.pager .pg-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- 选项卡 ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 16px; background: #fbfbfa; border-radius: 12px 12px 0 0; }
.tab {
  padding: 11px 16px 9px; cursor: pointer; user-select: none; font-size: 14px; color: var(--ink2);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--primary-deep); }
.tab.active { color: var(--primary-deep); font-weight: 700; border-bottom-color: var(--primary); }

/* ---------- 图表 ---------- */
.viz-box { position: relative; }
.viz-plot { width: 100%; overflow: hidden; }
.viz-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 2px 4px 10px; }
.viz-legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink2); }
.viz-legend-item i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.viz-tip {
  position: absolute; z-index: 20; pointer-events: none;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 4px 16px rgba(11, 11, 11, .13); padding: 8px 10px; font-size: 12px; min-width: 140px;
}
.viz-tip-title { font-weight: 700; margin-bottom: 4px; }
.viz-tip-row { display: flex; align-items: center; gap: 6px; padding: 1px 0; color: var(--ink2); }
.viz-tip-row i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.viz-tip-row b { margin-left: auto; color: var(--ink); font-weight: 600; padding-left: 14px; }

/* ---------- 表单 ---------- */
.form-section { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 16px; overflow: hidden; }
.form-section > h4 {
  font-size: 14px; padding: 10px 14px; background: #f7f9fd; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px;
}
.form-section > h4 .bar { width: 4px; height: 14px; background: var(--primary); border-radius: 2px; display: inline-block; }
.form-section > h4 .hint { font-weight: 400; font-size: 12px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 18px; padding: 16px; }
@media (max-width: 1100px) { .form-grid { grid-template-columns: repeat(2, 1fr); } }
.fg-item { display: flex; flex-direction: column; gap: 4px; }
.fg-item.span3 { grid-column: 1 / -1; }
.fg-item > label { font-size: 13px; color: var(--ink2); }
.req::before { content: '*'; color: var(--danger); margin-right: 3px; }
.readonly-box {
  background: #f7f7f4; border: 1px dashed #d4d3cc; border-radius: 8px; min-height: 34px;
  padding: 6px 10px; color: var(--ink2); display: flex; align-items: center; gap: 6px;
}
.readonly-box .lock { color: var(--muted); font-size: 12px; flex: none; }
.data-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted); padding: 0 16px 12px; }
.data-meta b { color: var(--ink2); font-weight: 600; }
.extract-loading { display: flex; align-items: center; gap: 10px; color: var(--primary-deep); padding: 22px 16px; font-size: 13px; }
.spinner {
  width: 18px; height: 18px; border-radius: 50%; flex: none;
  border: 2px solid var(--primary-soft); border-top-color: var(--primary);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 富文本 */
.rich-toolbar { display: flex; gap: 4px; padding: 8px 10px; border: 1px solid #d4d3cc; border-bottom: none; border-radius: 8px 8px 0 0; background: #fbfbfa; flex-wrap: wrap; }
.rich-toolbar button {
  font: inherit; font-size: 13px; min-width: 30px; height: 28px; border: 1px solid transparent;
  background: transparent; border-radius: 6px; cursor: pointer; color: var(--ink2);
}
.rich-toolbar button:hover { background: #efefeb; }
.rich-toolbar button.on { background: var(--primary-soft); color: var(--primary-deep); border-color: #b7d3f6; }
.rich-toolbar .sep { width: 1px; background: var(--line); margin: 3px 4px; }
.rich-editor {
  border: 1px solid #d4d3cc; border-radius: 0 0 8px 8px; min-height: 170px; padding: 12px 14px;
  background: #fff; outline: none; font-size: 14px;
}
.rich-editor:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(42, 120, 214, .15); }
.rich-editor:empty::before { content: attr(data-placeholder); color: var(--muted); }
.rich-editor h3 { font-size: 16px; margin: 8px 0 4px; }
.rich-editor ul, .rich-editor ol { padding-left: 22px; margin: 4px 0; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(11, 20, 34, .45); z-index: 100;
  display: none; align-items: flex-start; justify-content: center; padding: 60px 16px;
  overflow: auto;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 12px; width: 640px; max-width: 100%;
  box-shadow: 0 12px 40px rgba(11, 11, 11, .25);
  animation: pop .18s ease-out;
}
.modal.wide { width: 860px; }
@keyframes pop { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.modal-head h3 { font-size: 16px; }
.modal-head .close { margin-left: auto; cursor: pointer; color: var(--muted); font-size: 18px; border: none; background: none; }
.modal-head .close:hover { color: var(--ink); }
.modal-body { padding: 18px; max-height: 62vh; overflow: auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- 轻提示 ---------- */
#toast-root { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: #fff; border: 1px solid var(--line); box-shadow: 0 6px 24px rgba(11, 11, 11, .15);
  border-radius: 999px; padding: 8px 18px; font-size: 13px; display: flex; gap: 8px; align-items: center;
  animation: pop .18s ease-out;
}
.toast .t-ok { color: var(--up); font-weight: 700; }
.toast .t-warn { color: var(--danger); font-weight: 700; }

/* ---------- 首页 ---------- */
.home-hero {
  background: linear-gradient(120deg, #10345f, #1c5cab 55%, #2a78d6);
  color: #fff; border-radius: 14px; padding: 26px 28px; margin-bottom: 18px;
}
.home-hero h1 { font-size: 22px; margin-bottom: 4px; }
.home-hero p { color: #cfe0f5; font-size: 13px; max-width: 760px; }
.entry-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.entry-card {
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px;
  cursor: pointer; box-shadow: var(--shadow); transition: transform .12s ease, box-shadow .12s ease;
}
.entry-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(11, 11, 11, .12); }
.entry-card .ec-tag { font-size: 12px; color: #8a5a00; background: #fdf3d8; border: 1px solid #f0d9a0; display: inline-block; padding: 0 8px; border-radius: 999px; margin-bottom: 8px; }
.entry-card h4 { font-size: 15px; margin-bottom: 4px; }
.entry-card p { font-size: 12px; color: var(--muted); }

/* ---------- 查询生成 ---------- */
.q-row { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 14px; }
.q-row:last-child { margin-bottom: 0; }
.q-label { width: 118px; flex: none; color: var(--ink2); font-size: 13px; padding-top: 6px; font-weight: 600; }
.q-body { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chk-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chk-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid #d4d3cc; border-radius: 999px; padding: 4px 13px;
  cursor: pointer; user-select: none; background: #fff; font-size: 13px; color: var(--ink2);
}
.chk-chip:hover { border-color: var(--primary); }
.chk-chip.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-deep); font-weight: 600; }
.chk-chip input { display: none; }
.seg { display: inline-flex; border: 1px solid #d4d3cc; border-radius: 8px; overflow: hidden; }
.seg button { font: inherit; font-size: 13px; border: none; background: #fff; color: var(--ink2); padding: 6px 16px; cursor: pointer; }
.seg button + button { border-left: 1px solid #d4d3cc; }
.seg button.on { background: var(--primary); color: #fff; font-weight: 600; }
.delta-cell { white-space: nowrap; }
.delta-cell .d { font-size: 11px; margin-left: 5px; }
.cell-link { cursor: pointer; }
.cell-link:hover { background: var(--primary-soft) !important; }
.drill-hint { font-size: 12px; color: var(--muted); }

/* ---------- 其他 ---------- */
.muted { color: var(--muted); }
.mb0 { margin-bottom: 0; }
.hl { color: var(--primary-deep); font-weight: 600; }
.trace-note {
  font-size: 12px; color: #8a5a00; background: #fdf9ec; border: 1px solid #f0e4bb;
  border-radius: 8px; padding: 8px 12px; margin: 10px 16px 14px; display: none;
}
.trace-note.show { display: block; }
kbd.code { font-family: Consolas, monospace; background: #f0efec; border-radius: 4px; padding: 0 6px; font-size: 12px; }

/* ---------- 智能问数助手 ---------- */
.ai-fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 90;
  display: flex; align-items: center; gap: 8px;
  height: 48px; padding: 0 20px 0 16px; border: none; border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  color: #fff; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  box-shadow: 0 6px 20px rgba(42, 120, 214, .38);
  transition: transform .18s, box-shadow .18s, opacity .18s;
}
.ai-fab:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(42, 120, 214, .46); }
.ai-fab:focus-visible, .ai-send:focus-visible, .ai-act:focus-visible, .ai-chip:focus-visible { outline: 2px solid var(--primary-deep); outline-offset: 2px; }
.ai-fab.hide { opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(8px) scale(.94); }
.ai-fab-icon { font-size: 17px; line-height: 1; animation: ai-twinkle 2.6s ease-in-out infinite; }
@keyframes ai-twinkle { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

.ai-panel {
  position: fixed; right: 24px; bottom: 24px; z-index: 90;
  width: 440px; max-width: calc(100vw - 32px);
  height: 620px; max-height: calc(100vh - 96px);
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 18px 48px rgba(11, 20, 34, .22);
  display: flex; flex-direction: column; overflow: hidden;
  opacity: 0; visibility: hidden; transform: translateY(16px) scale(.98); pointer-events: none;
  transition: opacity .2s, transform .2s, visibility .2s;
}
.ai-panel.show { opacity: 1; visibility: visible; transform: none; pointer-events: auto; }
.ai-head {
  display: flex; align-items: center; gap: 10px; flex: none;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, var(--primary), var(--primary-deep)); color: #fff;
}
.ai-head .ai-mark {
  width: 28px; height: 28px; border-radius: 8px; background: rgba(255, 255, 255, .18);
  display: flex; align-items: center; justify-content: center; font-size: 15px; flex: none;
}
.ai-head-t { font-size: 14px; font-weight: 700; line-height: 1.25; }
.ai-head-t small { display: block; font-size: 11px; font-weight: 400; opacity: .8; }
.ai-x {
  margin-left: auto; width: 26px; height: 26px; border: none; border-radius: 7px;
  background: rgba(255, 255, 255, .16); color: #fff; font-size: 13px; cursor: pointer;
}
.ai-x:hover { background: rgba(255, 255, 255, .3); }

.ai-body { position: relative; flex: 1; overflow-y: auto; padding: 14px; background: var(--surface); }
.ai-msg { display: flex; margin-bottom: 12px; }
.ai-msg.user { justify-content: flex-end; }
.ai-msg.user .ai-bubble {
  max-width: 84%; background: var(--primary); color: #fff;
  border-radius: 12px 12px 4px 12px; padding: 8px 12px; font-size: 13px;
}
.ai-msg.bot { display: block; }
.ai-msg.bot .ai-bubble {
  background: #fff; border: 1px solid var(--line); border-radius: 12px 12px 12px 4px;
  padding: 12px; box-shadow: var(--shadow);
}
.ai-text { font-size: 13px; line-height: 1.75; color: var(--ink2); }
.ai-text b { color: var(--primary-deep); font-weight: 700; }

.ai-kpis { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ai-kpi {
  flex: 1 1 84px; background: var(--primary-soft); border-radius: 8px; padding: 7px 10px;
}
.ai-kpi span { display: block; font-size: 11px; color: var(--ink2); }
.ai-kpi b { font-size: 17px; color: var(--primary-deep); }
.ai-kpi b i { font-size: 11px; font-weight: 400; font-style: normal; margin-left: 2px; }

.ai-chart { margin-top: 10px; overflow-x: auto; }
.ai-tbl-wrap { margin-top: 10px; max-height: 214px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.ai-tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.ai-tbl th, .ai-tbl td { padding: 6px 9px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.ai-tbl th { background: #f6f6f3; color: var(--ink2); font-weight: 600; position: sticky; top: 0; }
.ai-tbl tbody tr:last-child td { border-bottom: none; }
.ai-note { margin-top: 8px; font-size: 11px; color: var(--muted); }
.ai-act {
  margin-top: 10px; border: 1px solid var(--primary); border-radius: 8px; background: #fff;
  color: var(--primary-deep); font: inherit; font-size: 12px; font-weight: 600;
  padding: 5px 12px; cursor: pointer;
}
.ai-act:hover { background: var(--primary-soft); }

.ai-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ai-chip {
  border: 1px solid #d4d3cc; border-radius: 999px; background: #fff; color: var(--ink2);
  font: inherit; font-size: 12px; padding: 4px 11px; cursor: pointer; text-align: left;
}
.ai-chip:hover { border-color: var(--primary); color: var(--primary-deep); background: var(--primary-soft); }

.ai-typing { display: inline-flex; gap: 4px; padding: 3px 0; }
.ai-typing i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--muted);
  animation: ai-blink 1.2s infinite ease-in-out;
}
.ai-typing i:nth-child(2) { animation-delay: .18s; }
.ai-typing i:nth-child(3) { animation-delay: .36s; }
@keyframes ai-blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.ai-foot { flex: none; display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); background: #fff; }
.ai-foot input {
  flex: 1; min-width: 0; border: 1px solid #d4d3cc; border-radius: 8px;
  padding: 8px 11px; font: inherit; font-size: 13px; color: var(--ink);
}
.ai-foot input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.ai-send {
  flex: none; border: none; border-radius: 8px; background: var(--primary); color: #fff;
  font: inherit; font-size: 13px; font-weight: 600; padding: 0 16px; cursor: pointer;
}
.ai-send:hover { background: var(--primary-deep); }

@media (max-width: 560px) {
  .ai-fab { right: 16px; bottom: 16px; padding: 0 16px 0 14px; }
  .ai-panel { right: 0; bottom: 0; width: 100vw; max-width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; border: none; }
}
