/* Kojo chat page. Colors are tokens on :root; dark mode follows the OS unless the visitor picked a theme. */
@font-face {
  font-family: "Hasklig";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("vendor/fonts/Hasklig-Bold-Latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212;
}
:root {
  --bg: #ffffff;
  --bg-soft: #f7f6fc;
  --bg-sidebar: #f6f4fc;
  --bg-hover: #ece9f7;
  --bg-active: #e3dff3;
  --bg-input: #f4f2fa;
  --bg-user: #efecf9;
  --bg-code: #f7f6fc;
  --border: #e4e0f2;
  --text: #1a1540;
  --text-soft: #57517f;
  --text-faint: #8e89ae;
  --accent: #4c3be6;
  --accent-text: #f4f1fc;
  --accent-wash: rgba(76, 59, 230, .12);
  --danger: #c0392b;
  --danger-bg: #fdecea;
  --shadow: 0 1px 2px rgba(26, 21, 64, .06), 0 4px 16px rgba(26, 21, 64, .07);
  --radius: 14px;
  --font: ui-sans-serif, -apple-system, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --wordmark: "Hasklig", "Source Code Pro", ui-monospace, SFMono-Regular, Menlo, monospace;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #13102b; --bg-soft: #1a1636; --bg-sidebar: #0f0c24; --bg-hover: #241f45; --bg-active: #2c2652;
    --bg-input: #1e1a3c; --bg-user: #252046; --bg-code: #0d0a20; --border: #2a2550; --text: #efebff;
    --text-soft: #b4aed6; --text-faint: #7f79a6; --accent: #9d8fff; --accent-text: #110d2e; --accent-wash: rgba(157, 143, 255, .14);
    --danger: #ff8a7a; --danger-bg: #3a1d1a; --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #13102b; --bg-soft: #1a1636; --bg-sidebar: #0f0c24; --bg-hover: #241f45; --bg-active: #2c2652;
  --bg-input: #1e1a3c; --bg-user: #252046; --bg-code: #0d0a20; --border: #2a2550; --text: #efebff;
  --text-soft: #b4aed6; --text-faint: #7f79a6; --accent: #9d8fff; --accent-text: #110d2e; --accent-wash: rgba(157, 143, 255, .14);
  --danger: #ff8a7a; --danger-bg: #3a1d1a; --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--font); -webkit-font-smoothing: antialiased; overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: var(--accent); }
svg { display: block; }
[hidden] { display: none !important; }

.app { display: flex; height: 100dvh; width: 100%; }

/* ---------- sidebar ---------- */
.sidebar { width: 260px; flex: none; background: var(--bg-sidebar); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 10px 8px; 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; }
.brand { display: flex; align-items: center; gap: 9px; font: 700 19px/1 var(--wordmark); letter-spacing: -.02em; color: var(--text); text-decoration: none; padding: 4px 6px; border-radius: 10px; }
.logo { width: 24px; height: 26px; color: var(--accent); flex: none; }
.logo svg, .avatar svg { width: 100%; height: 100%; fill: currentColor; overflow: visible; }
.new-chat { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; font-size: 14px; font-weight: 550; margin-bottom: 8px; }
.new-chat:hover, .sb-link:hover, .conv:hover { background: var(--bg-hover); }
.conv-list { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.conv-group { font-size: 12px; font-weight: 600; color: var(--text-faint); padding: 14px 10px 6px; }
.conv { display: flex; align-items: center; gap: 4px; border-radius: 10px; padding: 0 4px 0 10px; height: 38px; position: relative; }
.conv.active { background: var(--bg-active); }
.conv a { flex: 1; min-width: 0; color: var(--text); text-decoration: none; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 38px; }
.conv input { flex: 1; min-width: 0; font: inherit; font-size: 14px; color: var(--text); background: var(--bg); border: 1px solid var(--accent); border-radius: 6px; padding: 3px 6px; outline: none; }
.conv .conv-actions { display: none; gap: 2px; }
.conv:hover .conv-actions, .conv.active .conv-actions, .conv:focus-within .conv-actions { display: flex; }
.conv .icon-btn { width: 28px; height: 28px; }
.conv-empty { color: var(--text-faint); font-size: 13px; padding: 10px; }
.sb-bottom { border-top: 1px solid var(--border); padding-top: 8px; display: flex; flex-direction: column; gap: 2px; }
.sb-link { display: flex; align-items: center; gap: 10px; text-align: left; padding: 8px 10px; border-radius: 10px; font-size: 14px; color: var(--text-soft); }
.sb-note { font-size: 12px; color: var(--text-faint); padding: 8px 10px 2px; }
.sb-note a { color: inherit; }

.icon-btn { width: 36px; height: 36px; border-radius: 9px; display: inline-grid; place-items: center; color: var(--text-soft); flex: none; }
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- main ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.topbar { height: 52px; flex: none; display: flex; align-items: center; gap: 6px; padding: 0 10px; }
.top-title { flex: 1; min-width: 0; font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-soft); }
.app:not(.sb-collapsed) #sb-open { visibility: hidden; }
#top-new { visibility: hidden; }
.app.sb-collapsed #top-new { visibility: visible; }
.thread { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.thread-inner { max-width: 780px; margin: 0 auto; padding: 8px 20px 40px; }

/* empty state */
.hello { min-height: calc(100dvh - 260px); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; }
.hello-mark { width: min(340px, 72vw); height: auto; color: var(--accent); fill: currentColor; overflow: visible; margin-bottom: 18px; -webkit-tap-highlight-color: transparent; }
.hello-mark .b { cursor: pointer; transform-box: fill-box; transform-origin: center; }
.hello-mark .b.wave { animation: wave .5s cubic-bezier(.3, 1.5, .5, 1) var(--delay) both; }
.hello-mark .ring { fill: none; stroke: currentColor; transform-box: fill-box; transform-origin: center; pointer-events: none; animation: ring .9s cubic-bezier(.2, .6, .3, 1) var(--delay) both; }
@keyframes wave { 0%, 100% { transform: scale(1); } 40% { transform: scale(.82); } }
@keyframes ring { from { transform: scale(1); opacity: .55; stroke-width: 6; } to { transform: scale(var(--grow)); opacity: 0; stroke-width: 1; } }
.hello h1 { font-size: 28px; font-weight: 650; margin: 0; letter-spacing: -.01em; }
.hello p { margin: 0; color: var(--text-soft); }
.suggestions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 26px; width: 100%; max-width: 640px; }
.suggestion { text-align: left; border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; font-size: 14px; color: var(--text-soft); line-height: 1.4; }
.suggestion b { display: block; color: var(--text); font-weight: 600; margin-bottom: 2px; }
.suggestion:hover { background: var(--bg-soft); }

/* messages */
.msg { margin: 22px 0; }
.msg.user { display: flex; flex-direction: column; align-items: flex-end; }
.msg.user .bubble { background: var(--bg-user); border-radius: 20px; padding: 10px 16px; max-width: 85%; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.msg.user .bubble .imgs { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; margin-bottom: 6px; }
.msg.user .bubble .imgs img { max-height: 180px; max-width: 240px; border-radius: 12px; display: block; cursor: zoom-in; }
.msg.user .bubble .imgs:last-child { margin-bottom: 0; }
.msg.user .edit-box { width: 100%; max-width: 85%; background: var(--bg-user); border-radius: 20px; padding: 12px 14px; }
.msg.user .edit-box textarea { width: 100%; resize: none; border: 0; outline: none; background: transparent; font: inherit; color: var(--text); min-height: 60px; }
.edit-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.btn { border-radius: 999px; padding: 6px 14px; font-size: 14px; font-weight: 550; border: 1px solid var(--border); background: var(--bg); }
.btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn:hover { opacity: .88; }

.msg.assistant { display: flex; gap: 14px; }
.msg.assistant .avatar { width: 24px; height: 26px; color: var(--accent); flex: none; margin-top: 2px; }
.msg.assistant .body { flex: 1; min-width: 0; }
.msg-actions { display: flex; gap: 2px; margin-top: 4px; opacity: 0; transition: opacity .15s; }
.msg:hover .msg-actions, .msg.last .msg-actions, .msg-actions:focus-within { opacity: 1; }
.msg-actions .icon-btn { width: 30px; height: 30px; }
.msg-actions .icon-btn svg { width: 16px; height: 16px; }
.msg-actions .icon-btn.on { color: var(--accent); }
.msg.user .msg-actions { justify-content: flex-end; }
.msg-note { font-size: 13px; color: var(--text-faint); margin-top: 6px; font-style: italic; }
.msg-error { margin-top: 8px; background: var(--danger-bg); color: var(--danger); border-radius: 10px; padding: 8px 12px; font-size: 14px; }

/* thinking */
.thinking { margin: 0 0 8px; }
.thinking summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; color: var(--text-faint); font-size: 14px; user-select: none; }
.thinking summary::-webkit-details-marker { display: none; }
.thinking summary svg { width: 14px; height: 14px; transition: transform .15s; }
.thinking[open] summary svg { transform: rotate(90deg); }
.thinking .thinking-text { border-left: 2px solid var(--border); margin: 8px 0 4px 6px; padding: 2px 0 2px 14px; color: var(--text-soft); font-size: 14px; white-space: pre-wrap; max-height: 320px; overflow-y: auto; }
.shimmer { animation: pulse 1.6s ease-in-out infinite; }       /* opacity only: runs on the compositor, no repaints */
@keyframes pulse { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
.dots { display: inline-flex; gap: 4px; padding: 10px 0; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); animation: dot 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { opacity: .25; transform: scale(.85); } 40% { opacity: 1; transform: scale(1); } }

/* markdown */
.md { overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md blockquote, .md table, .md pre { margin: 0 0 14px; }
.md h1, .md h2, .md h3, .md h4 { line-height: 1.3; margin: 22px 0 10px; font-weight: 650; }
.md h1 { font-size: 1.5em; } .md h2 { font-size: 1.3em; } .md h3 { font-size: 1.12em; } .md h4 { font-size: 1em; }
.md ul, .md ol { padding-left: 1.5em; }
.md li { margin: 4px 0; }
.md li > p { margin: 0 0 6px; }
.md blockquote { border-left: 3px solid var(--border); padding-left: 14px; color: var(--text-soft); }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
.md a { text-decoration: underline; text-underline-offset: 2px; }
.md img { max-width: 100%; border-radius: 10px; }
.md :not(pre) > code { font-family: var(--mono); font-size: .875em; background: var(--bg-hover); padding: .15em .35em; border-radius: 5px; }
.md table { border-collapse: collapse; display: block; overflow-x: auto; max-width: 100%; font-size: 14px; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 12px; text-align: left; vertical-align: top; }
.md th { background: var(--bg-soft); font-weight: 600; }
.md .katex-display { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.code-block { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin: 0 0 14px; background: var(--bg-code); }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 4px 14px; font-size: 12px; color: var(--text-faint); border-bottom: 1px solid var(--border); font-family: var(--mono); }
.code-actions { display: flex; gap: 2px; }
.code-actions button { font-family: var(--font); font-size: 12px; color: var(--text-soft); display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 7px; }
.code-actions button:hover { background: var(--bg-hover); color: var(--text); }
.code-actions svg { width: 14px; height: 14px; }
.code-block pre { margin: 0; padding: 14px 16px; overflow-x: auto; font: 13.5px/1.55 var(--mono); }
.code-block pre code.hljs { background: transparent; padding: 0; }

/* scroll-to-bottom */
.to-bottom { position: absolute; left: 50%; transform: translateX(-50%); bottom: 150px; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border); background: var(--bg); box-shadow: var(--shadow); display: grid; place-items: center; color: var(--text-soft); z-index: 3; }
.to-bottom svg { width: 18px; height: 18px; }

/* composer */
.composer-wrap { flex: none; padding: 0 20px 10px; max-width: 820px; width: 100%; margin: 0 auto; }
.composer { background: var(--bg-input); border: 1px solid var(--border); border-radius: 26px; padding: 8px; box-shadow: var(--shadow); }
.composer:focus-within { border-color: var(--text-faint); }
.composer-row { display: flex; align-items: flex-end; gap: 6px; }
.composer textarea { flex: 1; resize: none; border: 0; outline: none; background: transparent; color: var(--text); font: inherit; line-height: 1.5; padding: 7px 4px; max-height: 220px; min-height: 38px; }
.composer textarea::placeholder { color: var(--text-faint); }
.composer .attach { border-radius: 50%; }
.send-btn { width: 36px; height: 36px; border-radius: 50%; background: var(--text); color: var(--bg); display: grid; place-items: center; flex: none; }
.send-btn:disabled { opacity: .3; cursor: default; }
.send-btn svg { width: 18px; height: 18px; }
.attachments { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 4px 8px; }
.attachments:empty { display: none; }
.att { position: relative; width: 64px; height: 64px; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); }
.att img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att button { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; background: rgba(0, 0, 0, .65); color: #fff; display: grid; place-items: center; }
.att button svg { width: 12px; height: 12px; }
.fineprint { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 14px; text-align: center; font-size: 12px; color: var(--text-faint); padding: 8px 0 0; }
.usage { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.usage-bar { width: 54px; height: 5px; border-radius: 3px; background: var(--bg-active); overflow: hidden; }
.usage-bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width .4s ease; }
.usage.warn { color: #b7791f; } .usage.warn .usage-bar i { background: #d69e2e; }
.usage.full { color: var(--danger); } .usage.full .usage-bar i { background: var(--danger); }
.notice { background: var(--danger-bg); color: var(--danger); border-radius: 12px; padding: 8px 14px; font-size: 14px; margin-bottom: 8px; }

/* preview drawer */
.preview { width: clamp(360px, 48vw, 860px); flex: none; border-left: 1px solid var(--border); display: flex; flex-direction: column; background: var(--bg); }
.preview-head { height: 52px; display: flex; align-items: center; justify-content: space-between; padding: 0 8px 0 16px; border-bottom: 1px solid var(--border); }
.preview-title { font-weight: 600; font-size: 15px; }
.preview-actions { display: flex; gap: 2px; }
.preview-body { flex: 1; background: #fff; }
.preview-body iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }

/* misc */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 10px; font-size: 14px; z-index: 50; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }
.drop-overlay { position: fixed; inset: 0; background: var(--accent-wash); border: 3px dashed var(--accent); z-index: 40; display: grid; place-items: center; font-size: 18px; font-weight: 600; color: var(--accent); pointer-events: none; }
.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, .85); z-index: 60; display: grid; place-items: center; cursor: zoom-out; }
.lightbox img { max-width: 94vw; max-height: 94vh; border-radius: 8px; }
.scrim { display: none; }

