/* 中性灰白風格：淺色 / 深色兩套色票 */
:root {
  --bg: #ffffff; --sidebar: #f9f9f9; --surface: #ffffff; --surface-2: #f7f7f7;
  --hover: #ececec; --active: #e5e5e5; --text: #171717; --text-2: #4b4b4b; --muted: #8e8e8e;
  --border: #ececec; --border-2: #e3e3e3; --bubble: #f4f4f4; --code: #f7f7f7;
  --primary: #171717; --primary-fg: #ffffff; --danger: #dc2626; --ok: #16a34a; --warn: #d97706;
  --bar: #171717; --bar-2: #b4b4b4; --track: #ececec;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.14);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #171717; --sidebar: #0d0d0d; --surface: #212121; --surface-2: #1d1d1d;
  --hover: #262626; --active: #2f2f2f; --text: #ececec; --text-2: #c4c4c4; --muted: #8e8e8e;
  --border: #262626; --border-2: #333333; --bubble: #262626; --code: #0d0d0d;
  --primary: #ececec; --primary-fg: #171717; --danger: #f87171; --ok: #4ade80; --warn: #fbbf24;
  --bar: #ececec; --bar-2: #5c5c5c; --track: #2a2a2a;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.3);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.5);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14.5px/1.6 "Inter", system-ui, -apple-system, "Segoe UI", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
svg.i { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .center { text-align: center; }
.err { color: var(--danger); min-height: 1.2em; margin: 0; font-size: 13px; }
.row { display: flex; align-items: center; } .gap { gap: 8px; } .wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; }
.ok { color: var(--ok); } .bad { color: var(--danger); } .warn { color: var(--warn); }

/* 按鈕與輸入 */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border-2); background: var(--surface); border-radius: 10px; padding: 7px 14px; cursor: pointer; white-space: nowrap; font-size: 14px; transition: background .15s; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.btn.primary:hover { opacity: .88; background: var(--primary); }
.btn.danger { color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { padding: 5px 11px; font-size: 13px; border-radius: 9px; }
.btn.sm svg.i { width: 15px; height: 15px; }
.btn.lg { padding: 10px; justify-content: center; font-size: 15px; border-radius: 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; position: relative; background: none; border: 0; cursor: pointer; width: 34px; height: 34px; border-radius: 10px; color: var(--text-2); }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.link { background: none; border: 0; color: var(--text); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 0; font-size: inherit; }
.link.danger { color: var(--danger); }
input:not([type=checkbox]):not([type=range]):not([type=radio]), select, textarea {
  background: var(--surface); border: 1px solid var(--border-2); border-radius: 10px; padding: 8px 12px; outline: none; max-width: 100%; transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--muted); }
.select-sm { padding: 5px 10px !important; font-size: 13px; border-radius: 9px !important; }
input[type=checkbox] { accent-color: var(--primary); width: 15px; height: 15px; }
input[type=range] { accent-color: var(--primary); width: 100%; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; cursor: pointer; user-select: none; }
.badge { font-size: 11px; padding: 1px 8px; border-radius: 99px; background: var(--hover); color: var(--text-2); font-weight: 500; }
.chip { display: inline-flex; align-items: center; font-size: 11px; padding: 0 7px; border-radius: 99px; border: 1px solid var(--border-2); color: var(--muted); line-height: 18px; }

/* 登入 */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 12px; }
.auth-card input { padding: 11px 14px !important; border-radius: 12px !important; background: var(--surface-2) !important; border-color: transparent !important; }
.auth-card input:focus { border-color: var(--border-2) !important; }
.auth-logo { width: 52px; height: 52px; border-radius: 50%; background: var(--primary); color: var(--primary-fg); display: grid; place-items: center; font-weight: 700; margin: 0 auto 4px; }
.auth-card h1 { margin: 0; font-size: 24px; text-align: center; font-weight: 600; }
.auth-card p { margin: 0; }
.auth-card a { color: var(--text-2); }
.pw-fields { display: flex; flex-direction: column; gap: 12px; }
.google-btn { gap: 10px; text-decoration: none; background: var(--surface); border: 1px solid var(--border-2); color: var(--text) !important; font-weight: 500; }
.google-btn:hover { background: var(--hover); }
.auth-or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--border-2); }

