/* University research terminal. Public brand colours are injected by brand.js. */
/* Self-hosted fonts (SIL OFL 1.1): Golos Text for text, Unbounded for headings and utility labels. */
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 400 900; font-display: swap; src: url("fonts/golos-text-cyrillic.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 400 900; font-display: swap; src: url("fonts/golos-text-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Unbounded"; font-style: normal; font-weight: 400 900; font-display: swap; src: url("fonts/unbounded-cyrillic.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Unbounded"; font-style: normal; font-weight: 400 900; font-display: swap; src: url("fonts/unbounded-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
:root {
  --color-bg:var(--brand-light-bg, #F3F7FB); --color-bg-secondary:#E7EFF6; --color-surface:var(--color-bg-secondary); --color-press:#DCE8F0;
  --color-text:var(--brand-light-text, #152A43); --color-text-secondary:var(--brand-muted, #406278); --color-hint:var(--brand-muted, #406278);
  --color-accent:#176177; --color-action:var(--brand-accent, #62D9F5); --color-accent-text:#0B1221; --color-accent-soft:#D9F3FA; --color-border:#C8D8E4;
  --color-success:#1E7A4C; --color-success-soft:#E6F2EB; --color-warning:#8F5506; --color-warning-soft:#FBF1E1;
  --color-danger:#B3261E; --color-danger-soft:#FBE9E7;
  --color-pro:#176177; --color-pro-soft:#D9F3FA;
  --color-deep:#176177; --color-deep-soft:#D9F3FA; --color-fast:#176177;
  --color-scrim:rgba(10,10,12,.4);
  --rgb-accent:98,217,245; --rgb-deep:98,217,245; --rgb-danger:179,38,30;

  --font: "Golos Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Unbounded", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;

  --gutter: 20px;
  --radius: 6px; --radius-field: 10px; --radius-full: 6px;
  --elev-sheet: none;
  --elev-float: none;

  --app-h: 100vh;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --tg-content-top: 0px;
  --toast-bottom: 96px;
  /* Motion: press feedback, overlays, progress (AUDIT.md M5) */
  --dur-press: 120ms; --dur-base: 200ms; --dur-exit: 150ms; --dur-slow: 400ms;
  --ease-out: cubic-bezier(.2,.8,.2,1);
  color-scheme: light;
}
[data-theme="dark"] {
  --color-bg:var(--brand-dark-bg, #0B1221); --color-bg-secondary:var(--brand-dark-surface, #122137); --color-press:#1C314B;
  --color-text:#F3F7FB; --color-text-secondary:#AAC0D2; --color-hint:#93ADC3;
  --color-accent:var(--brand-accent, #62D9F5); --color-accent-text:#0B1221; --color-accent-soft:#18384A; --color-border:#2A4058;
  --color-success:#4CC38A; --color-success-soft:#14271D; --color-warning:#F0B44C; --color-warning-soft:#2C2312;
  --color-danger:#F2766B; --color-danger-soft:#33191A;
  --color-pro:var(--brand-accent, #62D9F5); --color-pro-soft:#18384A;
  --color-deep:var(--brand-accent, #62D9F5); --color-deep-soft:#18384A; --color-fast:var(--brand-accent, #62D9F5);
  --color-scrim:rgba(0,0,0,.6);
  --rgb-accent:98,217,245; --rgb-deep:98,217,245; --rgb-danger:242,118,107;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  background: var(--color-bg);
  color: var(--color-text);
  font: 400 15px/22px var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; }
button:disabled { cursor: default; }
a { color: var(--color-accent); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; border-radius: 8px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { flex: none; display: block; }
.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
[hidden] { display: none !important; }

/* Typography: 13 / 15 / 17 / 28, weights 400 and 600 */
.t-display { font-size: 24px; line-height: 32px; font-weight: 600; letter-spacing: -0.01em; }
.t-title { font-size: 24px; line-height: 32px; font-weight: 600; letter-spacing: -0.01em; margin: 0; overflow-wrap: anywhere; }
.t-title, .t-h2, .t-display { font-family: var(--font-display); }
.eyebrow { font: 500 10px/18px var(--font-display); letter-spacing: .06em; color: var(--color-accent); }
.t-h2 { font-size: 15px; line-height: 22px; font-weight: 600; letter-spacing: 0; margin: 0; }
.t-body { font-size: 15px; line-height: 22px; font-weight: 400; }
.t-strong { font-size: 15px; line-height: 22px; font-weight: 600; }
.t-label { font-size: 13px; line-height: 18px; font-weight: 600; color: var(--color-text-secondary); }
.t-caption { font-size: 13px; line-height: 18px; font-weight: 400; }
.t-mono { font-family: var(--font-mono); font-size: 13px; line-height: 18px; }
.c-secondary { color: var(--color-text-secondary); }
.c-hint { color: var(--color-hint); }
.c-pro { color: var(--color-pro); }
.c-danger { color: var(--color-danger); }
.center { text-align: center; }
p { margin: 0; }

/* ---------- App shell ---------- */
#app {
  position: fixed; left: 0; right: 0; top: 0;
  height: var(--app-h);
  display: flex; flex-direction: column;
  background: var(--color-bg);
  overflow: hidden;
}
.screens { position: relative; flex: 1 1 auto; min-height: 0; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--color-bg); }
.screen[aria-hidden="true"] { visibility: hidden; pointer-events: none; }
.scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.page { width: 100%; max-width: 640px; margin: 0 auto; padding: calc(20px + var(--tg-content-top)) calc(var(--gutter) + var(--safe-right)) 32px calc(var(--gutter) + var(--safe-left)); display: flex; flex-direction: column; gap: 24px; }
.page-head { display: flex; flex-direction: column; gap: 6px; }

/* ---------- Quiet navigation ---------- */
.tabbar { flex:none; display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); position:relative; z-index:3; border-top:1px solid var(--color-border); background:var(--color-bg); /* симметричные отступы: центральная кнопка «Чат» точно по центру экрана */ padding:5px calc(8px + max(var(--safe-left), var(--safe-right))) max(6px,var(--safe-bottom)); }
.tab { display:flex; flex-direction:column; align-items:center; gap:4px; padding:7px 4px; min-height:50px; min-width:0; color:var(--color-hint); border-radius:6px; }
.tab__pill { display:grid; place-items:center; height:22px; }
.tab__pill .icon { width:20px; height:20px; }
.tab__label { font:500 10px/14px var(--font-display); white-space:nowrap; }
.tab[aria-current="page"] { color:var(--color-accent); background:var(--color-accent-soft); }
.tab:not(.tab--main) { align-self:end; }
/* Главная вкладка «Чат»: круглая кнопка в цвете действия, приподнята над линией бара; подписи всех вкладок на одной линии */
.tab--main { margin-top:-12px; padding:0 4px 7px; min-height:44px; }
.tab--main .tab__pill { width:52px; height:52px; border-radius:50%; background:var(--color-action); color:var(--color-accent-text); box-shadow:0 0 0 4px var(--color-bg); transition:transform var(--dur-press) var(--ease-out), opacity var(--dur-press) var(--ease-out); }
.tab--main .tab__pill .icon { width:26px; height:26px; }
.tab--main[aria-current="page"] { background:none; }
.tab--main[aria-current="page"] .tab__label { color:var(--color-accent); }
.tab--main:active .tab__pill { transform:scale(.94); opacity:.9; }
.tab--main:focus-visible { outline:none; }
.tab--main:focus-visible .tab__pill { outline:2px solid var(--color-accent); outline-offset:5px; }
.app--pushed .tabbar, .app--kb .tabbar { display:none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 18px; border-radius: var(--radius);
  font-size: 15px; line-height: 22px; font-weight: 600; text-align: center;
  width: 100%; transition: opacity var(--dur-press) var(--ease-out), transform var(--dur-press) var(--ease-out), background-color var(--dur-press) var(--ease-out); user-select: none;
}
.btn:active:not(:disabled) { transform: scale(.98); opacity: .85; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .4; pointer-events: none; }
.btn .icon { width: 18px; height: 18px; }
.btn--primary { background: var(--color-action); color: var(--color-accent-text); }
.btn--secondary { background: var(--color-bg-secondary); color: var(--color-text); }
.btn--ghost { background: transparent; color: var(--color-accent); height: 44px; }
.btn--pro { background: var(--color-bg-secondary); color: var(--color-text); }
.btn--pro .icon { color: var(--color-pro); }
.btn--auto { width: auto; }
.btn--loading { pointer-events: none; }
.btn__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { position: relative; width: 44px; height: 44px; display: grid; place-items: center; border-radius: var(--radius-full); color: var(--color-hint); flex: none; transition: opacity var(--dur-press) var(--ease-out), background-color var(--dur-press) var(--ease-out); }
.icon-btn:active { opacity: .6; }
.link-btn { color: var(--color-accent); font-weight: 600; text-decoration: none; display: inline; padding: 0; font-size: inherit; line-height: inherit; }
.link-btn:hover { text-decoration: underline; }

/* ---------- Chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; min-height: 36px;
  border-radius: var(--radius-full); background: var(--color-bg-secondary);
  color: var(--color-text); font-size: 13px; line-height: 18px; font-weight: 600; text-align: left;
  position: relative; transition: transform var(--dur-press) var(--ease-out), background-color var(--dur-press) var(--ease-out);
}
.chip::after { content: ""; position: absolute; inset: -4px 0; } /* 44px tap target */
.chip:active { transform: scale(.97); background: var(--color-press); }
.chip .icon { width: 16px; height: 16px; }
.chip[aria-pressed="true"] { background: var(--color-accent-soft); color: var(--color-accent); }
.chip--deep { background: transparent; color: var(--color-deep); padding-left: 0; padding-right: 0; }
.chip--deep:active { background: transparent; opacity: .7; }

/* ---------- Badges: plain text, no fills ---------- */
.badge { display: inline-flex; align-items: center; font-size: 13px; line-height: 18px; font-weight: 600; white-space: nowrap; flex: none; color: var(--color-text-secondary); }
.badge--pro, .badge--trial { color: var(--color-pro); }
.pill-rec { color: var(--color-pro); font-size: 13px; line-height: 18px; font-weight: 600; white-space: nowrap; }

/* ---------- Cards / lists ---------- */
.card { border-top: 1px solid var(--color-border); padding: 20px 0 0; display: flex; flex-direction: column; gap: 16px; }
.rows { border-top: 1px solid var(--color-border); border-bottom: 1px solid var(--color-border); overflow: hidden; }
.row { display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 12px 16px; width: 100%; text-align: left; position: relative; color: var(--color-text); transition: background-color var(--dur-press) var(--ease-out); }
.row + .row::before { content: ""; position: absolute; top: 0; left: 50px; right: 0; height: 1px; background: var(--color-border); }
.row:active { background: var(--color-press); }
.row__icon { display: grid; place-items: center; flex: none; color: var(--color-text-secondary); }
.row__icon .icon { width: 20px; height: 20px; }
.row__title { flex: 1 1 auto; min-width: 0; }
.row__value { color: var(--color-hint); font-size: 13px; line-height: 18px; white-space: nowrap; }
.row__chev { color: var(--color-hint); width: 18px; height: 18px; }

.logo { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo__mark { width: 32px; height: 32px; display: grid; place-items: center; flex: none; color: var(--color-text); }
.logo__mark .icon { width: 24px; height: 24px; }

/* Progress: thin and quiet */
.progress { display: flex; flex-direction: column; gap: 8px; }
.progress__row { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; line-height: 18px; }
.progress__label { color: var(--color-text-secondary); }
.progress__value { color: var(--color-text); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.progress__track { height: 4px; border-radius: var(--radius-full); background: var(--color-border); overflow: hidden; }
/* The fill is full width and slides in from the left: transform only, rounded end kept (AUDIT.md M1). */
.progress__fill { height: 100%; border-radius: var(--radius-full); background: var(--color-accent); transform: translateX(-100%); transition: transform var(--dur-slow) var(--ease-out); }
.progress--deep .progress__fill { background: var(--color-deep); }
.progress--danger .progress__fill { background: var(--color-danger); }
.progress--pro .progress__fill { background: var(--color-pro); }

/* Toasts / alerts */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); font-size: 15px; line-height: 22px; color: var(--color-text); background: var(--color-bg-secondary); }
.alert .icon { width: 20px; height: 20px; margin-top: 1px; color: var(--color-text-secondary); }
.alert__body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.alert--success > .icon { color: var(--color-success); }
.alert--warning > .icon { color: var(--color-warning); }
.alert--danger { background: var(--color-danger-soft); }
.alert--danger > .icon { color: var(--color-danger); }
.alert--sm { font-size: 13px; line-height: 18px; padding: 10px 12px; }
.alert--sm .icon { width: 18px; height: 18px; margin-top: 0; }
.toast-host { position: fixed; left: calc(16px + var(--safe-left)); right: calc(16px + var(--safe-right)); bottom: var(--toast-bottom); z-index: 60; display: flex; flex-direction: column; gap: 8px; pointer-events: none; max-width: 600px; margin: 0 auto; }
.toast { box-shadow: var(--elev-float); pointer-events: auto; animation: toast-in var(--dur-base) var(--ease-out); background: var(--color-text); color: var(--color-bg); }
.toast > .icon { color: var(--color-bg); opacity: .8; }
.toast--out { animation: toast-out var(--dur-exit) var(--ease-out) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ---------- Sheet ---------- */
.sheet-host { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; justify-content: flex-end; }
.sheet-scrim { position: absolute; inset: 0; background: var(--color-scrim); animation: fade-in var(--dur-base) var(--ease-out); }
.sheet {
  position: relative; background: var(--color-bg); border-radius: 20px 20px 0 0; box-shadow: var(--elev-sheet);
  width: 100%; max-width: 640px; margin: 0 auto;
  padding: 8px calc(var(--gutter) + var(--safe-right)) calc(24px + var(--safe-bottom)) calc(var(--gutter) + var(--safe-left));
  display: flex; flex-direction: column; gap: 16px; max-height: calc(var(--app-h) - 24px); overflow-y: auto;
  animation: sheet-in .25s var(--ease-out);
}
.sheet-host--out .sheet { animation: sheet-out var(--dur-base) var(--ease-out) forwards; }
.sheet-host--out .sheet-scrim { animation: fade-out var(--dur-base) var(--ease-out) forwards; }
.sheet__grabber { width: 36px; height: 4px; border-radius: var(--radius-full); background: var(--color-border); margin: 0 auto 4px; flex: none; }
.sheet__body { display: flex; flex-direction: column; gap: 12px; }
.sheet__title { font-size: 17px; line-height: 24px; font-weight: 600; margin: 0; }
.sheet__head { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; text-align: left; }
.sheet__head .t-title { font-size: 20px !important; line-height: 28px !important; }
.sheet__icon { width: 40px; height: 40px; display: grid; place-items: center; color: var(--color-text); }
.sheet__icon .icon { width: 28px; height: 28px; }
.sheet__icon--danger { color: var(--color-danger); }
.sheet__icon--warning { color: var(--color-warning); }
.sheet__icon--success { color: var(--color-success); }
.sheet__options, .sheet__buttons { display: flex; flex-direction: column; gap: 8px; }
.sheet__close { position: absolute; top: 4px; right: 4px; }
@keyframes sheet-in { from { transform: translateY(100%); } }
@keyframes sheet-out { to { transform: translateY(100%); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }

.option { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius); background: var(--color-bg-secondary); text-align: left; width: 100%; color: var(--color-text); transition: background-color var(--dur-press) var(--ease-out); }
.option:active { background: var(--color-press); }
.option__icon { display: grid; place-items: center; flex: none; color: var(--color-text-secondary); }
.option__icon .icon { width: 22px; height: 22px; }
.option__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.option__sub { color: var(--color-text-secondary); font-size: 13px; line-height: 18px; }
.option .row__chev { flex: none; }
.option--pro { background: var(--color-accent); color: var(--color-accent-text); }
.option--pro .option__icon, .option--pro .option__sub, .option--pro .row__chev { color: var(--color-accent-text); opacity: .85; }
.option--pro:active { background: var(--color-accent); opacity: .9; }

/* ---------- Chat ---------- */
.chat-scroll { position: relative; }
.chat-inner { width: 100%; min-width: 0; max-width: 680px; margin: 0 auto; padding: 12px calc(var(--gutter) + var(--safe-right)) 24px calc(var(--gutter) + var(--safe-left)); display: flex; flex-direction: column; min-height: 100%; }
.chat-head { display: flex; flex:none; align-items:center; gap:12px; padding:calc(16px + var(--tg-content-top)) calc(var(--gutter) + var(--safe-right)) 15px calc(var(--gutter) + var(--safe-left)); border-bottom:1px solid var(--color-border); width:100%; max-width:680px; margin:0 auto; }
.chat-head__identity { flex:1; min-width:0; }
.chat-head__name { margin:0; font:600 17px/27px var(--font-display); letter-spacing:0; overflow-wrap:anywhere; }
.chat-head__sub { font-size:12px; line-height:18px; color:var(--color-hint); margin-top:3px; }
.chat-head__help { width:36px; height:44px; display:grid; place-items:center; color:var(--color-hint); flex:none; }
.wordmark { display:inline; }
.terminal-cursor { display:inline-block; width:.48em; height:.15em; margin-left:.15em; background:var(--color-action); vertical-align:baseline; }
.logo-mark { display: block; height: 22px; width: auto; }
.chat-head__tier { font:500 9px/20px var(--font-display); color:var(--color-accent); letter-spacing:.03em; white-space:nowrap; border-left:1px solid var(--color-border); padding-left:12px; }
.empty { display:flex; flex-direction:column; gap:27px; padding-top:24px; }
.greet { display:flex; flex-direction:column; gap:14px; }
.greet .t-title { font-size:24px; line-height:32px; }
.greet .t-body { max-width:440px; font-size:16px; line-height:25px; }
.empty__note { font-size:12px; line-height:19px; color:var(--color-hint); max-width:460px; }
.greet .t-body { color: var(--color-text-secondary); }
.gift { display:flex; gap:10px; align-items:flex-start; border-left:2px solid var(--color-accent); padding:1px 0 1px 12px; color:var(--color-text-secondary); }
.gift > .icon { width: 20px; height: 20px; color: var(--color-pro); margin-top: 1px; }
.gift__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }

/* Optional starting points stay quieter than the composer. */
.tasks { display: flex; flex-direction: column; gap: 4px; }
.tasks__title { margin:0 0 8px; font:500 10px/18px var(--font-display); color:var(--color-hint); }
.tasks__list { display: flex; flex-direction: column; }
.capabilities { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; }
.capabilities li { display:flex; align-items:flex-start; gap:12px; padding:12px 0; border-bottom:1px solid var(--color-border); font-size:15px; line-height:22px; }
.capabilities .icon { width:20px; height:20px; color:var(--color-text-secondary); margin-top:1px; }
.task-row { display:flex; align-items:center; gap:12px; min-height:46px; padding:10px 0; border-bottom:1px solid var(--color-border); text-align:left; color:var(--color-text); transition:background-color var(--dur-press) var(--ease-out); }
.task-row:active { background: var(--color-bg-secondary); }
.task-row__icon { display: grid; place-items: center; color: var(--color-text-secondary); }
.task-row__icon .icon { width: 20px; height: 20px; }
.task-row__label { flex: 1; min-width: 0; font-weight: 400; }
.task-row__check { width: 18px; height: 18px; color: var(--color-accent); opacity: 0; transition: opacity var(--dur-press) var(--ease-out); }
.task-row[aria-pressed="true"] { background: var(--color-bg-secondary); }
.task-row[aria-pressed="true"] .task-row__check { opacity: 1; }
.task-row[aria-pressed="true"] .task-row__label { font-weight: 600; }

.msgs { display: flex; flex-direction: column; gap: 20px; padding-top: 8px; }
.divider { text-align: center; color: var(--color-hint); font-size: 13px; line-height: 18px; padding: 4px 0; }
.bubble { overflow-wrap: anywhere; word-break: break-word; }
.bubble--user { align-self:flex-end; max-width:min(400px,88%); background:var(--color-bg-secondary); color:var(--color-text); border:1px solid var(--color-border); border-radius:8px 8px 2px 8px; padding:12px 14px; display:flex; flex-direction:column; gap:4px; }
.bubble__task { font-size: 13px; line-height: 18px; font-weight: 600; color: var(--color-accent); }
.bubble--user .bubble__time { align-self: flex-end; font-size: 11px; line-height: 14px; color: var(--color-hint); }
.bubble--assistant { display:flex; flex-direction:column; gap:12px; min-width:0; max-width:100%; }
.bubble--error { background: var(--color-danger-soft); border-radius: var(--radius); padding: 12px 14px; }
.bubble__foot { display: flex; flex-direction: column; gap: 8px; }
.bubble__meta { display: flex; align-items: center; gap: 8px; color: var(--color-hint); font-size: 13px; line-height: 18px; }
.bubble__meta > span { flex: 1; min-width: 0; }
.bubble__meta .icon-btn { width: 36px; height: 36px; margin: -8px -8px -8px 0; }
.bubble__meta .icon-btn::after { content: ""; position: absolute; inset: -4px; }
.bubble__meta .icon-btn .icon { width: 18px; height: 18px; }
.bubble__actions { display: flex; gap: 16px; flex-wrap: wrap; }
.bubble__stopped { color: var(--color-hint); font-size: 13px; line-height: 18px; }

/* Rich text from the bot (Telegram HTML subset) */
.rich { white-space:pre-wrap; font-size:16px; line-height:26px; min-width:0; max-width:100%; overflow-wrap:anywhere; }
.bubble--user .rich { font-size: 15px; line-height: 22px; }
.rich.t-caption { font-size: 13px; line-height: 18px; }
.rich b, .rich strong { font-weight: 600; }
.rich a { color: var(--color-accent); text-decoration: none; font-weight: 500; }
.rich a:hover, .rich a:active { text-decoration: underline; }
.cmd { color: var(--color-accent); font-weight: 600; display: inline; font-size: inherit; line-height: inherit; padding: 0; }
.cmd:hover { text-decoration: underline; }
.rich .ref { color: var(--color-accent); font-weight: 600; }
.rich .li { color: var(--color-text-secondary); font-weight: 600; }
.rich .practice { color: var(--color-text-secondary); font-size: 13px; line-height: 20px; }
.rich blockquote { margin: 4px 0; border-left: 2px solid var(--color-accent); padding: 2px 0 2px 14px; color: var(--color-text-secondary); white-space: pre-wrap; }
.rich blockquote .ref { color: var(--color-text); }
.rich code { font-family: var(--font-mono); font-size: 13px; line-height: 18px; background: var(--color-bg-secondary); border-radius: 6px; padding: 1px 5px; }
.rich pre { font-family:var(--font-mono); font-size:13px; line-height:20px; background:var(--color-bg-secondary); border:1px solid var(--color-border); border-radius:4px; padding:12px; overflow-x:auto; white-space:pre; margin:6px 0; max-width:100%; }
.rich pre code { background: none; padding: 0; }
.cursor::after { content: ""; display: inline-block; width: 8px; height: 16px; margin-left: 2px; vertical-align: -2px; background: var(--color-text); border-radius: 2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.notice { align-self: stretch; }

/* Thinking */
.think { display: flex; align-items: center; gap: 10px; align-self: flex-start; min-height: 24px; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--color-text-secondary); animation: wave 1.2s ease-in-out infinite; }
.dots i:nth-child(2) { opacity: .6; animation-delay: .15s; }
.dots i:nth-child(3) { opacity: .3; animation-delay: .3s; }
@keyframes wave { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-4px); } }
.think__text { color: var(--color-text-secondary); font-size: 13px; line-height: 18px; }
.deep { border-left: 2px solid var(--color-deep); padding: 2px 0 2px 14px; display: flex; flex-direction: column; gap: 12px; }
.deep__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--color-deep); font-weight: 600; }
.deep__head > span { display: inline-flex; align-items: center; gap: 8px; }
.deep__head .icon { width: 18px; height: 18px; }
.deep__timer { color: var(--color-hint); font-size: 13px; line-height: 18px; font-weight: 400; font-variant-numeric: tabular-nums; }
.stages { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.stage { display: flex; align-items: center; gap: 10px; color: var(--color-hint); }
.stage .icon { width: 16px; height: 16px; }
.stage--done { color: var(--color-text-secondary); }
.stage--done .icon { color: var(--color-deep); }
.stage--cur { color: var(--color-text); font-weight: 600; }
.stage--cur .icon { color: var(--color-deep); }
.deep__track { height: 2px; border-radius: var(--radius-full); background: rgba(var(--rgb-deep), 0.18); overflow: hidden; }
.deep__fill { height: 100%; background: var(--color-deep); border-radius: inherit; transform: translateX(-90%); transition: transform var(--dur-slow) var(--ease-out); }
.deep__status { color: var(--color-hint); font-size: 13px; line-height: 18px; }

.fab-down { position: absolute; right: calc(16px + var(--safe-right)); bottom: 12px; width: 40px; height: 40px; border-radius: 50%; background: var(--color-bg); color: var(--color-text-secondary); box-shadow: var(--elev-float); display: grid; place-items: center; z-index: 2; }
.fab-down::after { content: ""; position: absolute; inset: -4px; }
.fab-down .icon { width: 20px; height: 20px; }
.chat-main { position: relative; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }

/* Composer remains outside the scroll area, above the keyboard. */
.dock { flex:none; background:var(--color-bg); width:100%; max-width:680px; margin:0 auto; padding:8px calc(12px + var(--safe-right)) 10px calc(12px + var(--safe-left)); }
.app--pushed .dock, .app--kb .dock { padding-bottom: max(8px, var(--safe-bottom)); }
.composer { background:var(--color-bg-secondary); border:1px solid var(--color-border); border-radius:var(--radius-field); padding:4px 7px 7px; display:flex; flex-direction:column; }
.composer:focus-within { border-color:var(--color-accent); }
.composer__field { width: 100%; min-height: 44px; max-height: 160px; resize: none; border: 0; background: transparent; padding: 10px 10px 4px; font-size: 16px; line-height: 22px; color: var(--color-text); display: block; overflow-y: auto; }
.composer__field::placeholder { color: var(--color-hint); }
.composer__field:focus-visible { outline: none; }
.composer__limit { width: 100%; min-height: 44px; padding: 10px; display: flex; align-items: center; gap: 8px; color: var(--color-text-secondary); text-align: left; }
.composer__limit .icon { width: 18px; height: 18px; }
.composer__row { display: flex; align-items: center; gap: 6px; }
.composer__gap { flex: 1; }
.composer__tool { position: relative; width: 36px; height: 36px; border-radius: var(--radius-full); display: grid; place-items: center; color: var(--color-text-secondary); transition: background-color var(--dur-press) var(--ease-out); }
.composer__tool::after { content: ""; position: absolute; inset: -4px; }
.composer__tool:active { background: var(--color-press); }
.composer__tool[aria-pressed="true"] { color: var(--color-accent); }
.composer--locked .composer__row { display: none; }
.mode-switch { display:flex; gap:2px; min-width:0; }
.mode-btn, .deep-toggle { position:relative; display:inline-flex; align-items:center; justify-content:center; gap:6px; min-height:44px; padding:0 9px; border-radius:5px; font:500 10.5px/18px var(--font-display); color:var(--color-text-secondary); white-space:nowrap; }
.mode-btn .icon { width:16px; height:16px; }
.mode-btn[aria-pressed="true"] { color:var(--color-accent); background:var(--color-accent-soft); }
.deep-toggle::after { content: ""; position: absolute; inset: -4px 0; }
.deep-toggle .icon { width: 16px; height: 16px; }
.deep-toggle .short { display: none; }
.deep-toggle:active { background: var(--color-press); }
.deep-toggle[aria-pressed="true"] { background: var(--color-deep-soft); color: var(--color-deep); }
@media (max-width: 340px) { .deep-toggle .long { display: none; } .deep-toggle .short { display: inline; } }
.send { width:44px; height:44px; border-radius:6px; display:grid; place-items:center; flex:none; background:var(--color-action); color:var(--color-accent-text); position:relative; transition:transform var(--dur-press) var(--ease-out); }
.send::after { content: ""; position: absolute; inset: -4px; }
.send:active:not(:disabled) { transform: scale(.94); }
.send .icon { width: 20px; height: 20px; }
.send:disabled { background: var(--color-press); color: var(--color-hint); }
.send--stop { background: var(--color-text); color: var(--color-bg); }
.send--locked, .send--locked:disabled { background: var(--color-press); color: var(--color-hint); }
.taskbar { display: flex; align-items: center; gap: 8px; margin: 4px 4px 0; padding: 6px 6px 6px 10px; align-self: flex-start; max-width: calc(100% - 8px); border-radius: var(--radius-full); background: var(--color-accent-soft); color: var(--color-accent); font-size: 13px; line-height: 18px; font-weight: 600; }
.taskbar__icon .icon { width: 16px; height: 16px; }
.taskbar__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.taskbar__off { position: relative; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: inherit; opacity: .8; }
.taskbar__off::after { content: ""; position: absolute; inset: -11px; }
.usage { text-align:center; color:var(--color-hint); font:400 9px/16px var(--font-display); padding:7px 0 0; font-variant-numeric:tabular-nums; }
.usage--danger { color: var(--color-danger); }

/* ---------- Tariffs ---------- */
.tariff { border-top:1px solid var(--color-border); padding:20px 0 0; display:flex; flex-direction:column; gap:16px; }
.payment-stub { display:flex; align-items:flex-start; gap:12px; background:var(--color-bg-secondary); border-left:2px solid var(--color-accent); padding:16px; }
.payment-stub > .icon { flex:none; color:var(--color-accent); margin-top:3px; }
.payment-stub .t-h2 { font:600 15px/22px var(--font); margin-bottom:8px; }
.doc-links { display:flex; flex-wrap:wrap; gap:12px 20px; font-size:12px; }
.payment-stub p { margin:0; }
.price__alt { margin-left:auto; white-space:nowrap; }
.pay { display:flex; flex-direction:column; gap:12px; }
.pay .t-caption { margin:0; text-align:center; }
.pay__terms { text-align:center; }
.back-link { display:flex; gap:8px; align-items:center; min-height:44px; align-self:flex-start; color:var(--color-accent); font:500 10.5px/18px var(--font-display); }
.auth-art { width:100%; max-width:480px; max-height:200px; object-fit:cover; border-radius:4px; }
.state { overflow-y:auto; }
.tariff__head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.tariff__head .t-h2 { font-size: 15px; }
.price { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.benefits { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.benefits li { display: flex; gap: 10px; align-items: flex-start; }
.benefits .icon { width: 18px; height: 18px; color: var(--color-text-secondary); margin-top: 2px; }
.tariff--pro .benefits .icon { color: var(--color-accent); }
.pay-meta { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; color: var(--color-text-secondary); font-size: 13px; line-height: 18px; }
.pay-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.pay-meta .icon { width: 14px; height: 14px; }
.details summary { cursor: pointer; color: var(--color-text); font-weight: 600; list-style: none; display: flex; align-items: center; gap: 8px; min-height: 44px; }
.details summary::-webkit-details-marker { display: none; }
.details summary .icon { width: 18px; height: 18px; color: var(--color-hint); transition: transform var(--dur-base) var(--ease-out); }
.details[open] summary .icon { transform: rotate(90deg); }

/* ---------- Profile ---------- */
.user-row { display: flex; align-items: center; gap: 14px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--color-bg); color: var(--color-text); display: grid; place-items: center; font-weight: 600; flex: none; overflow: hidden; }
.user-row__text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.user-row__text > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.linkbox { display: flex; align-items: center; gap: 8px; background: var(--color-bg); border-radius: var(--radius); padding: 4px 4px 4px 14px; min-height: 48px; }
.linkbox__text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--color-text-secondary); font-family: var(--font); font-size: 14px; }
.linkbox .icon-btn { width: 40px; height: 40px; color: var(--color-text); }
.linkbox .icon-btn::after { content: ""; position: absolute; inset: -2px; }
.linkbox .icon-btn .icon { width: 18px; height: 18px; }
.inline-meta { display: flex; align-items: center; gap: 8px; color: var(--color-text-secondary); font-size: 13px; line-height: 18px; }
.inline-meta .icon { width: 16px; height: 16px; color: var(--color-hint); }
.promo { display: flex; gap: 8px; }
.input { flex: 1; min-width: 0; height: 48px; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-bg); padding: 0 14px; color: var(--color-text); font-size: 16px; }
.input--mono { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .02em; }
.input--mono::placeholder { text-transform: none; letter-spacing: 0; }
.input::placeholder, .textarea::placeholder { color: var(--color-hint); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--color-danger); }
.input:focus-visible, .textarea:focus-visible { outline: none; border-color: var(--color-accent); }
.promo .btn { width: auto; min-width: 104px; height: 48px; flex: none; padding: 0 16px; background: var(--color-text); color: var(--color-bg); }
.field-msg { font-size: 13px; line-height: 18px; display: flex; gap: 6px; align-items: flex-start; }
.field-msg .icon { width: 16px; height: 16px; margin-top: 1px; }
.field-msg--error { color: var(--color-danger); }
.field-msg--ok { color: var(--color-success); }
.textarea { width: 100%; min-height: 120px; resize: vertical; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-bg); padding: 12px 14px; font-size: 16px; line-height: 22px; color: var(--color-text); }