/* ---------- small screens ---------- */
@media (max-width: 820px) {
  .sidebar { position: fixed; z-index: 30; top: 0; bottom: 0; left: 0; width: 280px; box-shadow: var(--shadow); }
  .app.sb-collapsed .sidebar { margin-left: -290px; box-shadow: none; }
  .app:not(.sb-collapsed) .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 20; }
  .app #sb-open { visibility: visible !important; }
  #top-new { visibility: visible !important; }
  .thread-inner { padding: 8px 16px 32px; }
  .composer-wrap { padding: 0 12px calc(8px + env(safe-area-inset-bottom)); }
  .suggestions { grid-template-columns: 1fr; }
  .suggestion:nth-child(n+3) { display: none; }
  .hello { min-height: calc(100dvh - 240px); }
  .msg.user .bubble, .msg.user .edit-box { max-width: 92%; }
  .msg.assistant { gap: 10px; }
  .msg.assistant .avatar { display: none; }
  .msg-actions { opacity: 1; }
  .preview { position: fixed; inset: 0; width: 100%; z-index: 35; }
  .to-bottom { bottom: 140px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* versions, comparisons, feedback */
.pager { display: inline-flex; align-items: center; gap: 0; margin-right: 4px; font-size: 13px; color: var(--text-faint); }
.pager .icon-btn { width: 26px; height: 26px; }
.pager .icon-btn:disabled { opacity: .35; cursor: default; background: none; }
.pager-n { min-width: 34px; text-align: center; font-variant-numeric: tabular-nums; }
.msg.user.last-user .msg-actions { opacity: 1; }
.edit-note { flex: 1; font-size: 12px; color: var(--text-faint); align-self: center; }
.btn.small { padding: 3px 12px; font-size: 13px; }
.compare { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 12px; font-size: 14px; color: var(--text-soft); }
.compare span { flex: 1 1 200px; }
.msg.assistant.ab .body { min-width: 0; }
.ab-head { font-size: 15px; margin-bottom: 10px; color: var(--text-soft); }
.ab-head b { color: var(--text); font-weight: 600; }
.ab-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ab-col { border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; min-width: 0; }
.ab-label { font-size: 12px; font-weight: 600; color: var(--text-faint); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; }
.ab-body { flex: 1; min-width: 0; font-size: 15px; }
.ab-pick { margin-top: 12px; align-self: stretch; }
.ab-pick:hover { border-color: var(--accent); color: var(--accent); }
.ab-foot { text-align: center; margin-top: 8px; }
.ab-skip { font-size: 13px; color: var(--text-faint); text-decoration: underline; text-underline-offset: 2px; }
.reason { margin-top: 10px; border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; }
.reason-title { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip { border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; font-size: 13px; color: var(--text-soft); }
.chip:hover { background: var(--bg-hover); }
.chip.on { border-color: var(--accent); color: var(--accent); background: var(--bg-soft); }
.reason textarea { width: 100%; resize: vertical; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; font-size: 14px; padding: 8px 10px; outline: none; }
@media (max-width: 900px) {
  .ab-grid { grid-template-columns: 1fr; }
}

/* sharing */
.modal { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, .45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-card { width: 100%; max-width: 520px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 18px; padding: 22px 22px 16px; box-shadow: var(--shadow); }
.modal-card h2 { margin: 0 0 8px; font-size: 19px; font-weight: 650; }
.modal-card p { margin: 0 0 16px; color: var(--text-soft); font-size: 14.5px; line-height: 1.5; }
.share-row { display: flex; gap: 8px; }
.share-row input { flex: 1; min-width: 0; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-input); color: var(--text); font: inherit; font-size: 14px; padding: 8px 12px; outline: none; }
.modal-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; }
.shared-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--border); border-radius: 18px; padding: 12px 14px 12px 18px; background: var(--bg-input); font-size: 14.5px; color: var(--text-soft); }