/* 版面 */
.app { display: flex; height: 100%; }
.sidebar { width: 260px; flex-shrink: 0; background: var(--sidebar); display: flex; flex-direction: column; padding: 10px 8px; gap: 2px; transition: margin-left .2s ease; }
.app.sb-collapsed .sidebar { margin-left: -260px; }
.sb-top { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 8px 8px; }
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.logo { width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: var(--primary-fg); display: grid; place-items: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.brand-name { font-weight: 600; font-size: 15px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sb-item { display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: 0; padding: 8px 10px; border-radius: 10px; cursor: pointer; text-align: left; font-size: 14px; color: var(--text); }
.sb-item:hover { background: var(--hover); }
.sb-item.active { background: var(--active); }
.sb-search { display: flex; align-items: center; gap: 10px; padding: 0 10px; border-radius: 10px; color: var(--text-2); }
.sb-search:focus-within { background: var(--hover); }
.sb-search input { border: 0 !important; background: transparent !important; padding: 8px 0 !important; width: 100%; font-size: 14px; }
.conv-list { flex: 1; overflow-y: auto; margin-top: 8px; padding-right: 2px; }
.conv-group { font-size: 12px; color: var(--muted); padding: 12px 10px 4px; font-weight: 500; }
.conv-item { display: flex; align-items: center; padding: 7px 10px; border-radius: 10px; cursor: pointer; font-size: 14px; color: var(--text); position: relative; }
.conv-item:hover { background: var(--hover); }
.conv-item.active { background: var(--active); }
.conv-item .t { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: clip; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
.conv-item .x { display: none; background: none; border: 0; cursor: pointer; color: var(--muted); padding: 2px; border-radius: 6px; }
.conv-item .x:hover { color: var(--text); }
.conv-item:hover .x, .conv-item.active .x { display: inline-flex; }
.conv-item .x svg.i { width: 15px; height: 15px; }
.sb-bottom { padding-top: 6px; }
.user-btn { display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: 0; padding: 8px 10px; border-radius: 12px; cursor: pointer; text-align: left; color: var(--text-2); }
.user-btn:hover { background: var(--hover); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 600; color: #fff; flex-shrink: 0; background: #6b7280; }
.user-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.user-name { color: var(--text); font-weight: 500; font-size: 14px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.user-limit { font-size: 11.5px; color: var(--muted); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); }
.view { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.topbar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; min-height: 52px; flex-wrap: wrap; }
.page-title { margin: 0 0 0 4px; font-size: 17px; font-weight: 600; }
.sb-open { display: none; }
.app.sb-collapsed .sb-open { display: inline-flex; }
.model-btn { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; cursor: pointer; padding: 6px 10px; border-radius: 10px; font-size: 16px; font-weight: 600; color: var(--text); max-width: 60vw; }
.model-btn span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.model-btn:hover { background: var(--hover); }
.model-btn svg.i { width: 16px; height: 16px; color: var(--muted); }
.dot-count { position: absolute; top: 3px; right: 3px; min-width: 15px; height: 15px; border-radius: 99px; background: var(--primary); color: var(--primary-fg); font-size: 10px; display: grid; place-items: center; padding: 0 3px; }
.scrim { display: none; }
.page { flex: 1; overflow-y: auto; padding: 8px 20px 48px; }
.page > * { max-width: 920px; margin-left: auto; margin-right: auto; }

/* 對話 */
.chat-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.messages { flex: 1; overflow-y: auto; padding: 8px 20px 24px; }
.chat-body.empty { justify-content: center; padding-bottom: 8vh; }
.chat-body.empty .messages { flex: none; overflow: visible; padding-bottom: 8px; }
.chat-body:not(.empty) .suggestions { display: none; }
.chat-body.empty .disclaimer { display: none; }
.greeting { max-width: 768px; margin: 0 auto; text-align: center; }
.greeting .g-logo { width: 44px; height: 44px; border-radius: 50%; background: var(--primary); color: var(--primary-fg); display: inline-grid; place-items: center; font-weight: 700; font-size: 14px; margin-bottom: 14px; }
.greeting h1 { font-size: 28px; font-weight: 500; margin: 0 0 4px; letter-spacing: -.01em; }
.greeting p { margin: 0; color: var(--muted); }
.msg { max-width: 768px; margin: 0 auto 26px; display: flex; flex-direction: column; }
.msg.user { align-items: flex-end; }
.msg.user .bubble { background: var(--bubble); border-radius: 22px; padding: 10px 18px; max-width: 80%; white-space: pre-wrap; word-break: break-word; }
.msg .imgs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; justify-content: flex-end; }
.msg .imgs img { max-height: 180px; max-width: 260px; border-radius: 14px; cursor: zoom-in; display: block; }
.msg-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.m-avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: var(--primary-fg); display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.m-name { font-weight: 600; font-size: 14px; }
.m-time { font-size: 12px; color: var(--muted); }
.msg.assistant .bubble { padding-left: 34px; word-break: break-word; }
.msg-actions { display: flex; gap: 2px; margin: 6px 0 0 30px; opacity: 0; transition: opacity .15s; align-items: center; }
.msg:hover .msg-actions, .msg.last .msg-actions { opacity: 1; }
.msg-actions .icon-btn { width: 28px; height: 28px; border-radius: 8px; color: var(--muted); }
.msg-actions .icon-btn svg.i { width: 16px; height: 16px; }
.msg-actions .icon-btn:hover { color: var(--text); }
.msg-stats { font-size: 12px; color: var(--muted); margin-left: 6px; }
.thinking { margin: 0 0 8px 34px; color: var(--muted); font-size: 13.5px; }
.thinking summary { cursor: pointer; user-select: none; display: inline-flex; align-items: center; gap: 6px; list-style: none; }
.thinking summary::-webkit-details-marker { display: none; }
.thinking summary:hover { color: var(--text); }
.thinking .tbody { white-space: pre-wrap; margin-top: 6px; padding-left: 12px; border-left: 2px solid var(--border-2); max-height: 320px; overflow-y: auto; }
.shimmer { background: linear-gradient(90deg, var(--muted) 30%, var(--text) 50%, var(--muted) 70%); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 1.6s linear infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.error-box { margin: 6px 0 0 34px; color: var(--danger); font-size: 13.5px; background: color-mix(in srgb, var(--danger) 8%, transparent); padding: 8px 12px; border-radius: 10px; }
.typing { display: inline-flex; gap: 4px; padding: 8px 0; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: bounce 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .15s; } .typing span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }

.md { line-height: 1.7; }
.md > :first-child { margin-top: 0; }
.md p { margin: 0 0 .8em; } .md p:last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3, .md h4 { margin: 1.2em 0 .5em; line-height: 1.35; font-weight: 600; } .md h1 { font-size: 1.45em; } .md h2 { font-size: 1.25em; } .md h3 { font-size: 1.1em; }
.md ul, .md ol { margin: 0 0 .8em; padding-left: 1.4em; } .md li { margin: .2em 0; }
.md code { background: var(--hover); padding: 1px 5px; border-radius: 6px; font-size: .88em; font-family: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace; }
.md pre { background: var(--code); border: 1px solid var(--border); border-radius: 14px; margin: 0 0 1em; overflow: hidden; }
.md pre code { display: block; padding: 14px 16px; overflow-x: auto; white-space: pre; background: none; font-size: 13px; line-height: 1.55; border-radius: 0; }
.code-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px 6px 16px; font-size: 12px; color: var(--muted); background: var(--surface-2); }
.code-head button { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 12px; padding: 2px 6px; border-radius: 6px; }
.code-head button:hover { color: var(--text); background: var(--hover); }
.code-head svg.i { width: 14px; height: 14px; }
.md blockquote { margin: 0 0 .8em; padding-left: 14px; border-left: 3px solid var(--border-2); color: var(--text-2); }
.md .tbl { overflow-x: auto; margin-bottom: 1em; border: 1px solid var(--border); border-radius: 12px; }
.md table { border-collapse: collapse; font-size: 13.5px; width: 100%; }
.md th, .md td { border-bottom: 1px solid var(--border); padding: 7px 12px; text-align: left; }
.md tr:last-child td { border-bottom: 0; }
.md th { background: var(--surface-2); font-weight: 600; }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 1.2em 0; }
.md a { text-decoration: underline; text-underline-offset: 3px; }

/* 輸入框 */
.composer-wrap { padding: 0 20px 10px; }
.composer { max-width: 768px; margin: 0 auto; background: var(--surface); border: 1px solid var(--border-2); border-radius: 26px; padding: 10px 10px 8px 14px; box-shadow: var(--shadow); transition: border-color .15s; }
:root[data-theme="dark"] .composer { background: var(--surface); border-color: var(--border-2); }
.composer:focus-within { border-color: var(--muted); }
.composer textarea { width: 100%; border: 0 !important; resize: none; max-height: 260px; padding: 6px 4px !important; background: transparent !important; font-size: 15px; line-height: 1.55; display: block; }
.composer-bar { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.composer-info { font-size: 12px; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 0 4px; }
.round-btn { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border-2); background: none; display: grid; place-items: center; cursor: pointer; color: var(--text-2); }
.round-btn:hover { background: var(--hover); }
.pill { display: inline-flex; align-items: center; gap: 5px; height: 34px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--border-2); background: none; cursor: pointer; font-size: 13px; color: var(--text-2); }
.pill:hover { background: var(--hover); }
.pill.on { background: color-mix(in srgb, #3b82f6 14%, transparent); border-color: color-mix(in srgb, #3b82f6 40%, transparent); color: #3b82f6; }
.pill svg.i { width: 16px; height: 16px; }
.send-btn { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--primary); color: var(--primary-fg); display: grid; place-items: center; cursor: pointer; transition: opacity .15s; }
.send-btn:disabled { opacity: .3; cursor: default; }
.send-btn svg.i { stroke-width: 2.2; }
.send-btn.stop svg.i { fill: currentColor; stroke: none; width: 13px; height: 13px; }
.img-preview { display: flex; gap: 8px; flex-wrap: wrap; }
.img-preview:not(:empty) { margin: 2px 0 8px; }
.img-preview .thumb { position: relative; }
.img-preview img { height: 60px; width: 60px; object-fit: cover; border-radius: 12px; display: block; }
.img-preview button { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--surface); background: var(--text); color: var(--bg); cursor: pointer; display: grid; place-items: center; padding: 0; }
.img-preview button svg.i { width: 11px; height: 11px; stroke-width: 3; }
.suggestions { max-width: 768px; margin: 18px auto 0; display: flex; flex-direction: column; gap: 2px; }
.suggestions .s-title { font-size: 12.5px; color: var(--muted); padding: 0 12px 4px; display: flex; align-items: center; gap: 6px; }
.suggestions button { display: flex; flex-direction: column; text-align: left; background: none; border: 0; padding: 8px 12px; border-radius: 12px; cursor: pointer; }
.suggestions button:hover { background: var(--hover); }
.suggestions .s1 { font-size: 14px; font-weight: 500; }
.suggestions .s2 { font-size: 12.5px; color: var(--muted); }
.disclaimer { text-align: center; font-size: 12px; color: var(--muted); margin: 8px 0 0; }