/* Support tickets */
.ticket { display: flex; flex-direction: column; }
.ticket__row { display: flex; gap: 12px; align-items: center; padding: 14px 16px; text-align: left; width: 100%; color: var(--color-text); min-height: 56px; transition: background-color var(--dur-press) var(--ease-out); }
.ticket + .ticket { border-top: 1px solid var(--color-border); }
.ticket__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ticket__title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status { font-size: 13px; line-height: 18px; font-weight: 600; white-space: nowrap; flex: none; }
.status--open { color: var(--color-warning); }
.status--done { color: var(--color-success); }
.status--closed { color: var(--color-hint); }
.ticket__body { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.reply { background: var(--color-bg); border-radius: var(--radius); padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.reply--staff { background: var(--color-accent-soft); }

/* Document */
.doc .rich { white-space: pre-wrap; font-size: 15px; line-height: 24px; }
.doc .rich b:first-child { font-size: inherit; }

/* ---------- Full-screen states ---------- */
.state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px; padding: 32px calc(28px + var(--safe-right)) calc(32px + var(--safe-bottom)) calc(28px + var(--safe-left)); }
.state .btn { max-width: 320px; margin-top: 8px; }
.state__icon { width: 48px; height: 48px; display: grid; place-items: center; color: var(--color-text-secondary); margin-bottom: 4px; }
.state__icon .icon { width: 32px; height: 32px; }
.state__icon--danger { color: var(--color-danger); }
.state__icon--warning { color: var(--color-warning); }

/* Skeleton */
.skel { background: var(--color-bg-secondary); border-radius: var(--radius); position: relative; overflow: hidden; }
.skel::after { content:""; position:absolute; inset:0; background:var(--color-press); animation:pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity:.35; } }
.skel-stack { display: flex; flex-direction: column; gap: 12px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .spin { animation: none !important; }
  .dots i { animation: none !important; }
}
@media (hover: hover) {
  .row:hover, .option:hover, .ticket__row:hover, .task-row:hover { background: var(--color-press); }
  .option--pro:hover { background: var(--color-accent); opacity: .92; }
  .composer__tool:hover, .deep-toggle:hover:not([aria-pressed="true"]) { background: var(--color-press); }
}

/* Подписи-«ярлыки» на экране входа и в карточке тарифа — шрифт заголовков, не код. */
.state .t-mono, .tariff__head .t-mono { font-family: var(--font-display); font-weight: 500; font-size: 11px; letter-spacing: .02em; }
