/* Effifs AI web chat — styles.
   Fonts: Exo 2, Inter, Sora, JetBrains Mono (SIL Open Font License 1.1, see fonts/OFL.txt). */

@font-face { font-family: 'Exo 2'; font-style: italic; font-weight: 800; font-display: swap; src: url(fonts/exo2-800i-latin.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap; src: url(fonts/inter-latin.woff2) format('woff2'); }
@font-face { font-family: 'Sora'; font-style: normal; font-weight: 100 800; font-display: swap; src: url(fonts/sora-latin.woff2) format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 100 800; font-display: swap; src: url(fonts/jetbrainsmono-latin.woff2) format('woff2'); }

:root {
  --bg: #060B26;
  --side: #081033;
  --line: #16235C;
  --line-soft: #111C4E;
  --text: #EAF0FF;
  --text-2: #DCE3F7;
  --text-3: #C3CCE8;
  --muted: #A3AFD6;
  --muted-2: #8792BE;
  --icon: #8F9BC6;
  --gold: #F4C24D;
  --gold-ink: #1A1200;
  --blue: #6CC4FF;
  --link: #8FD0FF;
  --s1: #0B1542;
  --s1-line: #1C2B68;
  --s2: #0C1640;
  --s2-line: #1A2860;
  --bubble: #13215A;
  --bubble-line: #23367E;
  --hover: #111D4E;
  --item-hover: #0F1A48;
  --active: #13215A;
  --active-line: #22347A;
  --composer: #0D1845;
  --composer-line: #24367C;
  --focus-line: #3A63C8;
  --pop: #0E1A4A;
  --pop-hover: #16245F;
  --code-bg: #040A26;
  --code-head: #0A1440;
  --code-inline: #12205A;
  --code-text: #CFE0FF;
  --danger: #FF9A9A;
  --danger-bg: rgba(255, 99, 99, 0.09);
  --danger-line: rgba(255, 120, 120, 0.32);
  --ok: #9FE3C1;
  --font: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-head: Sora, Inter, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --side-w: 288px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: default; }
a { color: var(--link); }
a:hover { color: #C4E6FF; }
img { display: block; }
:focus-visible { outline: 2px solid #4DB3FF; outline-offset: 2px; }
::placeholder { color: #8792BE; opacity: 1; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
.noscript { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--text); background: var(--bg); }

/* ------------------------------------------------------------------ layout */

.app { height: 100vh; height: 100dvh; display: flex; overflow: hidden; background: var(--bg); transition: opacity .25s ease; }
.app.booting { opacity: 0; }

.side {
  width: var(--side-w); flex: 0 0 var(--side-w);
  display: flex; flex-direction: column; gap: 14px;
  padding: 16px 14px 14px; background: var(--side); border-right: 1px solid var(--line);
  min-height: 0;
}
.app.side-collapsed .side { display: none; }
.scrim { display: none; }

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; position: relative; }
.m-only { display: none !important; }

/* ------------------------------------------------------------------ brand */

.brand { display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-width: 0; text-decoration: none; color: inherit; padding-left: 4px; }
.wordmark { font-family: 'Exo 2', Sora, sans-serif; font-style: italic; font-weight: 800; font-size: 21px; letter-spacing: .02em; white-space: nowrap; line-height: 1; }
.wm-a { color: var(--gold); }
.wm-b { color: var(--blue); }
.ava { flex: none; border-radius: 50%; overflow: hidden; background: #0A1E5E; box-shadow: 0 0 0 1px #2A4BA8, 0 0 16px rgba(77, 179, 255, .35); }
.ava img { width: 100%; height: 100%; object-fit: cover; }
.ava-36 { width: 36px; height: 36px; }
.ava-34 { width: 34px; height: 34px; box-shadow: 0 0 0 1px #2A4BA8, 0 0 14px rgba(77, 179, 255, .35); }
.ava-30 { width: 30px; height: 30px; }
.ava.glow { animation: avaGlow 1.6s ease-in-out infinite; }
@keyframes avaGlow { 50% { box-shadow: 0 0 0 1px #3A63C8, 0 0 22px rgba(77, 179, 255, .7); } }

/* ------------------------------------------------------------------ buttons */

.ib {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center;
  border-radius: 10px; color: var(--icon); transition: background .15s, color .15s;
}
.ib:hover { background: var(--hover); color: var(--text); }
.ib-sm { width: 34px; height: 34px; }
.ib-sm .ic { width: 16px; height: 16px; }
.ib.on { color: var(--gold); }

.btn-gold {
  height: 46px; display: flex; align-items: center; justify-content: center; gap: 9px;
  border-radius: 12px; background: var(--gold); color: var(--gold-ink); font-weight: 600; font-size: 14.5px;
  box-shadow: 0 6px 22px rgba(244, 194, 77, .22); transition: filter .15s, transform .15s;
}
.btn-gold .ic { width: 18px; height: 18px; }
.btn-gold:hover { filter: brightness(1.07); }
.btn-gold:active { transform: translateY(1px); }

.btn-line {
  height: 44px; display: inline-flex; align-items: center; gap: 8px; padding: 0 16px;
  border: 1px solid var(--active-line); border-radius: 12px; color: var(--text-2); font-size: 14px; font-weight: 500;
  transition: background .15s;
}
.btn-line .ic { width: 17px; height: 17px; }
.btn-line:hover { background: var(--hover); color: var(--text); }

.btn { height: 40px; padding: 0 16px; border-radius: 11px; font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: filter .15s, background .15s; }
.btn .ic { width: 17px; height: 17px; }
.btn-primary { background: var(--gold); color: var(--gold-ink); }
.btn-primary:hover { filter: brightness(1.07); }
.btn-ghost { border: 1px solid var(--active-line); color: var(--text-2); }
.btn-ghost:hover { background: var(--hover); }
.btn-danger { background: #E25C5C; color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }
.btn-warn { color: var(--danger); border-color: var(--danger-line); }
.app:not(.side-collapsed) #sideOpen { display: none; }

.seg { display: flex; align-items: center; gap: 2px; padding: 3px; height: 44px; background: var(--s2); border: 1px solid var(--s2-line); border-radius: 12px; }
.seg button { height: 36px; min-width: 44px; padding: 0 12px; border-radius: 9px; color: var(--muted); font-size: 13px; font-weight: 600; letter-spacing: .04em; transition: background .15s, color .15s; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: #1E2F72; color: #fff; }
.seg-side { flex: none; }
.seg-side button { flex: 1; letter-spacing: 0; font-weight: 500; }

.kbd { font: 500 11px/1 var(--font); color: var(--muted-2); border: 1px solid var(--s2-line); border-radius: 6px; padding: 4px 6px; }

/* ------------------------------------------------------------------ sidebar */

.side-top { display: flex; align-items: center; gap: 10px; height: 44px; padding-right: 2px; }
.new-chat { flex: none; }
.search {
  flex: none; display: flex; align-items: center; gap: 9px; height: 44px; padding: 0 10px 0 12px;
  background: var(--s2); border: 1px solid var(--s2-line); border-radius: 11px; color: var(--icon);
  transition: border-color .15s;
}
.search:focus-within { border-color: var(--focus-line); }
.search .ic { width: 17px; height: 17px; }
.search input { flex: 1 1 auto; min-width: 0; background: transparent; border: 0; outline: none; color: var(--text); font-size: 14px; }
.search input::-webkit-search-cancel-button { filter: invert(.7); }

.history { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; margin: 0 -4px; padding: 4px 4px 0; scrollbar-width: thin; scrollbar-color: #18245C transparent; }
.history::-webkit-scrollbar { width: 8px; }
.history::-webkit-scrollbar-thumb { background: #18245C; border-radius: 8px; }
.h-group { display: flex; flex-direction: column; gap: 2px; }
.h-label { font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2); padding: 0 10px 6px; }
.h-item { position: relative; display: flex; align-items: center; border: 1px solid transparent; border-radius: 10px; color: var(--text-3); transition: background .12s; }
.h-item:hover { background: var(--item-hover); }
.h-open { flex: 1 1 auto; min-width: 0; min-height: 42px; display: flex; align-items: center; gap: 10px; padding: 6px 4px 6px 26px; text-align: left; font-size: 14px; border-radius: 10px; }
.h-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.h-title { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-snip { display: block; font-size: 12px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-snip mark, .h-title mark { background: rgba(244, 194, 77, .22); color: var(--text); border-radius: 3px; padding: 0 1px; }
.h-more { width: 34px; height: 34px; margin-right: 4px; flex: none; display: grid; place-items: center; border-radius: 8px; color: var(--icon); opacity: 0; transition: opacity .12s, background .12s; }
.h-more .ic { width: 17px; height: 17px; }
.h-more:hover { background: var(--hover); color: var(--text); }
.h-item:hover .h-more, .h-item:focus-within .h-more, .h-item.active .h-more, .h-more[aria-expanded="true"] { opacity: 1; }
.h-item.active { background: var(--active); border-color: var(--active-line); color: #F2F5FF; }
.h-item.active .h-open { padding-left: 10px; }
.h-item.active .h-open::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); flex: none; box-shadow: 0 0 8px rgba(244, 194, 77, .7); }
.h-item.busy .h-open::after { content: ''; width: 12px; height: 12px; flex: none; margin-left: auto; border-radius: 50%; border: 2px solid rgba(108, 196, 255, .25); border-top-color: var(--blue); animation: spin .8s linear infinite; }
.h-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 28px 16px; color: var(--muted-2); font-size: 13.5px; line-height: 1.5; }
.h-empty-ic { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; background: rgba(108, 196, 255, .08); color: var(--blue); }
.h-empty b { color: var(--text-3); font-weight: 600; font-size: 14px; }

.tg-card { flex: none; display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; border: 1px solid #1C2B68; background: #0B1542; text-decoration: none; color: var(--text); transition: border-color .15s, background .15s; }
.tg-card:hover { border-color: #2F4AA0; background: #0E1A4E; color: var(--text); }
.tg-ic { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 11px; background: rgba(77, 179, 255, .14); color: var(--blue); }
.tg-ic .ic { width: 18px; height: 18px; }
.tg-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tg-txt b { font-size: 13.5px; font-weight: 600; }
.tg-txt small { font-size: 12.5px; color: var(--muted); }
.tg-go { width: 16px; height: 16px; color: var(--muted-2); }

.side-foot { flex: none; display: flex; align-items: center; gap: 10px; padding: 10px 2px 0 4px; border-top: 1px solid var(--line); }
.foot-ic { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--active); color: var(--ok); border: 1px solid var(--active-line); }
.foot-ic .ic { width: 17px; height: 17px; }
.foot-txt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.foot-txt b { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.foot-txt small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ------------------------------------------------------------------ header */

.top { height: 68px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 20px; position: relative; border-bottom: 1px solid var(--line-soft); z-index: 5; }
.top-glow { position: absolute; left: 8%; right: 8%; bottom: -1px; height: 1px; pointer-events: none; background: linear-gradient(90deg, rgba(77, 179, 255, 0) 0%, rgba(77, 179, 255, .55) 30%, rgba(244, 194, 77, .9) 50%, rgba(77, 179, 255, .55) 70%, rgba(77, 179, 255, 0) 100%); }
.app[data-view="welcome"] .top { border-bottom-color: transparent; }
.app[data-view="welcome"] .top-glow, .app[data-view="welcome"] .chat-only, .app[data-view="welcome"] .title-wrap { display: none !important; }
.title-wrap { flex: 0 1 auto; min-width: 0; display: flex; align-items: center; gap: 4px; }
.title-wrap h1 { margin: 0; font: 600 16px/1.3 var(--font-head); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-fill { flex: 1 1 auto; }
.m-brand { align-items: center; gap: 9px; text-decoration: none; color: inherit; }
.m-brand .wordmark { font-size: 19px; }

.banner { flex: none; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 9px 16px; font-size: 13.5px; color: #FFE2A8; background: rgba(244, 194, 77, .09); border-bottom: 1px solid rgba(244, 194, 77, .22); text-align: center; }
.banner .ic { width: 17px; height: 17px; }
.banner.bad { color: #FFD0D0; background: var(--danger-bg); border-bottom-color: var(--danger-line); }

/* ------------------------------------------------------------------ welcome */

.scroller { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; position: relative; scrollbar-width: thin; scrollbar-color: #1B2966 transparent; }
.scroller::-webkit-scrollbar { width: 12px; }
.scroller::-webkit-scrollbar-thumb { background: #1B2966; border-radius: 12px; border: 4px solid var(--bg); }

.welcome { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8px 24px 28px; position: relative; }
.app[data-view="chat"] .welcome { display: none; }
.app[data-view="welcome"] .thread { display: none; }
.w-glow { position: absolute; left: 50%; top: 0; width: 720px; height: 420px; margin-left: -360px; border-radius: 50%; background: radial-gradient(closest-side, rgba(40, 96, 210, .22), rgba(40, 96, 210, 0)); pointer-events: none; }
.w-inner { width: 100%; max-width: 780px; display: flex; flex-direction: column; align-items: center; gap: 30px; position: relative; }
.w-hero { display: flex; flex-direction: column; align-items: center; gap: 22px; text-align: center; }
.w-logo { width: 168px; height: 168px; object-fit: cover; border-radius: 36px; border: 1px solid rgba(244, 194, 77, .35); box-shadow: 0 0 0 8px rgba(77, 179, 255, .05), 0 24px 80px rgba(36, 110, 230, .35); animation: rise .6s var(--ease) both; }
.w-title { margin: 0; font: 600 40px/1.15 var(--font-head); letter-spacing: -.01em; animation: rise .6s .05s var(--ease) both; }
.w-title .gold { color: var(--gold); }
.w-sub { margin: -12px 0 0; font-size: 16px; line-height: 1.6; color: var(--muted); max-width: 560px; animation: rise .6s .1s var(--ease) both; }
.welcome .slot { width: 100%; animation: rise .6s .15s var(--ease) both; }
.cards { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; animation: rise .6s .2s var(--ease) both; }
.card { display: flex; align-items: flex-start; gap: 14px; padding: 16px; border: 1px solid var(--s1-line); border-radius: 16px; background: #0A1440; color: var(--text); text-align: left; transition: border-color .15s, background .15s, transform .15s; }
.card:hover { border-color: #2F4AA0; background: #0D1A50; transform: translateY(-1px); }
.card-ic { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 12px; }
.card-ic.gold { background: rgba(244, 194, 77, .12); color: var(--gold); }
.card-ic.blue { background: rgba(77, 179, 255, .13); color: var(--blue); }
.card-tx { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.card-tx b { font-size: 14.5px; font-weight: 600; }
.card-tx span { font-size: 13.5px; line-height: 1.5; color: var(--muted); }
.disclaimer { margin: 0; text-align: center; font-size: 12px; color: var(--muted-2); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ thread */

.thread { max-width: 800px; margin: 0 auto; padding: 28px 24px 28px; display: flex; flex-direction: column; gap: 30px; }
.day { display: flex; align-items: center; gap: 12px; color: var(--muted-2); font-size: 12px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; }
.day::before, .day::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.msg { animation: msgIn .28s var(--ease) both; }
.msg.still { animation: none; }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg.user.editing { width: min(620px, 100%); max-width: 100%; }
.edit-box { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.edit-ta { height: auto; min-height: 90px; padding: 12px 14px; line-height: 1.55; resize: none; font-size: 15px; }
.edit-btns { display: flex; justify-content: flex-end; gap: 8px; }
.msg.user { align-self: flex-end; max-width: 78%; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.bubble { padding: 12px 16px; background: var(--bubble); border: 1px solid var(--bubble-line); border-radius: 18px 18px 6px 18px; font-size: 15px; line-height: 1.55; color: #F2F5FF; white-space: pre-wrap; overflow-wrap: anywhere; }
.u-att { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.u-actions { display: flex; gap: 2px; margin-right: -6px; opacity: 0; transition: opacity .15s; color: var(--icon); }
.msg.user:hover .u-actions, .msg.user:focus-within .u-actions { opacity: 1; }
.u-actions .ib { width: 34px; height: 34px; }
.u-actions .ic { width: 16px; height: 16px; }

.thumb { width: 132px; height: 132px; border-radius: 14px; overflow: hidden; border: 1px solid var(--bubble-line); background: #0A1440; padding: 0; cursor: zoom-in; transition: transform .15s; }
.thumb:hover { transform: scale(1.02); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.u-att.single .thumb { width: auto; max-width: 280px; height: auto; max-height: 280px; }
.u-att.single .thumb img { width: auto; height: auto; max-width: 280px; max-height: 280px; }

.fchip { display: flex; align-items: center; gap: 10px; min-width: 0; max-width: 300px; height: 52px; padding: 0 14px 0 8px; border-radius: 14px; border: 1px solid var(--bubble-line); background: #0D1A4C; color: var(--text); text-align: left; }
.fchip-ic { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 10px; background: rgba(77, 179, 255, .13); color: var(--blue); }
.fchip-ic .ic { width: 18px; height: 18px; }
.fchip-ic.pdf { background: rgba(255, 128, 128, .13); color: #FF9F9F; }
.fchip-ic.doc { background: rgba(108, 196, 255, .13); color: var(--blue); }
.fchip-ic.ppt { background: rgba(244, 194, 77, .13); color: var(--gold); }
.fchip-ic.xls { background: rgba(159, 227, 193, .13); color: var(--ok); }
.fchip-tx { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.fchip-tx b { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fchip-tx small { font-size: 12px; color: var(--muted); }
.fchip.gone { opacity: .55; }

.msg.ai { position: relative; padding-left: 48px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ai-head { display: flex; align-items: center; gap: 10px; min-height: 34px; }
.ai-head .ava { position: absolute; left: 0; top: 0; }
.ai-name { font-weight: 600; font-size: 14px; }
.ai-tag { font-size: 12px; color: var(--muted-2); display: inline-flex; align-items: center; gap: 6px; }
.ai-tag::before { content: ''; width: 3px; height: 3px; border-radius: 50%; background: currentColor; }
.typing { display: inline-flex; align-items: center; gap: 10px; height: 38px; padding: 0 14px; border-radius: 999px; background: var(--s1); border: 1px solid var(--s1-line); color: var(--muted); font-size: 13px; align-self: flex-start; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--blue); animation: dot 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; background: var(--gold); }
@keyframes dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.ai-actions { display: flex; align-items: center; gap: 2px; margin-left: -8px; color: var(--icon); flex-wrap: wrap; }
.ai-actions .ib .ic { width: 17px; height: 17px; }
.ai-actions .ib.on.up { color: var(--gold); }
.ai-actions .ib.on.down { color: #FF9A9A; }
.ai-actions .ib.on .ic { fill: currentColor; fill-opacity: .18; }
.msg.ai.streaming .ai-actions { display: none; }
.ib.speaking { color: var(--gold); background: rgba(244, 194, 77, .1); }
.eq { display: none; align-items: flex-end; gap: 2px; height: 14px; }
.ib.speaking .eq { display: inline-flex; }
.ib.speaking .ic { display: none; }
.eq i { width: 3px; border-radius: 2px; background: currentColor; animation: eq .9s ease-in-out infinite; }
.eq i:nth-child(1) { height: 6px; }
.eq i:nth-child(2) { height: 12px; animation-delay: .15s; }
.eq i:nth-child(3) { height: 8px; animation-delay: .3s; }
@keyframes eq { 50% { transform: scaleY(.45); } }
.ib.loading .ic { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.btn-cont { height: 36px; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; margin-left: 6px; border: 1px solid var(--active-line); border-radius: 999px; color: var(--text-2); font-size: 13px; font-weight: 500; }
.btn-cont:hover { background: var(--hover); }
.btn-cont .ic { width: 15px; height: 15px; }

.note { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted-2); }
.note .ic { width: 15px; height: 15px; }

.ai-error { display: flex; align-items: flex-start; gap: 12px; padding: 12px 12px 12px 14px; border: 1px solid var(--danger-line); background: var(--danger-bg); border-radius: 14px; color: #FFD9D9; font-size: 14px; line-height: 1.5; }
.ai-error > .ic { width: 19px; height: 19px; margin-top: 1px; color: var(--danger); }
.ai-error-tx { flex: 1; min-width: 0; padding-top: 1px; }
.ai-error .btn { height: 34px; padding: 0 12px; font-size: 13px; flex: none; }

/* ------------------------------------------------------------------ markdown */

.md { font-size: 15px; line-height: 1.65; color: var(--text-2); overflow-wrap: anywhere; min-width: 0; }
.md > * { margin: 0; }
.md > * + * { margin-top: 14px; }
.md li > p, .md blockquote > * { margin: 0; }
.md li > p + *, .md blockquote > * + * { margin-top: 10px; }
.md h2, .md h3, .md h4 { color: var(--text); font-family: var(--font-head); font-weight: 600; line-height: 1.35; }
.md h2 { font-size: 19px; }
.md h3 { font-size: 17px; }
.md h4 { font-size: 15.5px; }
.md > h2:not(:first-child), .md > h3:not(:first-child) { margin-top: 22px; }
.md strong { color: var(--text); font-weight: 600; }
.md em { font-style: italic; }
.md del { opacity: .7; }
.md a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; text-decoration-color: rgba(143, 208, 255, .4); }
.md a:hover { text-decoration-color: currentColor; }
.md ul, .md ol { padding-left: 1.45em; }
.md li { padding-left: .2em; }
.md li + li { margin-top: 6px; }
.md li > ul, .md li > ol { margin-top: 6px; }
.md ul > li::marker { color: var(--gold); }
.md ol > li::marker { color: var(--blue); font-weight: 600; font-size: .92em; }
.md code { font-family: var(--font-mono); font-size: 13px; padding: 2px 6px; border-radius: 6px; background: var(--code-inline); color: var(--code-text); }
.md blockquote { padding: 2px 0 2px 16px; border-left: 3px solid var(--gold); color: var(--muted); }
.md hr { border: 0; height: 1px; background: var(--line); margin: 20px 0; }
.md .tbl { overflow-x: auto; border: 1px solid var(--s1-line); border-radius: 12px; }
.md table { border-collapse: collapse; width: 100%; font-size: 14px; line-height: 1.5; }
.md th { background: var(--s1); color: var(--text); font-weight: 600; text-align: left; }
.md th, .md td { padding: 9px 14px; border-bottom: 1px solid var(--s1-line); vertical-align: top; }
.md tr:last-child td { border-bottom: 0; }
.md tr + tr td { border-top: 0; }
.md td + td, .md th + th { border-left: 1px solid var(--s1-line); }
.md .al-c { text-align: center; }
.md .al-r { text-align: right; }
.md .code { border: 1px solid var(--s1-line); border-radius: 14px; overflow: hidden; background: var(--code-bg); }
.md .code-head { height: 42px; display: flex; align-items: center; justify-content: space-between; padding: 0 6px 0 16px; background: var(--code-head); border-bottom: 1px solid var(--s1-line); font: 12px/1 var(--font-mono); color: var(--muted); }
.md .code-copy { height: 32px; display: inline-flex; align-items: center; gap: 7px; padding: 0 10px; border-radius: 8px; color: var(--muted); font: 500 12.5px var(--font); }
.md .code-copy:hover { background: var(--hover); color: var(--text); }
.md .code-copy .ic { width: 14px; height: 14px; }
.md pre { margin: 0; padding: 14px 18px; overflow-x: auto; font: 13px/1.75 var(--font-mono); color: var(--code-text); tab-size: 4; }
.md pre code { padding: 0; background: none; border-radius: 0; font-size: inherit; color: inherit; white-space: pre; }
.hl-k { color: var(--gold); }
.hl-s { color: #9FE3C1; }
.hl-n { color: #8FD0FF; }
.hl-c { color: #6F7BA8; font-style: italic; }
.hl-v { color: #C4E6FF; }
.hl-l { color: #FFB27A; }
.hl-p { color: #8FD0FF; }
.hl-t { color: var(--gold); }
.hl-a { color: #8FD0FF; }
.msg.ai.streaming .md > p:last-child::after,
.msg.ai.streaming .md > :is(ul, ol):last-child > li:last-child::after,
.msg.ai.streaming .md > :is(h2, h3, h4):last-child::after {
  content: ''; display: inline-block; width: 8px; height: 1.05em; margin-left: 3px; vertical-align: -.16em;
  background: var(--gold); border-radius: 2px; animation: caret 1s steps(2, start) infinite;
}
@keyframes caret { to { visibility: hidden; } }

/* ------------------------------------------------------------------ composer */

.dock { flex: none; padding: 6px 24px 16px; }
.dock-inner { max-width: 800px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.app[data-view="welcome"] .dock { display: none; }

.composer {
  display: flex; flex-direction: column; gap: 8px; padding: 14px 12px 10px 18px;
  background: var(--composer); border: 1px solid var(--composer-line); border-radius: 22px;
  box-shadow: 0 14px 44px rgba(0, 0, 0, .38); transition: border-color .15s, box-shadow .15s;
}
.composer:focus-within { border-color: var(--focus-line); }
.composer.drag { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(244, 194, 77, .12), 0 14px 44px rgba(0, 0, 0, .38); }
.composer textarea {
  display: block; width: 100%; resize: none; background: transparent; border: 0; outline: none; padding: 0 6px 0 0;
  color: var(--text); font-size: 15px; line-height: 1.55; min-height: 48px; max-height: 220px; overflow-y: auto;
}
.welcome .composer { padding: 16px 12px 10px 20px; border-radius: 24px; box-shadow: 0 18px 60px rgba(0, 0, 0, .4); }
.welcome .composer textarea { font-size: 16px; min-height: 74px; }
.c-row { display: flex; align-items: center; gap: 6px; margin-left: -6px; }
.c-attach { height: 40px; display: inline-flex; align-items: center; gap: 7px; padding: 0 14px 0 10px; border: 1px solid var(--active-line); border-radius: 999px; color: var(--muted); font-size: 13px; font-weight: 500; transition: background .15s, color .15s, border-color .15s; }
.c-attach .ic { width: 17px; height: 17px; }
.c-attach:hover { background: var(--hover); color: var(--text); }
.c-attach.pulse { border-color: var(--gold); color: var(--gold); animation: ring 1.2s ease-out 2; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(244, 194, 77, .45); } 100% { box-shadow: 0 0 0 10px rgba(244, 194, 77, 0); } }
.c-fill { flex: 1 1 auto; }
.c-left { font-size: 12.5px; color: var(--muted-2); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.c-left .ic { width: 14px; height: 14px; }
.c-left.warn { color: #FFD27A; }
.c-send { width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 50%; background: #17245E; color: #6F7BA8; transition: background .15s, color .15s, box-shadow .2s, transform .12s; }
.c-send .ic { width: 19px; height: 19px; stroke-width: 2.2; grid-area: 1 / 1; }
.c-send .i-halt { display: none; }
.c-send.ready { background: var(--gold); color: var(--gold-ink); box-shadow: 0 0 18px rgba(244, 194, 77, .45); }
.c-send.ready:hover { filter: brightness(1.06); }
.c-send.ready:active { transform: scale(.95); }
.c-send.stop { background: #EAF0FF; color: #0A1440; box-shadow: 0 0 0 4px rgba(234, 240, 255, .08); }
.c-send.stop .i-go { display: none; }
.c-send.stop .i-halt { display: block; }

.tray { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 2px -4px; }
.att { position: relative; height: 56px; border-radius: 12px; border: 1px solid var(--bubble-line); background: #0A1440; display: flex; align-items: center; animation: msgIn .2s var(--ease) both; }
.att.img { width: 56px; overflow: hidden; }
.att.img img { width: 100%; height: 100%; object-fit: cover; }
.att.file { gap: 10px; padding: 0 34px 0 8px; max-width: 260px; }
.att .fchip-tx b { font-size: 13px; }
.att .fchip-tx small { display: flex; align-items: center; gap: 6px; }
.att.err { border-color: var(--danger-line); }
.att.err small { color: var(--danger); }
.att-x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: rgba(4, 10, 38, .85); color: var(--text); border: 1px solid #2A3D8A; }
.att-x .ic { width: 12px; height: 12px; stroke-width: 2.4; }
.att.img .att-x { opacity: 0; transition: opacity .12s; }
.att.img:hover .att-x, .att.img:focus-within .att-x { opacity: 1; }
.att .spin, .spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid rgba(108, 196, 255, .25); border-top-color: var(--blue); animation: spin .8s linear infinite; flex: none; }
.att.img .spin { position: absolute; inset: 0; margin: auto; width: 18px; height: 18px; }
.bar { width: 60px; height: 4px; border-radius: 4px; background: rgba(108, 196, 255, .18); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--blue); border-radius: 4px; transition: width .2s; }
@keyframes spin { to { transform: rotate(360deg); } }

.dock { position: relative; }
.jump { position: absolute; left: 50%; top: -50px; z-index: 6; width: 38px; height: 38px; margin-left: -19px; display: grid; place-items: center; border-radius: 50%; background: #13215A; border: 1px solid #2A3D8A; color: var(--text); box-shadow: 0 8px 24px rgba(0, 0, 0, .45); animation: msgIn .2s var(--ease) both; }
.jump .ic { width: 18px; height: 18px; }
.jump:hover { background: #1A2B6E; }

.drop { position: absolute; inset: 10px; z-index: 30; display: grid; place-items: center; border-radius: 22px; border: 2px dashed rgba(244, 194, 77, .7); background: rgba(6, 11, 38, .88); backdrop-filter: blur(3px); pointer-events: none; }
.drop-box { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; color: var(--muted); font-size: 14px; }
.drop-box .ic { width: 34px; height: 34px; color: var(--gold); margin-bottom: 4px; }
.drop-box b { color: var(--text); font: 600 20px var(--font-head); }

/* ------------------------------------------------------------------ menus, dialogs, toasts */

.menu { position: fixed; z-index: 70; min-width: 230px; max-width: calc(100vw - 16px); padding: 6px; background: var(--pop); border: 1px solid var(--composer-line); border-radius: 14px; box-shadow: 0 18px 50px rgba(0, 0, 0, .55); animation: pop .14s var(--ease) both; }
.menu button { width: 100%; display: flex; align-items: center; gap: 11px; min-height: 40px; padding: 0 12px; border-radius: 9px; color: var(--text-2); font-size: 14px; text-align: left; }
.menu button:hover, .menu button:focus-visible { background: var(--pop-hover); color: var(--text); outline: none; }
.menu button .ic { width: 17px; height: 17px; color: var(--icon); }
.menu button.danger, .menu button.danger .ic { color: var(--danger); }
.menu hr { border: 0; height: 1px; background: var(--s1-line); margin: 6px 4px; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }

.modal-back { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; background: rgba(2, 5, 20, .7); backdrop-filter: blur(4px); animation: fade .15s ease both; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(480px, 100%); max-height: calc(100dvh - 40px); overflow-y: auto; display: flex; flex-direction: column; gap: 18px; padding: 22px; background: #0B1542; border: 1px solid var(--composer-line); border-radius: 20px; box-shadow: 0 30px 90px rgba(0, 0, 0, .6); animation: pop .18s var(--ease) both; }
.modal-head { display: flex; align-items: center; gap: 12px; }
.modal-head h3 { flex: 1; margin: 0; font: 600 18px var(--font-head); }
.modal p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field > span { font-size: 12.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-2); }
.input { height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--composer-line); background: var(--s2); color: var(--text); outline: none; font-size: 15px; }
.input:focus { border-color: var(--focus-line); }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.set-row > span { font-size: 14.5px; font-weight: 500; color: var(--text-2); }
.set-row .seg { flex: none; }
.set-card { display: flex; flex-direction: column; gap: 12px; padding: 14px; border: 1px solid var(--s1-line); border-radius: 14px; background: #0A1440; }
.set-card .t { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; }
.set-card .t .ic { width: 18px; height: 18px; color: var(--blue); }
.set-card p { font-size: 13.5px; }
.meter { height: 6px; border-radius: 6px; background: rgba(108, 196, 255, .14); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--blue), var(--gold)); }
.set-btns { display: flex; gap: 10px; flex-wrap: wrap; }

.lightbox { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 24px; background: rgba(2, 5, 20, .92); cursor: zoom-out; animation: fade .15s ease both; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 12px; box-shadow: 0 30px 90px rgba(0, 0, 0, .6); }
.lightbox .ib { position: absolute; top: 16px; right: 16px; background: rgba(19, 33, 90, .8); color: var(--text); }

.toasts { position: fixed; left: 50%; bottom: 168px; transform: translateX(-50%); z-index: 95; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; width: max-content; max-width: calc(100vw - 24px); }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 14px; background: #16245F; border: 1px solid #2A3D8A; border-radius: 12px; color: var(--text); font-size: 14px; box-shadow: 0 12px 40px rgba(0, 0, 0, .45); animation: toastIn .22s var(--ease) both; }
.toast.out { animation: toastOut .2s ease forwards; }
.toast > .ic { width: 17px; height: 17px; color: var(--ok); }
.toast.bad > .ic { color: var(--danger); }
.toast button { color: var(--gold); font-weight: 600; font-size: 13.5px; padding: 4px 6px; border-radius: 6px; }
.toast button:hover { background: rgba(244, 194, 77, .1); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }

/* ------------------------------------------------------------------ phones & small windows */

@media (max-width: 820px) {
  .d-only { display: none !important; }
  .m-only { display: flex !important; }
  .side {
    position: fixed; z-index: 60; top: 0; bottom: 0; left: 0; width: min(86vw, 330px);
    transform: translateX(-104%); transition: transform .24s var(--ease); box-shadow: 0 0 60px rgba(0, 0, 0, .55);
    padding-top: max(16px, env(safe-area-inset-top)); padding-bottom: max(14px, env(safe-area-inset-bottom));
  }
  .app.side-collapsed .side { display: flex; }
  .app.drawer-open .side { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(2, 5, 20, .6); opacity: 0; pointer-events: none; transition: opacity .2s; }
  .app.drawer-open .scrim { opacity: 1; pointer-events: auto; }
  .h-more { opacity: 1; }
  .top { height: 60px; padding: 0 8px; gap: 4px; padding-top: env(safe-area-inset-top); height: calc(60px + env(safe-area-inset-top)); }
  .top-glow { left: 6%; right: 6%; }
  .m-brand { flex: 1 1 auto; justify-content: center; min-width: 0; }
  .top-fill { display: none; }
  .app[data-view="welcome"] .top { border-bottom-color: var(--line-soft); }
  .app[data-view="welcome"] .top-glow { display: block !important; }
  .welcome { justify-content: flex-start; padding: 22px 16px 18px; }
  .w-inner { gap: 22px; }
  .w-hero { gap: 16px; }
  .w-logo { width: 108px; height: 108px; border-radius: 26px; }
  .w-title { font-size: 27px; }
  .w-sub { font-size: 14.5px; margin-top: -6px; }
  .welcome .slot, .w-disc { display: none; }
  .cards { grid-template-columns: 1fr; gap: 10px; }
  .card { padding: 13px 14px; }
  .card-tx span { font-size: 13px; }
  .app[data-view="welcome"] .dock { display: block; }
  .thread { padding: 18px 16px 16px; gap: 22px; }
  .msg.user { max-width: 88%; }
  .msg.ai { padding-left: 0; }
  .ai-head .ava { position: static; }
  .ai-head .ava-34 { width: 30px; height: 30px; }
  .ai-actions { margin-left: -10px; }
  .ai-actions .ib { width: 44px; }
  .u-actions { opacity: 1; }
  .thumb { width: 112px; height: 112px; }
  .dock { padding: 8px 12px max(12px, env(safe-area-inset-bottom)); background: var(--bg); }
  .dock-inner { gap: 8px; }
  .disclaimer { font-size: 11.5px; }
  .composer { padding: 12px 10px 8px 16px; border-radius: 22px; box-shadow: 0 -8px 30px rgba(0, 0, 0, .3); }
  .composer textarea { font-size: 16px; min-height: 28px; max-height: 160px; }
  .c-attach span { display: none; }
  .c-attach { width: 40px; padding: 0; justify-content: center; }
  .md pre { padding: 12px 14px; }
  .toasts { bottom: 140px; }
  .modal { padding: 18px; border-radius: 18px; }
}

@media (hover: none) {
  .u-actions { opacity: 1; }
  .h-more { opacity: 1; }
  .att.img .att-x { opacity: 1; }
}

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