/* 下拉選單 */
.popover { position: fixed; z-index: 70; background: var(--surface); border: 1px solid var(--border-2); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 220px; max-width: calc(100vw - 24px); }
.pop-item { display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: 0; padding: 8px 10px; border-radius: 10px; cursor: pointer; text-align: left; font-size: 14px; color: var(--text); }
.pop-item:hover, .pop-item.kb { background: var(--hover); }
.pop-item.danger { color: var(--danger); }
.pop-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.pop-head { padding: 6px 10px 4px; font-size: 12px; color: var(--muted); }
.model-pop { width: 380px; }
.model-pop .search-box { margin: 2px 2px 6px; }
.model-list { max-height: 360px; overflow-y: auto; }
.model-item { display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: 0; padding: 8px 10px; border-radius: 10px; cursor: pointer; text-align: left; color: var(--text); }
.model-item:hover, .model-item.kb { background: var(--hover); }
.model-item .mi-main { flex: 1; min-width: 0; }
.model-item .mi-name { font-size: 14px; font-weight: 500; }
.model-item .mi-sub { font-size: 12px; color: var(--muted); display: flex; gap: 5px; flex-wrap: wrap; align-items: center; margin-top: 2px; }
.model-item .mi-check { width: 18px; color: var(--text); }
.search-box { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border-radius: 10px; padding: 0 10px; color: var(--muted); }
.search-box input { border: 0 !important; background: transparent !important; padding: 8px 0 !important; width: 100%; }

