/* Maneki Dashboard — one light theme, no framework. Tokens on :root so panels stay consistent. */
:root {
  --bg: #f4f8f7; --panel: #ffffff; --line: #dfe8e5; --ink: #10302a; --mut: #62807a;
  --brand: #0bb39a; --good: #0a9d6e; --bad: #e23b4e; --warn: #c77700; --warn-bg: #fff6e5; --accent: #7b6cff; --bad-bg: #fdecee;
  --radius: 14px; --shadow: 0 6px 22px rgba(16, 48, 42, .06);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); }
a { color: var(--brand); }
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px; padding: 12px 20px; background: #fff; border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; font-size: 18px; } .brand span { color: var(--brand); }
.status { color: var(--mut); font-size: 12px; flex: 1; }
.status.ok { color: var(--good); } .status.err { color: var(--bad); }
.actions { display: flex; gap: 8px; }
.btn { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 10px; padding: 7px 13px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--brand); } .btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.ghost { background: transparent; } .btn:disabled { opacity: .5; cursor: progress; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 20px 0; }
.tabs button { border: 0; background: transparent; padding: 8px 12px; border-radius: 10px; font: inherit; font-weight: 700; color: var(--mut); cursor: pointer; }
.notice { margin: 12px 20px 0; padding: 10px 14px; border-radius: 10px; background: var(--warn-bg); color: var(--warn); font-weight: 600; font-size: 13px; }
.notice.required { background: var(--bad-bg); color: var(--bad); }
.tabs button.on { background: #e6f6f2; color: var(--good); }
main { max-width: 1320px; margin: 0 auto; padding: 16px 20px 60px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.tgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; }
.card h3 { margin: 0 0 10px; font-size: 16px; }
.card .k { color: var(--mut); font-size: 12.5px; font-weight: 700; }
.card .v { font-size: 26px; font-weight: 850; margin-top: 4px; }
.card .sub { color: var(--mut); font-size: 12px; margin-top: 4px; }
.mut { color: var(--mut); } .small { font-size: 12px; } .mono { font-family: var(--mono); }
.good { color: var(--good); } .bad { color: var(--bad); } .warn { color: var(--warn); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.section { margin: 18px 0 10px; font-size: 13px; font-weight: 800; color: var(--mut); letter-spacing: .3px; text-transform: uppercase; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--mut); font-weight: 700; font-size: 12px; } td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.scroll { overflow: auto; max-width: 100%; }
.chart { position: relative; height: 260px; }
.kind { display: inline-block; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 4px; margin-left: 6px; vertical-align: middle; }
.kind.base { background: #e6f4ee; color: #0a7a55; } .kind.stat { background: #ece9fb; color: #5b4bd6; }
.hint { display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; border-radius: 50%; border: 1px solid #9fb3ad; color: var(--mut); font-size: 10px; font-weight: 700; margin-left: 4px; cursor: help; vertical-align: middle; background: #fff; user-select: none; }
.hint:hover { border-color: var(--brand); color: var(--brand); }
.hintpop { position: fixed; z-index: 60; max-width: 380px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 12.5px; line-height: 1.55; box-shadow: 0 10px 30px rgba(16,48,42,.14); }
.hintpop .row2 { display: grid; grid-template-columns: 64px 1fr; gap: 4px 8px; margin-top: 8px; } .hintpop .row2 span:nth-child(odd) { color: var(--mut); }
.err { background: #fff2f3; border: 1px solid #f3c5ca; color: var(--bad); border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: #eef3f1; color: var(--mut); }
.pill.on { background: #e6f6f2; color: var(--good); }
select, input { font: inherit; padding: 7px 9px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); }
dialog { border: 0; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.2); padding: 0; width: min(520px, 94vw); }
dialog::backdrop { background: rgba(16,48,42,.35); }
.settings { padding: 20px 22px; display: grid; gap: 12px; } .settings label { display: grid; gap: 6px; font-weight: 700; font-size: 13px; } .settings input { width: 100%; }
.footnote { color: var(--mut); font-size: 11.5px; margin: 8px 0 0; }
@media (max-width: 640px) { main { padding: 12px 16px 40px; } .top { padding: 10px 16px; flex-wrap: wrap; } .status { order: 3; width: 100%; } }

/* ---- 🧾 API 调试抽屉（右下角，可收起）---- */
.dbg-btn { position: fixed; right: 16px; bottom: 16px; z-index: 40; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 999px; padding: 9px 14px; font: inherit; font-weight: 700; font-size: 13px; box-shadow: var(--shadow); cursor: pointer; }
.dbg-btn:hover { border-color: var(--brand); }
.dbg-btn.has-err { border-color: var(--bad); color: var(--bad); }
.dbg-count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: #e6f6f2; color: var(--good); font-size: 11.5px; text-align: center; }
.dbg-count.bad { background: var(--bad-bg); color: var(--bad); }
.dbg-panel { position: fixed; right: 16px; bottom: 64px; z-index: 40; width: min(620px, calc(100vw - 32px)); max-height: 60vh; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.dbg-panel[hidden] { display: none; }
.dbg-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.dbg-x { border: 0; background: transparent; color: var(--mut); font: inherit; font-weight: 700; cursor: pointer; }
.dbg-body { display: flex; flex-direction: column; min-height: 0; padding: 10px 14px 12px; gap: 8px; overflow: hidden; }
.dbg-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.dbg-filters button { border: 0; background: transparent; padding: 4px 9px; border-radius: 8px; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--mut); cursor: pointer; }
.dbg-filters button.on { background: #e6f6f2; color: var(--good); }
.dbg-scroll { overflow: auto; min-height: 120px; max-height: 38vh; border: 1px solid var(--line); border-radius: 10px; }
.dbg-table { font-size: 12px; }
.dbg-table th, .dbg-table td { padding: 6px 8px; }
.dbg-table tbody tr[data-id] { cursor: pointer; }
.dbg-table tbody tr.on { background: #f3faf8; }
.dbg-table tr.ev td { color: var(--mut); }
.dbg-table tr.ev.bad td { color: var(--bad); }
.dbg-detail td { white-space: normal; background: #fbfdfc; }
.dbg-pre { margin: 6px 0 0; max-height: 200px; overflow: auto; font: 11px/1.45 var(--mono); background: var(--bg); border-radius: 8px; padding: 8px; white-space: pre-wrap; word-break: break-all; }
.dbg-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dbg-foot .btn { padding: 5px 10px; font-size: 12.5px; }
.chip-hit { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 0 5px; border-radius: 4px; background: #eef0ff; color: var(--accent); }
@media (max-width: 640px) { .dbg-panel { right: 8px; left: 8px; width: auto; bottom: 60px; } .dbg-btn { right: 10px; bottom: 10px; } }

/* ---- 基础总览 / 自定义 ---- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-size: 12.5px; background: #fff; }
.cb-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 14px; }
.cb-spec { width: 100%; min-height: 360px; font: 12.5px/1.5 var(--mono); border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: #fbfdfc; color: var(--ink); resize: vertical; }
select, input[type=text] { font: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; background: #fff; color: var(--ink); }
@media (max-width: 860px) { .cb-grid { grid-template-columns: 1fr; } }

/* ---- 自定义看板：编辑器 ---- */
.cb-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.cb-top label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--mut); }
.cb-top select, .cb-top input { min-width: 0; }
.name-in { width: 200px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: transparent; padding: 6px 12px; font: inherit; font-weight: 700; font-size: 13px; color: var(--mut); cursor: pointer; }
.seg button.on { background: #e6f6f2; color: var(--good); }
.cb-edit { min-width: 0; }
.cb-spec { min-height: 420px; }
.bld { display: flex; flex-direction: column; gap: 16px; }
.bld-sec { display: flex; flex-direction: column; gap: 10px; }
.bld-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-bottom: 6px; border-bottom: 1px dashed var(--line); }
.bld-h b { font-size: 14px; }
.bld-item { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fbfdfc; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.bld-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bld-row label, .bld-series label, .bld-cond label { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--mut); }
.bld-row select, .bld-row input, .bld-series input, .bld-cond select, .bld-cond input, .bld-item select { font: inherit; font-size: 13px; border: 1px solid var(--line); border-radius: 8px; padding: 4px 7px; background: #fff; color: var(--ink); max-width: 100%; }
.bld-item label.full { display: flex; flex-direction: column; align-items: stretch; gap: 4px; font-size: 12.5px; color: var(--mut); }
.bld-item label.full input { width: 100%; font: 13px/1.4 var(--mono); padding: 6px 8px; }
.bld-series { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bld-series label.grow { flex: 1 1 220px; }
.bld-series label.grow input { flex: 1; min-width: 0; font: 13px/1.4 var(--mono); }
.bld-ops { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bld-tools { margin-left: auto; display: inline-flex; gap: 4px; }
.bld-where { display: flex; flex-direction: column; gap: 6px; padding-left: 10px; border-left: 2px solid #e5efec; }
.bld-cond { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bld-cols { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.bld-cols .chk { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; }
.small-btn { padding: 3px 8px; font-size: 12px; border-radius: 8px; }
.id-in { width: 130px; font: 13px var(--mono) !important; }
.title-in { width: 200px; }
.num-in { width: 70px; }
.cb-cardhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.cb-cardhead h3 { margin: 0; }
@media (max-width: 640px) { .name-in, .title-in { width: 100%; } .id-in { width: 100%; } .bld-tools { margin-left: 0; } }
.bld-where > .small-btn { align-self: flex-start; }

/* ---- 💬 问数据：左侧历史 + 右侧对话 ---- */
:root { --mid: #8a6d00; --mid-bg: #fff6d6; --q-bg: #e6f6f2; }
.ask { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 14px; align-items: start; }
.ask-side { position: sticky; top: 70px; display: flex; flex-direction: column; gap: 10px; padding: 14px; max-height: calc(100vh - 190px); }
.ask-side input { width: 100%; }
.ask-list { overflow: auto; display: flex; flex-direction: column; gap: 4px; min-height: 60px; }
.ask-item { position: relative; padding: 8px 26px 8px 10px; border-radius: 10px; cursor: pointer; }
.ask-item:hover { background: #f3faf8; } .ask-item.on { background: var(--q-bg); }
.ask-item .t { font-weight: 700; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ask-del { position: absolute; right: 6px; top: 8px; border: 0; background: transparent; color: var(--mut); font-size: 15px; cursor: pointer; visibility: hidden; }
.ask-item:hover .ask-del, .ask-item.on .ask-del { visibility: visible; } .ask-del:hover { color: var(--bad); }
.ask-sidefoot { border-top: 1px dashed var(--line); padding-top: 8px; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--bad); font: inherit; cursor: pointer; text-decoration: underline; }
/* 卡片底部留出 main 的下边距，右下角 🧾 API 日志按钮落在空白处，不压住「发送」 */
.ask-main { display: flex; flex-direction: column; padding: 0; min-height: calc(100vh - 190px); }
.ask-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.ask-head b { font-size: 15px; flex: 1 1 160px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ask-mask { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.ask-thread { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 18px; max-height: calc(100vh - 360px); min-height: 280px; }
.ask-turn { display: flex; flex-direction: column; gap: 8px; }
.ask-q { align-self: flex-end; max-width: 80%; text-align: right; }
.ask-q .bubble { display: inline-block; text-align: left; background: var(--q-bg); color: var(--ink); padding: 9px 13px; border-radius: 14px 14px 4px 14px; font-weight: 600; white-space: pre-wrap; overflow-wrap: anywhere; }
.ask-a { border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; padding: 12px 14px; background: #fff; min-width: 0; overflow-wrap: anywhere; }
.ask-md { line-height: 1.65; } .ask-md > :first-child { margin-top: 0; } .ask-md > :last-child { margin-bottom: 0; }
.ask-md table { margin: 8px 0; } .ask-md td, .ask-md th { white-space: nowrap; }
.ask-md code { font-family: var(--mono); font-size: 12.5px; background: var(--bg); padding: 1px 4px; border-radius: 4px; }
.ask-figs { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; margin-bottom: 12px; }
.ask-fig { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #fbfdfc; min-width: 0; }
.ask-fig .k { color: var(--mut); font-size: 12px; font-weight: 700; } .ask-fig .v { font-size: 19px; font-weight: 800; margin-top: 2px; font-variant-numeric: tabular-nums; }
.ask-fig .v small { font-size: 12px; color: var(--mut); font-weight: 600; }
.ask-cav { margin: 10px 0 0; padding-left: 18px; color: var(--mut); font-size: 12px; line-height: 1.55; }
.ask-meta { margin-top: 8px; color: var(--mut); font-size: 11.5px; }
.conf { font-weight: 700; padding: 0 5px; border-radius: 4px; }
.conf.on { background: var(--q-bg); color: var(--good); } .conf.mid { background: var(--mid-bg); color: var(--mid); } .conf.low { background: var(--bad-bg); color: var(--bad); }
.ask-ev { margin-top: 8px; font-size: 12.5px; } .ask-ev summary { cursor: pointer; color: var(--brand); font-weight: 600; }
.ask-ev ol { margin: 8px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.ask-sql { margin: 4px 0 0; max-height: 220px; overflow: auto; font: 11.5px/1.45 var(--mono); background: var(--bg); border-radius: 8px; padding: 8px; white-space: pre-wrap; word-break: break-all; }
.ask-actions { margin-top: 10px; gap: 6px; }
.ask-follow { margin-top: 10px; } .chips button.chip { cursor: pointer; font: inherit; font-size: 12.5px; color: var(--ink); }
.chips button.chip:hover { border-color: var(--brand); color: var(--brand); }
.ask-wait { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--mut); }
.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: askspin .8s linear infinite; vertical-align: -1px; }
@keyframes askspin { to { transform: rotate(360deg); } }
.ask-empty h3 { margin: 4px 0 6px; } .ask-empty p { max-width: 720px; }
.ask-ex { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.ask-compose { border-top: 1px solid var(--line); padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.ask-compose textarea { width: 100%; resize: vertical; min-height: 54px; font: inherit; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fff; }
.ask-compose textarea:focus { outline: none; border-color: var(--brand); }
.ask-bar { justify-content: space-between; } .ask-tip { flex: 1; }
.ask-flash { background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 6px 10px; font-size: 12.5px; font-weight: 600; }
@media (max-width: 860px) {
  .ask { grid-template-columns: 1fr; }
  .ask-side { position: static; max-height: 260px; }
  .ask-thread { max-height: none; }
  .ask-q { max-width: 92%; } .ask-tip { display: none; }
}

/* ---- 登录 / 账号 ---- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login { width: min(380px, 100%); display: grid; gap: 12px; padding: 24px; }
.login label { display: grid; gap: 6px; font-weight: 700; font-size: 13px; } .login input { width: 100%; }
.login p { margin: 0; } .login .btn { padding: 10px; }
.who { white-space: nowrap; align-self: center; }
.ask-low { background: var(--bad-bg); color: var(--bad); border-radius: 8px; padding: 7px 10px; font-size: 12.5px; font-weight: 600; margin-bottom: 10px; }
.ask-head input[type=text] { flex: 0 1 220px; min-width: 0; font-size: 13px; }
.ask-more { text-align: center; margin: 0; }
.ask-searchbar { justify-content: space-between; padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
@media (max-width: 640px) { .ask-head input[type=text] { flex: 1 1 100%; } }
