/* Нейросеть МГЮА — Telegram Mini App. Minimal style: miniapp/STYLE.md (tokens, rules, screens). */
:root {
  --color-bg:#FFFFFF; --color-bg-secondary:#F4F4F5; --color-surface:var(--color-bg-secondary); --color-press:#EBEBED;
  --color-text:#111113; --color-text-secondary:#5E5E66; --color-hint:#6E6E76;
  --color-accent:#1F3A6E; --color-accent-text:#FFFFFF; --color-accent-soft:#E8EDF6; --color-border:#E4E4E7;
  --color-success:#1E7A4C; --color-success-soft:#E6F2EB; --color-warning:#8F5506; --color-warning-soft:#FBF1E1;
  --color-danger:#B3261E; --color-danger-soft:#FBE9E7;
  --color-pro:#8A5F12; --color-pro-soft:#FAF3E4;
  --color-brand:#C8102E; /* красный логотипа MSAL AI — только в логотипе */
  --color-deep:#0E6B6B; --color-deep-soft:#E3F1F0; --color-fast:#1F3A6E;
  --color-scrim:rgba(10,10,12,.4);
  --rgb-accent:31,58,110; --rgb-deep:14,107,107; --rgb-danger:179,38,30;

  --font: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --gutter: 20px;
  --radius: 12px; --radius-field: 20px; --radius-full: 999px;
  --elev-sheet: 0 -12px 40px rgba(0,0,0,.12);
  --elev-float: 0 4px 20px rgba(0,0,0,.12);

  --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:#0E0F11; --color-bg-secondary:#1B1C1F; --color-press:#25262A;
  --color-text:#F2F2F3; --color-text-secondary:#A1A1A8; --color-hint:#8D8D95;
  --color-accent:#8FB0F0; --color-accent-text:#0B1528; --color-accent-soft:#1C2537; --color-border:#2A2B30;
  --color-success:#4CC38A; --color-success-soft:#14271D; --color-warning:#F0B44C; --color-warning-soft:#2C2312;
  --color-danger:#F2766B; --color-danger-soft:#33191A;
  --color-pro:#E5BE6E; --color-pro-soft:#2A2315;
  --color-brand:#F0506A;
  --color-deep:#5CC8C3; --color-deep-soft:#13292A; --color-fast:#8FB0F0;
  --color-scrim:rgba(0,0,0,.6);
  --rgb-accent:143,176,240; --rgb-deep:92,200,195; --rgb-danger:242,118,107;
  --elev-sheet: 0 -12px 40px rgba(0,0,0,.5);
  --elev-float: 0 4px 20px rgba(0,0,0,.5);
  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: 28px; line-height: 34px; font-weight: 600; letter-spacing: -0.02em; }
.t-title { font-size: 28px; line-height: 34px; font-weight: 600; letter-spacing: -0.02em; margin: 0; }
.t-h2 { font-size: 17px; line-height: 24px; font-weight: 600; letter-spacing: -0.01em; 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; }

/* ---------- Tab bar ---------- */
.tabbar {
  flex: none; display: grid; grid-template-columns: repeat(3, 1fr);
  position: relative; z-index: 3; /* приподнятая кнопка «Чат» заходит на экран выше, который position:absolute */
  background: var(--color-bg);
  padding: 4px calc(8px + var(--safe-right)) max(8px, var(--safe-bottom)) calc(8px + var(--safe-left));
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; min-height: 48px; color: var(--color-hint); border-radius: var(--radius); transition: color var(--dur-press) var(--ease-out); }
.tab__pill { display: grid; place-items: center; height: 26px; }
.tab__pill .icon { width: 22px; height: 22px; }
.tab__label { font-size: 11px; line-height: 14px; font-weight: 600; }
.tab[aria-current="page"] { color: var(--color-text); }
/* Главная вкладка «Чат»: круглая кнопка в акценте, приподнята над баром на 10 px — единственный акцент на экране */
.tab--main { padding-top: 0; margin-top: -10px; }
.tab--main .tab__pill {
  width: 54px; height: 54px; border-radius: var(--radius-full);
  background: var(--color-accent); color: var(--color-accent-text);
  box-shadow: 0 0 0 4px var(--color-bg); /* taste-skill-ignore: зазор до фона, не тень */
  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 .tab__label { margin-top: 2px; }
.tab:not(.tab--main) { padding-top: 20px; } /* подписи боковых вкладок на одной линии с подписью «Чат» */
.tab--main[aria-current="page"] .tab__label { color: var(--color-accent); }
.tab--main:active .tab__pill { transform: scale(.94); opacity: .9; }
.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-accent); 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 { background: var(--color-bg-secondary); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.rows { background: var(--color-bg-secondary); border-radius: var(--radius); 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); }