/* 資料庫 */
.docs-layout { flex: 1; display: flex; min-height: 0; padding: 0 12px 12px; gap: 12px; }
.docs-list-pane { width: 320px; display: flex; flex-direction: column; gap: 10px; min-height: 0; flex-shrink: 0; }
.doc-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.doc-item { padding: 10px 12px; border-radius: 12px; cursor: pointer; }
.doc-item:hover { background: var(--hover); }
.doc-item.active { background: var(--active); }
.doc-item .dt { font-weight: 500; font-size: 14px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.doc-item .dp { font-size: 12.5px; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; margin: 2px 0; }
.doc-item .dm { font-size: 11.5px; color: var(--muted); }
.doc-editor { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); border-radius: 18px; padding: 16px; }
.doc-editor .empty { margin: auto; text-align: center; color: var(--muted); max-width: 320px; }
.doc-editor .empty svg.i { width: 36px; height: 36px; stroke-width: 1.2; margin-bottom: 8px; }
.doc-editor .doc-title { font-size: 18px; font-weight: 600; border: 0 !important; background: transparent !important; padding: 4px 2px !important; }
.doc-editor textarea { flex: 1; resize: none; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 13px; min-height: 240px; border: 0 !important; background: var(--surface) !important; border-radius: 12px !important; padding: 14px !important; line-height: 1.6; }