/* Empero account */
.account { display: flex; flex-direction: column; gap: 4px; padding: 4px 4px 8px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.account .signin { text-align: center; text-decoration: none; padding: 8px 14px; }
.account a.sb-link { text-decoration: none; justify-content: center; font-size: 13px; }
.who { display: flex; align-items: center; gap: 10px; padding: 6px 10px; font-size: 14px; min-width: 0; }
.who-dot { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-text); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.who-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nudge { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--border); border-radius: 16px; padding: 12px 14px 12px 18px; margin-bottom: 8px; background: var(--bg-soft); font-size: 14px; color: var(--text-soft); }
.nudge-text b { color: var(--text); font-weight: 600; }
.nudge-actions { display: flex; gap: 8px; }
.nudge-actions a { text-decoration: none; }

/* settings: instructions, skills, API keys and usage (signed in) */
.settings-card { max-width: 640px; max-height: min(88dvh, 780px); min-height: min(560px, 88dvh); display: flex; flex-direction: column; padding: 18px 20px 18px; }
.settings-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.settings-head h2 { margin: 0; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 10px 0 14px; overflow-x: auto; scrollbar-width: none; flex: none; }
.tabs button { padding: 8px 12px; font-size: 14px; color: var(--text-soft); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; border-radius: 0; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.settings-body { overflow-y: auto; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; padding: 2px; }
.settings-body > p, .settings-intro { margin: 0; color: var(--text-soft); font-size: 14.5px; line-height: 1.5; }
.settings-loading { color: var(--text-faint); font-size: 14px; padding: 18px 0; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text); }
.field textarea, .settings-body input:not([type="checkbox"]):not([type="file"]) { width: 100%; min-width: 0; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-input); color: var(--text); font: inherit; font-size: 14px; padding: 8px 12px; outline: none; }
.field textarea { resize: vertical; min-height: 150px; line-height: 1.5; }
.field textarea:focus, .settings-body input:focus { border-color: var(--accent); }
.field-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.field-foot .grow, .usage-line .grow { flex: 1; }
.field-foot a.btn { text-decoration: none; }
.count, .save-status, .hint, .faint { color: var(--text-faint); font-size: 13px; }
.hint { margin: 0; line-height: 1.45; }
.btn:disabled { opacity: .45; cursor: default; }
.link-btn { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; font-size: inherit; padding: 0; }
.skill-or { font-size: 13.5px; color: var(--text-soft); margin-top: -4px; }
.skill-note { font-size: 13.5px; color: var(--text-soft); background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.skill-note.bad { color: var(--danger); background: var(--danger-bg); border-color: transparent; }
.skills, .keys { display: flex; flex-direction: column; gap: 8px; }
.skill { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--border); border-radius: 12px; padding: 10px 10px 10px 14px; }
.skill.off .skill-main { opacity: .55; }
.skill-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.skill-name { font: 600 13.5px/1.3 var(--mono); color: var(--text); overflow-wrap: anywhere; }
.tag { font: 600 11px/1 var(--font); padding: 3px 7px; border-radius: 999px; background: var(--bg-active); color: var(--text-soft); margin-left: 8px; vertical-align: 1px; }
.skill-desc { font-size: 13.5px; color: var(--text-soft); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.skill-meta { font-size: 12.5px; color: var(--text-faint); overflow-wrap: anywhere; }
.skill-meta a { color: inherit; }
.skill-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.empty { color: var(--text-faint); font-size: 14px; padding: 6px 2px; }
.switch { appearance: none; -webkit-appearance: none; width: 36px; height: 21px; border-radius: 999px; background: var(--bg-active); position: relative; cursor: pointer; margin: 0; transition: background .15s; flex: none; }
.switch::before { content: ""; position: absolute; top: 2.5px; left: 2.5px; width: 16px; height: 16px; border-radius: 50%; background: var(--bg); box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s; }
.switch:checked { background: var(--accent); }
.switch:checked::before { transform: translateX(15px); }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.settings-section { display: flex; flex-direction: column; gap: 8px; }
.settings-section + .settings-section { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 4px; }
.usage-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; }
.meter { display: block; height: 6px; border-radius: 999px; background: var(--bg-active); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.usage-table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-top: 4px; }
.usage-table th, .usage-table td { text-align: left; padding: 6px 8px 6px 0; border-bottom: 1px solid var(--border); font-weight: 400; white-space: nowrap; }
.usage-table thead th { color: var(--text-faint); font-size: 12.5px; }
.usage-table tbody th { color: var(--text-soft); }
.usage-table b { font-weight: 600; }
.soon { font-size: 12px; font-weight: 650; padding: 2px 9px; border-radius: 999px; background: var(--accent-wash); color: var(--accent); }
.new-key { display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--accent); border-radius: 12px; padding: 10px 12px; background: var(--accent-wash); }
.new-key input { font-family: var(--mono) !important; font-size: 13px !important; }
@media (max-width: 560px) {
  .settings-card { padding: 16px 14px 14px; max-height: 92dvh; }
  .usage-table .faint { display: none; }
}