/* ---------- University cabinet ---------- */
.university { gap: 24px; padding-bottom: calc(32px + var(--safe-bottom)); }
.university__head { gap: 8px; }
.university__topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 32px; }
.university__brand { display: inline-flex; align-items: center; }
.university__back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; margin: -6px 0 -6px -4px; padding: 0 4px; color: var(--color-text-secondary); }
.university__back .icon { transform: rotate(180deg); }
.university__identity { display: flex; flex-direction: column; gap: 4px; }
.university__sync { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.university__refresh { min-height: 44px; padding: 0 4px; color: var(--color-accent); font-size: 13px; flex: none; }
.university__content, .university__records, .university__module { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.university__content { gap: 24px; }
.university__nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.university__destination { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 64px; padding: 12px; text-align: left; background: var(--color-bg-secondary); border-radius: var(--radius); transition: background-color var(--dur-press) var(--ease-out); }
.university__destination > span { min-width: 0; overflow-wrap: anywhere; }
.university__destination[data-section="recordbook"] { grid-column: 1 / -1; }
.university__booking { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 72px; padding: 16px; border-radius: var(--radius); background: var(--color-bg-secondary); text-align: left; transition: background-color var(--dur-press) var(--ease-out); }
.university__booking-text { display: flex; flex-direction: column; gap: 4px; }
.university__destination:active, .university__booking:active { background: var(--color-press); }
.university__back:active, .university__refresh:active { opacity: .65; }
.university__filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.university__filter { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.university__select { width: 100%; min-height: 48px; padding: 0 12px; border: 0; border-radius: var(--radius); background: var(--color-bg-secondary); font-size: 15px; }
.university__select:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.university__record { gap: 8px; padding: 16px; min-width: 0; overflow-wrap: anywhere; }
.university__entry-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.university__entry-head h3 { margin: 0; }
.university__mark { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; font-variant-numeric: tabular-nums; }
.university__period { display: flex; flex-direction: column; gap: 12px; }
.university__period + .university__period, .university__module + .university__module { margin-top: 12px; }
.university__ratings { display: flex; flex-direction: column; gap: 6px; }
.university__detail { overflow-wrap: anywhere; }
.university__detail-label { color: var(--color-text-secondary); }
.university__open { align-self: flex-start; width: auto; justify-content: flex-start; padding: 0; min-height: 44px; }
.university__total, .university__rating { gap: 8px; }
.university__roster { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; color: var(--color-text-secondary); }
.university__empty { padding: 16px; background: var(--color-bg-secondary); border-radius: var(--radius); }
.university .state { align-items: flex-start; text-align: left; padding: 16px 0; }
.university .skel::after { display: none; }
@media (max-width: 360px) { .university__destination { min-height: 72px; } }

/* 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: 22px !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%; max-width: 680px; margin: 0 auto; padding: calc(4px + var(--tg-content-top)) 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; align-items: baseline; justify-content: space-between; gap: 12px; padding: 12px 0 8px; }
.chat-head__name { margin: 0; font-size: 17px; line-height: 24px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; min-height: 24px; }
.logo-mark { display: block; height: 22px; width: auto; }
.chat-head__tier { font-size: 13px; line-height: 18px; font-weight: 600; color: var(--color-hint); white-space: nowrap; }
.empty { display: flex; flex-direction: column; gap: 32px; padding-top: 28px; }
.greet { display: flex; flex-direction: column; gap: 8px; }
.greet .t-body { color: var(--color-text-secondary); }
.gift { display: flex; gap: 12px; align-items: flex-start; }
.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; }

/* Help modes («Разобрать казус»…): a list of plain rows, the chosen one marked */
.tasks { display: flex; flex-direction: column; gap: 4px; }
.tasks__title { margin: 0 0 4px; font-size: 13px; line-height: 18px; font-weight: 600; color: var(--color-hint); }
.tasks__list { display: flex; flex-direction: column; }
.task-row { display: flex; align-items: center; gap: 14px; min-height: 48px; padding: 10px 12px; margin: 0 -12px; border-radius: var(--radius); 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(320px, 82%); background: var(--color-bg-secondary); color: var(--color-text); border-radius: 18px 18px 6px 18px; padding: 10px 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; }
.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: 25px; }
.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: 18px; background: var(--color-bg-secondary); border-radius: 10px; padding: 10px 12px; overflow-x: auto; white-space: pre; margin: 4px 0; }
.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; }

/* Dock: composer like DeepSeek — one surface: task bar, field, tool row */
.dock { flex: none; background: var(--color-bg); width: 100%; max-width: 680px; margin: 0 auto; padding: 4px calc(12px + var(--safe-right)) 12px calc(12px + var(--safe-left)); } /* 12 снизу: кольцо кнопки «Чат» выступает на 10 px */
.app--pushed .dock, .app--kb .dock { padding-bottom: max(8px, var(--safe-bottom)); }
.composer { background: var(--color-bg-secondary); border-radius: var(--radius-field); padding: 4px 6px 6px; display: flex; flex-direction: column; transition: box-shadow var(--dur-press) var(--ease-out); }
.composer:focus-within { box-shadow: 0 0 0 1.5px rgba(var(--rgb-accent), .45); }
.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; }
.deep-toggle { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: var(--radius-full); font-size: 13px; line-height: 18px; font-weight: 600; color: var(--color-text-secondary); white-space: nowrap; transition: background-color var(--dur-press) var(--ease-out), color var(--dur-press) var(--ease-out); }
.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: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--color-text); color: var(--color-bg); position: relative; transition: background-color var(--dur-press) var(--ease-out), color var(--dur-press) var(--ease-out), 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-size: 12px; line-height: 16px; padding: 8px 8px 0; font-variant-numeric: tabular-nums; }
.usage--danger { color: var(--color-danger); }

/* ---------- Tariffs ---------- */
.tariff { background: var(--color-bg-secondary); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.tariff--pro { box-shadow: inset 0 0 0 1.5px var(--color-accent); }
.tariff__head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.tariff__head .t-h2 { font-size: 17px; }
.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); }
.plans { display: flex; flex-direction: column; gap: 8px; }
.option--plan { background: var(--color-bg); }
.option--plan[aria-pressed="true"] { box-shadow: inset 0 0 0 1.5px var(--color-accent); }
.option--plan > .icon { flex: none; width: 20px; height: 20px; 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 { 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; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent); animation: shimmer 1.4s infinite; } /* taste-skill-ignore: loading shimmer */
[data-theme="dark"] .skel::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,.07), transparent); } /* taste-skill-ignore: loading shimmer */
@keyframes shimmer { to { transform: translateX(100%); } }
.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: spin 1.6s linear infinite !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); }
}