/* 一般頁面元件 */
.section { margin: 18px auto 28px; }
.section > h3 { margin: 0 0 10px; font-size: 15px; font-weight: 600; }
.section > p.desc { margin: -4px 0 12px; color: var(--muted); font-size: 13px; }
.panel { background: var(--surface-2); border-radius: 16px; padding: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.stat { background: var(--surface-2); border-radius: 16px; padding: 14px 16px; }
.stat .k { font-size: 12.5px; color: var(--muted); } .stat .v { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.limit-card { background: var(--surface-2); border-radius: 16px; padding: 16px; }
.limit-card .lc-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.limit-card .lc-title { font-weight: 600; }
.limit-card .lc-sub { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.meter { height: 8px; background: var(--track); border-radius: 99px; overflow: hidden; }
.meter > div { height: 100%; background: var(--bar); border-radius: 99px; transition: width .3s; }
.meter.warn > div { background: var(--warn); } .meter.full > div { background: var(--danger); }
.meter.thin { height: 4px; }
.tbl-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th, table.data td { padding: 9px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
table.data th { color: var(--muted); font-weight: 500; font-size: 12.5px; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.form { display: grid; gap: 16px; }
.form label, .field { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; font-weight: 500; }
.form label .muted, .field .muted { font-weight: 400; font-size: 12.5px; }
.form textarea { min-height: 110px; resize: vertical; }
.form .inline { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.chart { width: 100%; height: 200px; display: block; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .grid { stroke: var(--border); }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
pre.snippet { background: var(--code); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; overflow-x: auto; font-size: 12.5px; margin: 6px 0 16px; font-family: ui-monospace, Consolas, monospace; }
.keybox { font-family: ui-monospace, Consolas, monospace; background: var(--surface-2); padding: 12px; border-radius: 12px; word-break: break-all; margin: 12px 0; font-size: 13px; }
.tabs { display: flex; gap: 4px; margin: 4px auto 8px; border-bottom: 1px solid var(--border); }
.tabs button { background: none; border: 0; padding: 8px 12px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 14px; }
.tabs button.on { color: var(--text); border-bottom-color: var(--text); font-weight: 500; }
.key-row { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.key-row:last-child { border-bottom: 0; }
.key-row .kr-name { font-weight: 600; }
.key-row .kr-meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; }
.key-row .kr-limits { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.kl { font-size: 12px; color: var(--muted); } .kl .meter { margin-top: 4px; }

/* 設定視窗 */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; padding: 16px; z-index: 60; backdrop-filter: blur(2px); }
.modal-box { background: var(--surface); border-radius: 20px; padding: 22px; width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-box.wide { max-width: 760px; padding: 0; display: flex; flex-direction: column; height: min(640px, 88vh); overflow: hidden; }
.modal-box h3 { margin: 0 0 12px; font-size: 17px; font-weight: 600; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.modal-box img.full { max-width: 100%; border-radius: 12px; display: block; }
.set-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 8px; }
.set-head h3 { margin: 0; }
.set-body { flex: 1; display: flex; min-height: 0; }
.set-nav { width: 170px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; }
.set-nav button { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 8px 10px; border-radius: 10px; cursor: pointer; text-align: left; font-size: 14px; color: var(--text-2); }
.set-nav button:hover { background: var(--hover); }
.set-nav button.on { background: var(--active); color: var(--text); }
.set-pane { flex: 1; overflow-y: auto; padding: 8px 22px 22px; }
.set-foot { display: flex; justify-content: flex-end; padding: 12px 20px 16px; border-top: 1px solid var(--border); }
.check-list { display: flex; flex-direction: column; gap: 2px; max-height: 50vh; overflow-y: auto; }
.check-list label { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; cursor: pointer; font-weight: 400; }
.check-list label:hover { background: var(--hover); }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 9px 18px; border-radius: 12px; z-index: 80; font-size: 14px; max-width: calc(100% - 32px); box-shadow: var(--shadow-lg); }

/* 電腦助理：工具卡片 */
.msg.tool { margin-bottom: 10px; }
.tool-card { margin: 0 0 0 34px; border: 1px solid var(--border-2); border-radius: 14px; overflow: hidden; background: var(--surface); }
.tool-head { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; user-select: none; }
.tool-head .ti { width: 28px; height: 28px; border-radius: 8px; background: var(--hover); display: grid; place-items: center; flex-shrink: 0; }
.tool-head .ti svg.i { width: 16px; height: 16px; }
.tool-head .tt { flex: 1; min-width: 0; }
.tool-head .tt1 { font-size: 13.5px; font-weight: 500; }
.tool-head .tt2 { font-size: 12px; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-family: ui-monospace, Consolas, monospace; }
.tool-status { font-size: 12px; white-space: nowrap; }
.tool-body { border-top: 1px solid var(--border); padding: 10px 12px; font-size: 12.5px; }
.tool-body pre { margin: 0; white-space: pre-wrap; word-break: break-all; max-height: 280px; overflow-y: auto; font-family: ui-monospace, Consolas, monospace; color: var(--text-2); }
.tool-body img { max-width: 100%; border-radius: 10px; margin-top: 8px; cursor: zoom-in; }
.tool-approve { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); background: color-mix(in srgb, var(--warn) 7%, transparent); flex-wrap: wrap; }
.tool-approve .grow { font-size: 13px; }
.tool-card.danger .tool-approve { background: color-mix(in srgb, var(--danger) 8%, transparent); }

/* 我的電腦 */
.files-layout { flex: 1; display: flex; min-height: 0; padding: 0 12px 12px; gap: 12px; }
.files-places { width: 200px; flex-shrink: 0; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.files-places .fp-head { font-size: 12px; color: var(--muted); padding: 10px 10px 4px; font-weight: 500; }
.files-main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--surface-2); border-radius: 18px; padding: 12px; gap: 10px; min-height: 0; }
.files-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.files-bar .path-input { flex: 1; min-width: 200px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.files-list { flex: 1; overflow: auto; background: var(--surface); border-radius: 12px; }
.files-list table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.files-list th { position: sticky; top: 0; background: var(--surface); text-align: left; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 8px 12px; border-bottom: 1px solid var(--border); z-index: 1; }
.files-list td { padding: 7px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.files-list tr.f-row { cursor: pointer; }
.files-list tr.f-row:hover td { background: var(--hover); }
.files-list tr.f-row.sel td { background: var(--active); }
.files-list .f-name { display: flex; align-items: center; gap: 8px; max-width: 520px; overflow: hidden; text-overflow: ellipsis; }
.files-list .f-name svg.i { color: var(--muted); }
.files-list .f-name.dir svg.i { color: #d9a400; }
.file-view { flex: 1; display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow: hidden; }
.file-view .fv-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.file-view .fv-title { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-view textarea.editor { flex: 1; resize: none; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 13px; line-height: 1.6; border: 0 !important; border-radius: 12px !important; padding: 14px !important; min-height: 240px; }
.file-view pre.doc { flex: 1; margin: 0; overflow: auto; white-space: pre-wrap; background: var(--surface); border-radius: 12px; padding: 14px; font-size: 13.5px; line-height: 1.7; }
.analysis { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding-right: 2px; }
.analysis .panel { background: var(--surface); }
.data-table { overflow: auto; max-height: 420px; border-radius: 10px; }
.data-table table { border-collapse: collapse; font-size: 12.5px; }
.data-table th, .data-table td { border-bottom: 1px solid var(--border); padding: 5px 10px; white-space: nowrap; text-align: left; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.data-table th { position: sticky; top: 0; background: var(--surface-2); font-weight: 600; }
.data-table td.n { text-align: right; font-variant-numeric: tabular-nums; }
.chart-card { margin-left: 34px; background: var(--surface); border: 1px solid var(--border-2); border-radius: 14px; padding: 14px 16px; }
.chart-card .cc-title { font-weight: 600; margin-bottom: 6px; }
svg.vchart { width: 100%; height: auto; display: block; }
svg.vchart text { fill: var(--muted); font-size: 11px; }
svg.vchart .grid { stroke: var(--border); }

.ws-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 42vw; border: 1px solid var(--border-2); background: var(--surface); border-radius: 99px; padding: 4px 12px 4px 10px; cursor: pointer; font-size: 13px; color: var(--text-2); }
.ws-chip:hover { background: var(--hover); }
.ws-chip span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; direction: rtl; text-align: left; }
.ws-chip.set { border-color: color-mix(in srgb, #16a34a 45%, transparent); color: var(--text); }
.ws-chip.set svg.i { color: #16a34a; }
.ws-recent { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; }


/* ================= 介紹頁 ================= */
.landing { --brand: #6d5dfc; --brand-2: #0ea5e9; background: var(--bg); min-height: 100%; scroll-behavior: smooth; }
:root[data-theme="dark"] .landing { --brand: #8b7dff; --brand-2: #38bdf8; }
html:has(.landing:not([hidden])) { scroll-behavior: smooth; }
.lp-wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.lp-nav { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.lp-nav-in { display: flex; align-items: center; gap: 20px; height: 60px; }
.lp-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; font-size: 17px; }
.lp-brand .logo { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; width: 30px; height: 30px; font-size: 14px; }
.lp-links { display: flex; gap: 22px; margin-left: auto; }
.lp-links a { text-decoration: none; color: var(--text-2); font-size: 14px; }
.lp-links a:hover { color: var(--text); }

.lp-hero { padding: 72px 0 64px; background: radial-gradient(900px 420px at 85% -10%, color-mix(in srgb, var(--brand) 16%, transparent), transparent 70%), radial-gradient(700px 380px at -10% 20%, color-mix(in srgb, var(--brand-2) 12%, transparent), transparent 70%); }
.lp-hero-in { display: grid; grid-template-columns: 1.05fr 1fr; gap: 56px; align-items: center; }
.lp-eyebrow { display: inline-block; font-size: 12.5px; font-weight: 600; color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, transparent); padding: 4px 12px; border-radius: 99px; margin-bottom: 18px; letter-spacing: .02em; }
.lp-hero h1 { font-size: clamp(34px, 5vw, 54px); line-height: 1.12; margin: 0 0 18px; letter-spacing: -.02em; font-weight: 700;
  background: linear-gradient(120deg, var(--text) 30%, var(--brand) 75%, var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lp-lead { font-size: 17px; line-height: 1.75; color: var(--text-2); margin: 0 0 28px; max-width: 34em; }
.lp-cta { display: flex; gap: 10px; flex-wrap: wrap; }
.lp-cta .btn.lg { padding: 11px 22px; text-decoration: none; }
.lp-nav .btn.primary, .lp-cta .btn.primary { background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 70%, var(--brand-2))); border-color: transparent; color: #fff; }
.lp-google { gap: 10px; }
.lp-google svg { background: #fff; border-radius: 50%; padding: 2px; width: 22px; height: 22px; }
.lp-mini { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 22px; font-size: 13px; color: var(--muted); }
.lp-mini span { display: inline-flex; align-items: center; gap: 6px; }
.lp-mini svg.i { width: 15px; height: 15px; color: var(--ok); stroke-width: 2.4; }

.lp-demo { background: var(--surface); border: 1px solid var(--border-2); border-radius: 18px; box-shadow: 0 30px 80px -20px color-mix(in srgb, var(--brand) 35%, transparent), var(--shadow); overflow: hidden; transform: perspective(1400px) rotateY(-4deg) rotateX(2deg); }
.lp-demo-bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.lp-demo-bar span { width: 10px; height: 10px; border-radius: 50%; background: var(--border-2); }
.lp-demo-bar span:nth-child(1) { background: #ff5f57; } .lp-demo-bar span:nth-child(2) { background: #febc2e; } .lp-demo-bar span:nth-child(3) { background: #28c840; }
.lp-demo-bar em { font-style: normal; font-size: 12px; color: var(--muted); margin-left: 8px; }
.lp-demo-body { padding: 18px; display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; }
.lp-d-user { align-self: flex-end; background: var(--bubble); padding: 9px 14px; border-radius: 18px; max-width: 85%; }
.lp-d-tool { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border-2); border-radius: 12px; padding: 7px 12px; font-size: 12.5px; color: var(--text-2); }
.lp-d-tool svg.i { width: 15px; height: 15px; color: var(--brand); }
.lp-d-tool b { margin-left: auto; color: var(--ok); font-weight: 500; font-size: 12px; }
.lp-d-ai p { margin: 10px 0 0; line-height: 1.6; }
.lp-d-chart { display: flex; align-items: flex-end; gap: 10px; height: 120px; padding: 10px 6px 0; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.lp-d-chart span { flex: 1; height: var(--h); background: linear-gradient(180deg, var(--brand), var(--brand-2)); border-radius: 6px 6px 0 0; position: relative; min-height: 8px; }
.lp-d-chart span::after { content: attr(data-l); position: absolute; left: 0; right: 0; bottom: -19px; text-align: center; font-size: 11px; color: var(--muted); }

.lp-section { padding: 84px 0; }
.lp-alt { background: var(--surface-2); }
.lp-section h2 { font-size: clamp(26px, 3.4vw, 36px); text-align: center; margin: 0 0 12px; letter-spacing: -.015em; }
.lp-sub { text-align: center; color: var(--text-2); font-size: 16px; line-height: 1.7; max-width: 40em; margin: 0 auto 44px; }
.lp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.lp-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 24px; transition: transform .2s, box-shadow .2s, border-color .2s; }
.lp-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--brand) 35%, var(--border)); }
.lp-card h3 { margin: 14px 0 8px; font-size: 17px; }
.lp-card p { margin: 0; color: var(--text-2); line-height: 1.7; font-size: 14.5px; }
.lp-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); }
.lp-ic svg.i { width: 21px; height: 21px; }

.lp-split { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: center; }
.lp-split h2 { text-align: left; }
.lp-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.lp-list li { display: flex; gap: 10px; align-items: center; font-size: 15px; }
.lp-list svg.i { color: var(--ok); stroke-width: 2.4; width: 17px; height: 17px; }
.lp-term { background: #0f1117; color: #e5e7eb; border-radius: 16px; overflow: hidden; box-shadow: 0 30px 70px -25px rgba(0,0,0,.45); font-size: 13px; }
.lp-term-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: #181b24; color: #9ca3af; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.lp-term-bar svg.i { width: 15px; height: 15px; color: #4ade80; }
.lp-term-body { padding: 18px; display: grid; gap: 10px; }
.lp-term .u { justify-self: end; background: #262a36; padding: 8px 13px; border-radius: 14px; }
.lp-term .t { display: flex; align-items: center; gap: 8px; border: 1px solid #2a2f3c; border-radius: 10px; padding: 7px 11px; color: #cbd5e1; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.lp-term .t svg.i { width: 14px; height: 14px; color: #a78bfa; }
.lp-term .t b { margin-left: auto; color: #4ade80; font-weight: 500; font-family: inherit; }
.lp-term .a { line-height: 1.65; color: #e5e7eb; }

.lp-models { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.lp-model { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 18px; }
.lp-model .mn { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 10px; }
.lp-model .mn .avatar { width: 32px; height: 32px; font-size: 11px; }
.lp-model .md { color: var(--text-2); font-size: 13.5px; margin: 10px 0; line-height: 1.6; min-height: 2.6em; }
.lp-model .chips { display: flex; gap: 6px; flex-wrap: wrap; }

.lp-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.lp-step { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 24px; }
.lp-step b { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; font-size: 14px; }
.lp-step h3 { margin: 14px 0 6px; font-size: 17px; }
.lp-step p { margin: 0; color: var(--text-2); font-size: 14.5px; line-height: 1.7; }

.lp-final { padding: 88px 0; text-align: center; background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 14%, var(--bg)), color-mix(in srgb, var(--brand-2) 12%, var(--bg))); }
.lp-final h2 { font-size: clamp(28px, 4vw, 40px); margin: 0 0 10px; }
.lp-final p { color: var(--text-2); margin: 0 0 26px; font-size: 16px; }
.lp-final .btn.primary { background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 70%, var(--brand-2))); border-color: transparent; color: #fff; padding: 12px 28px; }
.lp-foot { padding: 28px 0; color: var(--muted); font-size: 13px; text-align: center; border-top: 1px solid var(--border); }

@media (max-width: 900px) {
  .lp-hero-in, .lp-split { grid-template-columns: 1fr; gap: 36px; }
  .lp-demo { transform: none; }
  .lp-grid, .lp-steps { grid-template-columns: 1fr; }
  .lp-links { display: none; }
  .lp-nav-in .btn { margin-left: auto; }
  .lp-hero { padding: 44px 0; } .lp-section { padding: 60px 0; }
}
@media (min-width: 901px) and (max-width: 1080px) { .lp-grid { grid-template-columns: repeat(2, 1fr); } }


/* 影音附件 */
.att-list { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 4px 34px; }
.att-list.user { margin: 0 0 6px; justify-content: flex-end; }
.att { position: relative; border-radius: 14px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); }
.att-img { width: min(320px, 100%); }
.att-img img { width: 100%; display: block; cursor: zoom-in; }
.att-img .att-dl { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.55); color: #fff; opacity: 0; transition: opacity .15s; }
.att-img:hover .att-dl { opacity: 1; }
.att-av { width: min(480px, 100%); }
.att-av video { width: 100%; max-height: 360px; display: block; background: #000; }
.att-av audio { width: 100%; display: block; padding: 0 10px 10px; box-sizing: border-box; }
.att-foot { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 13px; }
.att-foot svg.i { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
.att-n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-foot .att-dl { width: 28px; height: 28px; }
.att-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 280px; padding: 6px 8px 6px 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; }
.att-chip svg.i { width: 15px; height: 15px; color: var(--muted); }
.att-chip .ac-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.att-chip button { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0; display: grid; place-items: center; }
.att-chip button svg.i { width: 13px; height: 13px; }
.tool-minis { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 8px 34px; }
.tool-mini { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border-2); border-radius: 12px; padding: 7px 12px; font-size: 13px; max-width: 560px; }
.tool-mini svg.i { width: 15px; height: 15px; color: var(--muted); flex-shrink: 0; }
.tool-mini .tm-l { font-weight: 500; white-space: nowrap; }
.tool-mini .tm-d { flex: 1; min-width: 0; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-mini .tm-s { margin-left: auto; font-size: 12px; color: var(--ok); white-space: nowrap; }
.tool-mini.error .tm-s { color: var(--danger); }
.tool-mini.running { border-color: color-mix(in srgb, #3b82f6 40%, var(--border-2)); }
.tm-err { font-size: 12.5px; color: var(--danger); margin: -2px 0 0 12px; }
@media (max-width: 860px) { .att-list, .tool-minis { margin-left: 0; } }

/* 手機 */
@media (max-width: 860px) {
  .sb-open { display: inline-flex; }
  .sidebar { position: fixed; z-index: 50; top: 0; bottom: 0; left: 0; margin-left: -270px; transition: margin-left .2s; box-shadow: var(--shadow-lg); }
  .app.sb-mobile-open .sidebar { margin-left: 0; }
  .app.sb-mobile-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 40; }
  .docs-layout { flex-direction: column; }
  .docs-list-pane { width: 100%; max-height: 42%; }
  .msg.user .bubble { max-width: 90%; }
  .msg.assistant .bubble, .thinking, .tool-card, .error-box { margin-left: 0; padding-left: 0; }
  .msg-actions { margin-left: 0; opacity: 1; }
  .set-body { flex-direction: column; }
  .set-nav { width: auto; flex-direction: row; overflow-x: auto; }
  .model-pop { width: calc(100vw - 24px); }
  .greeting h1 { font-size: 23px; }
}
