:root {
  color-scheme: dark;
  --page: var(--tg-theme-bg-color, #0b131b);
  --surface: var(--tg-theme-secondary-bg-color, #131f2a);
  --surface-raised: #192735;
  --surface-soft: rgba(255, 255, 255, 0.055);
  --text: var(--tg-theme-text-color, #f6f8fa);
  --muted: var(--tg-theme-hint-color, #8fa0ae);
  --muted-strong: #b6c1c9;
  --accent: #ffd02f;
  --accent-strong: #ffbd0a;
  --accent-ink: #241b00;
  --telegram: var(--tg-theme-link-color, #61b6f2);
  --success: #63d39b;
  --danger: #ff7d78;
  --border: var(--tg-theme-section-separator-color, rgba(255,255,255,.09));
  --safe-top: var(--tg-content-safe-area-inset-top, env(safe-area-inset-top, 0px));
  --safe-right: var(--tg-content-safe-area-inset-right, env(safe-area-inset-right, 0px));
  --safe-bottom: var(--tg-content-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  --safe-left: var(--tg-content-safe-area-inset-left, env(safe-area-inset-left, 0px));
}

.settings-dialog {
  width: min(520px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 18px;
  color: var(--text);
  background: var(--surface-raised);
  box-shadow: 0 24px 80px rgba(0,0,0,.45);
}
.settings-dialog::backdrop { background: rgba(3,8,16,.72); backdrop-filter: blur(3px); }
.settings-dialog__header { display: flex; align-items: start; justify-content: space-between; padding: 24px 24px 18px; border-bottom: 1px solid var(--border); }
.settings-dialog__header p { margin: 0 0 4px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .12em; }
.settings-dialog__header h2 { margin: 0; font-size: 22px; }
.settings-dialog__close { border: 0; color: var(--muted); background: transparent; font-size: 28px; line-height: 1; cursor: pointer; }
.settings-dialog__loading, .settings-dialog__error { margin: 24px; }
.settings-dialog__error { padding: 12px; border-radius: 10px; color: #ffd3d3; background: rgba(203,63,63,.18); }
.workspace-sync { display: grid; gap: 12px; padding: 24px; border-bottom: 1px solid var(--border); }
.workspace-sync h3, .workspace-sync p { margin: 0; }
.workspace-sync > p { color: var(--muted); font-size: 13px; line-height: 1.5; }
.workspace-sync form { display: flex; gap: 10px; }
.workspace-sync input { min-width: 0; flex: 1; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); background: var(--surface); font: inherit; }
.workspace-sync form .button { width: auto; white-space: nowrap; }
.credential-import { display: grid; gap: 14px; padding: 24px; border-bottom: 1px solid var(--border); }
.credential-import h3, .credential-import p, .credential-list > h3 { margin: 0; }
.credential-import p { color: var(--muted); font-size: 13px; line-height: 1.5; }
.credential-import textarea { width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); background: var(--surface); font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; box-sizing: border-box; resize: vertical; }
.credential-import textarea:focus { outline: 2px solid rgba(255,205,61,.35); border-color: var(--accent); }
.credential-list > h3 { padding: 24px 24px 0; }
.credential-form { display: grid; gap: 14px; padding: 24px; }
.credential-form > label { font-size: 15px; font-weight: 700; }
.credential-form > code { width: fit-content; padding: 3px 7px; border-radius: 6px; color: var(--muted-strong); background: var(--surface-soft); font-size: 12px; }
.credential-form > p { margin: -6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.credential-form + .credential-form { border-top: 1px solid var(--border); }
.credential-form input, .credential-form textarea { width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); background: var(--surface); font: inherit; box-sizing: border-box; }
.credential-form textarea { resize: vertical; }
.credential-form input:focus, .credential-form textarea:focus { outline: 2px solid rgba(255,205,61,.35); border-color: var(--accent); }
.credential-actions { display: flex; justify-content: flex-end; gap: 10px; }
.credential-actions .button { width: auto; min-height: 40px; padding: 0 16px; }
.credential-remove { color: #ffb9b9; border-color: rgba(255,100,100,.28); background: transparent; }

* { box-sizing: border-box; }
html, body { min-height: 100%; }
html { background: var(--page); }
body {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  background: var(--page);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button, textarea, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; }

.app-shell {
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--page);
}

.loading-view,
.auth-view {
  min-height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 32px;
  text-align: center;
}
.loading-view { color: var(--muted); gap: 16px; }
.loading-view p { margin: 0; font-size: 14px; }

.brand-mark {
  position: relative;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
}
.brand-mark--large { width: 72px; height: 72px; }
.brand-mark__wing {
  position: absolute;
  top: 3%;
  width: 52%;
  height: 54%;
  border: 2px solid rgba(255,255,255,.72);
  border-radius: 70% 45% 65% 45%;
  background: rgba(255,255,255,.15);
}
.brand-mark__wing--left { left: 1%; transform: rotate(-31deg); }
.brand-mark__wing--right { right: 1%; transform: scaleX(-1) rotate(-31deg); }
.brand-mark__body {
  position: absolute;
  left: 27%;
  top: 23%;
  width: 46%;
  height: 67%;
  overflow: hidden;
  border: 2px solid #241b00;
  border-radius: 48% 48% 54% 54%;
  background: var(--accent);
  transform: rotate(-4deg);
}
.brand-mark__body i {
  position: absolute;
  left: -10%;
  width: 120%;
  height: 16%;
  border-radius: 99px;
  background: #241b00;
}
.brand-mark__body i:first-child { top: 40%; }
.brand-mark__body i:last-child { top: 68%; }
.brand-mark--large .brand-mark__wing { border-width: 3px; }
.brand-mark--large .brand-mark__body { border-width: 3px; }

.auth-card {
  width: min(100%, 430px);
  padding: 38px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: 0 25px 60px rgba(0, 0, 0, .3);
}
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 13px; }
.auth-brand strong {
  font-size: 30px;
  font-weight: 850;
  letter-spacing: -.055em;
}
.auth-card h1 {
  margin: 30px 0 10px;
  font-size: clamp(27px, 5vw, 36px);
  line-height: 1.06;
  letter-spacing: -.045em;
}
.auth-card > p {
  max-width: 34ch;
  margin: 0 auto 28px;
  color: var(--muted-strong);
  font-size: 14px;
  line-height: 1.6;
}
.auth-actions { display: grid; gap: 11px; }
.button {
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 20px;
  border: 0;
  border-radius: 15px;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
  transition: transform .18s ease, filter .18s ease, opacity .18s ease;
}
.button:hover { transform: translateY(-1px); filter: brightness(1.04); }
.button:disabled { opacity: .55; cursor: wait; transform: none; }
.button--telegram { color: white; background: #229ed9; }
.button--local {
  color: var(--text);
  border: 1px solid var(--border);
  background: rgba(255,255,255,.055);
}
.button--disabled {
  color: var(--muted-strong);
  border: 1px solid var(--border);
  background: rgba(255,255,255,.035);
  cursor: not-allowed;
}
.button--disabled:hover { transform: none; filter: none; }
.button svg { width: 20px; height: 20px; }
.auth-note { margin-top: 18px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.auth-error {
  margin: 0 0 18px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 125, 120, .28);
  border-radius: 12px;
  color: #ffc1be;
  background: rgba(255, 125, 120, .08);
  font-size: 13px;
}

.chat-layout {
  position: relative;
  height: 100%;
  display: grid;
  grid-template-columns: 260px minmax(420px, 1fr) 380px;
}
.sidebar {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 24px 18px 18px;
  border-right: 1px solid var(--border);
  background: var(--surface);
}
.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 8px 25px;
}
.sidebar__brand strong { font-size: 24px; font-weight: 850; letter-spacing: -.05em; }
.context-list { display: grid; gap: 8px; }
.context-card {
  width: 100%;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--text);
  background: rgba(255,255,255,.025);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.context-card--active {
  border-color: rgba(255, 208, 47, .2);
  background: rgba(255,208,47,.1);
}
.context-card__icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--accent-ink);
  background: var(--accent);
  font-size: 12px;
  font-weight: 850;
  overflow: hidden;
}
.context-card__icon img { width: 100%; height: 100%; object-fit: cover; }
.context-card strong, .context-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.context-card strong { font-size: 14px; }
.context-card small { margin-top: 4px; color: var(--muted); font-size: 12px; }
.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(99,211,155,.09);
}
.sidebar__footer { margin-top: auto; }
.user-card {
  display: grid;
  grid-template-columns: 42px minmax(0,1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-top: 1px solid var(--border);
}
.avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  color: var(--accent-ink);
  background: var(--accent);
  font-size: 12px;
  font-weight: 850;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-card strong, .user-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-card strong { font-size: 14px; }
.user-card small { margin-top: 3px; color: var(--muted); font-size: 12px; }
.icon-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}
.icon-button:hover { color: var(--text); background: var(--surface-soft); }
.icon-button svg { width: 17px; height: 17px; }

.chat-panel {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--page);
}
.chat-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--page);
}
.chat-header__identity { min-width: 0; display: flex; align-items: center; gap: 12px; }
.mobile-brand { display: none; }
.chat-header h1 {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 18px;
  letter-spacing: -.015em;
}
.chat-header p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.channel-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  border: 1px solid rgba(97,182,242,.18);
  border-radius: 999px;
  color: #a9d9f8;
  background: rgba(97,182,242,.07);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.channel-pill svg { width: 14px; height: 14px; }

.messages {
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 28px clamp(18px, 4vw, 48px) 22px;
}
.messages-area {
  position: relative;
  min-height: 0;
}
.messages::-webkit-scrollbar { width: 8px; }
.messages::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 9px; background: rgba(255,255,255,.12); background-clip: content-box; }
.empty-state {
  min-height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 30px;
  text-align: center;
}
.empty-state__icon {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,208,47,.22);
  border-radius: 24px;
  color: var(--accent);
  background: rgba(255,208,47,.07);
  font-size: 30px;
}
.empty-state h2 { margin: 20px 0 8px; font-size: 21px; letter-spacing: -.03em; }
.empty-state p { max-width: 39ch; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.empty-state__actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
}
.context-loading {
  min-height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  padding: 30px;
  color: var(--muted);
  text-align: center;
}
.context-loading strong { color: var(--text); font-size: 16px; }
.context-loading p { margin: 0; font-size: 13px; }
.context-loading__spinner {
  width: 22px;
  height: 22px;
  display: inline-block;
  border: 2px solid rgba(255,255,255,.16);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: context-spin .8s linear infinite;
}
.context-refreshing {
  position: absolute;
  top: 12px;
  left: 50%;
  z-index: 3;
  width: max-content;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(13,21,29,.94);
  font-size: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.22);
  pointer-events: none;
  transform: translateX(-50%);
}
.context-refreshing[hidden] { display: none; }
.context-refreshing .context-loading__spinner { width: 14px; height: 14px; }
@keyframes context-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .context-loading__spinner { animation: none; }
}

.conversation-item {
  margin: 0 0 24px;
  border-radius: 18px;
  outline: 0;
  transition: background .2s ease, box-shadow .2s ease;
}
.conversation-item--skill { cursor: pointer; }
.conversation-item--skill:hover,
.conversation-item--skill:focus-visible {
  background: rgba(255,255,255,.025);
  box-shadow: 0 0 0 8px rgba(255,255,255,.025);
}
.conversation-item--highlight {
  background: rgba(255,208,47,.075);
  box-shadow: 0 0 0 9px rgba(255,208,47,.075);
}
.message-row,
.message-row--assistant { display: flex; justify-content: flex-start; }
.message-bubble { max-width: min(78%, 560px); }
.message-bubble__meta {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  margin: 0 5px 6px;
  color: var(--muted);
  font-size: 12px;
}
.message-bubble__body {
  padding: 12px 15px;
  border: 1px solid rgba(255,208,47,.18);
  border-radius: 5px 18px 18px 18px;
  color: #fff8dd;
  background: rgba(255,208,47,.14);
  font-size: 15px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.message-bubble--assistant .message-bubble__meta {
  justify-content: flex-start;
}
.message-bubble--assistant .message-bubble__body {
  border-color: var(--border);
  border-radius: 5px 18px 18px 18px;
  color: var(--text);
  background: var(--surface-raised);
}
.message-menu {
  display: grid;
  gap: 6px;
  margin-top: 7px;
}
.message-menu__action {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  color: var(--text);
  background: var(--surface-raised);
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.message-menu__action:hover:not(:disabled) {
  border-color: var(--yellow);
  background: rgba(255,208,47,.12);
}
.message-menu__action:disabled { cursor: default; opacity: .55; }
.delivery-mark { color: var(--success); letter-spacing: -3px; padding-right: 3px; }
.delivery-mark--pending { color: var(--muted); letter-spacing: 0; }
.delivery-mark--failed { color: var(--danger); letter-spacing: 0; }

.task-row { display: flex; justify-content: flex-start; margin-top: 11px; }
.task-card {
  width: min(82%, 610px);
  padding: 15px 16px 14px;
  border: 1px solid var(--border);
  border-radius: 6px 18px 18px 18px;
  background: var(--surface-raised);
  box-shadow: 0 12px 30px rgba(0,0,0,.11);
}
.task-card__header { display: flex; align-items: flex-start; gap: 11px; }
.task-card__indicator {
  position: relative;
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 9px;
  color: var(--accent-ink);
  background: var(--accent);
  font-size: 13px;
  font-weight: 900;
}
.task-card--active .task-card__indicator::after {
  content: "";
  position: absolute;
  inset: -4px;
  border: 1px solid rgba(255,208,47,.55);
  border-radius: 12px;
  animation: pulse 1.8s ease-out infinite;
}
@keyframes pulse {
  0% { opacity: .75; transform: scale(.84); }
  75%, 100% { opacity: 0; transform: scale(1.32); }
}
.task-card__copy { min-width: 0; flex: 1; }
.task-card__copy strong { display: block; font-size: 14px; letter-spacing: -.01em; }
.task-card__activity {
  margin-top: 5px;
  color: var(--muted-strong);
  font-size: 12px;
  line-height: 1.45;
}
.task-card__elapsed { color: var(--accent); font-variant-numeric: tabular-nums; }
.task-card__result {
  margin: 13px 0 0;
  padding-top: 13px;
  border-top: 1px solid var(--border);
  color: #edf2f5;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.task-card__result a { color: var(--telegram); text-decoration: underline; text-underline-offset: 3px; }
.task-card__footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 11px;
  color: var(--muted);
  font-size: 11px;
}
.task-card--failed { border-color: rgba(255,125,120,.22); }
.task-card--failed .task-card__indicator { color: white; background: #c94f4b; }
.task-card--success .task-card__indicator { color: #052417; background: var(--success); }
.task-timeline {
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  color: var(--muted-strong);
  font-size: 12px;
}
.task-timeline summary { cursor: pointer; }
.task-timeline ol { margin: 8px 0 0; padding: 0; list-style: none; }
.task-timeline li { margin: 4px 0; }
.task-timeline time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.composer-shell {
  padding: 12px 22px max(16px, var(--safe-bottom));
  border-top: 1px solid var(--border);
  background: rgba(11, 20, 28, .92);
}
.quick-actions { display: flex; gap: 8px; margin: 0 0 9px; overflow-x: auto; }
.quick-action {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(255,208,47,.18);
  border-radius: 999px;
  color: #ffe999;
  background: rgba(255,208,47,.06);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.composer {
  display: grid;
  grid-template-columns: minmax(0,1fr) 43px;
  align-items: end;
  gap: 9px;
  padding: 7px 7px 7px 15px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.composer:focus-within { border-color: rgba(255,208,47,.38); box-shadow: 0 0 0 3px rgba(255,208,47,.055); }
.composer textarea {
  width: 100%;
  max-height: 110px;
  min-height: 29px;
  resize: none;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 14px;
  line-height: 1.5;
}
.composer textarea::placeholder { color: #71818d; }
.send-button {
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 13px;
  color: var(--accent-ink);
  background: var(--accent);
  cursor: pointer;
}
.send-button:disabled { opacity: .45; cursor: wait; }
.send-button svg { width: 19px; height: 19px; }

.skills-panel {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-left: 1px solid var(--border);
  background: #101a23;
}
.skill-panel__scroll {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px 18px 30px;
}
.skill-panel__scroll::-webkit-scrollbar { width: 8px; }
.skill-panel__scroll::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 9px; background: rgba(255,255,255,.12); background-clip: content-box; }
.skill-panel__header { margin-bottom: 24px; }
.skill-panel__eyebrow {
  margin: 0 0 11px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.skill-toolbar {
  display: grid;
  grid-template-columns: minmax(0,1fr) 34px;
  align-items: center;
  gap: 7px;
}
.combo {
  position: relative;
  min-width: 0;
  width: 100%;
}
.combo__trigger {
  width: 100%;
  min-width: 0;
  height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  background: rgba(255,255,255,.045);
  text-align: left;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
.combo__trigger:hover,
.combo__trigger[aria-expanded="true"] {
  border-color: rgba(255,208,47,.35);
  background: rgba(255,255,255,.07);
}
.combo__trigger:focus-visible {
  outline: 2px solid rgba(255,208,47,.5);
  outline-offset: 2px;
}
.combo__trigger:disabled { opacity: .58; cursor: not-allowed; }
.combo__mark {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  color: var(--accent-ink);
  background: var(--accent);
  font-size: 10px;
  font-weight: 900;
}
.combo__value {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  font-size: 14px;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.combo__meta {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: capitalize;
}
.combo__chevron {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--muted);
  transition: transform .16s ease;
}
.combo__trigger[aria-expanded="true"] .combo__chevron { transform: rotate(180deg); }
.combo__chevron svg { width: 17px; }
.combo__menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 7px);
  right: 0;
  left: 0;
  max-height: 280px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 14px;
  background: #172630;
  box-shadow: 0 18px 45px rgba(0,0,0,.42), 0 2px 8px rgba(0,0,0,.25);
}
.combo__option {
  width: 100%;
  min-height: 43px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border: 0;
  border-radius: 10px;
  color: var(--text);
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.combo__option:hover,
.combo__option:focus-visible { outline: 0; background: rgba(255,255,255,.075); }
.combo__option--selected { background: rgba(255,208,47,.08); }
.combo__option-copy { min-width: 0; display: grid; flex: 1; gap: 2px; }
.combo__option-copy strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.combo__option-copy small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  text-transform: capitalize;
}
.combo__check { color: transparent; font-size: 13px; font-weight: 900; }
.combo__option--selected .combo__check { color: var(--accent); }
.combo--model .combo__trigger {
  height: 40px;
  border-radius: 10px;
}
.combo--model .combo__menu {
  right: 0;
  left: auto;
  width: min(260px, calc(100vw - 40px));
}
.skill-toolbar__add {
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted-strong);
  background: rgba(255,255,255,.035);
  font-size: 12px;
  font-weight: 750;
}
.skill-toolbar__add { width: 34px; display: grid; place-items: center; padding: 0; }
.skill-toolbar__add svg { width: 15px; }
.skill-toolbar__add:disabled { opacity: .58; cursor: not-allowed; }
.skill-panel__description {
  margin: 10px 3px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.skill-meta__avatar {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  color: var(--accent-ink);
  background: var(--accent);
  font-size: 10px;
  font-weight: 900;
}
.skill-availability {
  margin: 0 0 11px;
  padding: 13px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(255,205,61,.24);
  border-radius: 14px;
  background: rgba(255,205,61,.08);
}
.skill-availability > div { min-width: 0; display: grid; gap: 4px; }
.skill-availability strong { color: var(--accent); font-size: 12px; }
.skill-availability span { color: var(--muted-strong); font-size: 11px; overflow-wrap: anywhere; }
.skill-availability .button { width: auto; flex: 0 0 auto; padding: 0 12px; min-height: 34px; }
.skill-info {
  margin: 0;
  padding: 4px 15px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255,255,255,.025);
}
.skill-info > div {
  display: grid;
  grid-template-columns: 112px minmax(0,1fr);
  align-items: center;
  gap: 12px;
  min-height: 55px;
}
.skill-info > div + div { border-top: 1px solid var(--border); }
.skill-info dt { color: var(--muted); font-size: 12px; line-height: 1.35; }
.skill-info dd {
  min-width: 0;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}
.skill-info dd small { color: var(--muted); font-size: 12px; font-weight: 500; }
.skill-info code {
  min-width: 0;
  overflow: hidden;
  color: var(--muted-strong);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: 550;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.skill-setting--masked { color: #dbe8f0 !important; letter-spacing: .03em; }
.skill-config-note {
  margin: 10px 3px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}
.skill-config-note code { color: var(--muted-strong); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.skill-parameters {
  margin-top: 12px;
  padding: 14px 15px;
  display: grid;
  gap: 11px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255,255,255,.025);
}
.skill-parameters h3 { margin: 0; color: var(--muted-strong); font-size: 12px; }
.skill-parameter { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.skill-folder > div { display: flex; align-items: center; gap: 9px; min-width: 0; }
.skill-folder code { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.skill-folder__open { color: var(--telegram); font-size: 12px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.skill-folder__open:hover { text-decoration: underline; }
.skill-parameter input:not([type="checkbox"]) {
  width: 100%;
  min-height: 35px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: rgba(0,0,0,.16);
  color: var(--text);
  font: inherit;
}
.skill-parameter input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent); }
.skill-parameters .button { width: auto; justify-self: start; min-height: 34px; padding: 0 12px; }
.skill-tabs {
  display: flex;
  gap: 4px;
  margin: 23px 0 11px;
  border-bottom: 1px solid var(--border);
}
.skill-tab {
  position: relative;
  min-height: 38px;
  padding: 0 11px;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}
.skill-tab span { margin-left: 3px; font-size: 11px; }
.skill-tab--active { color: var(--text); }
.skill-tab--active::after {
  content: "";
  position: absolute;
  right: 9px;
  bottom: -1px;
  left: 9px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}
.skill-empty {
  min-height: 190px;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 25px;
  border: 1px dashed var(--border);
  border-radius: 17px;
  text-align: center;
}
.skill-empty > span { color: var(--accent); font-size: 24px; }
.skill-empty strong { margin-top: 11px; font-size: 14px; }
.skill-empty p { max-width: 27ch; margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.skill-run-list,
.skill-group-list { display: grid; gap: 8px; }
.skill-setup {
  margin: 0 0 10px;
  padding: 12px;
  border: 1px solid rgba(255,205,61,.24);
  border-radius: 14px;
  color: var(--accent);
  background: rgba(255,205,61,.08);
  font-size: 12px;
  line-height: 1.45;
}
.skill-run,
.skill-group {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  background: rgba(255,255,255,.025);
  text-align: left;
  cursor: pointer;
}
.skill-run:hover,
.skill-group:hover { border-color: rgba(255,208,47,.25); background: rgba(255,208,47,.04); }
.skill-run__status {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 9px;
  color: var(--accent-ink);
  background: var(--accent);
  font-size: 11px;
  font-weight: 900;
}
.skill-run__status--succeeded { color: #052417; background: var(--success); }
.skill-run__status--failed { color: white; background: #c94f4b; }
.skill-run__copy { min-width: 0; display: grid; flex: 1; gap: 4px; }
.skill-run__copy > span { display: flex; justify-content: space-between; gap: 7px; }
.skill-run__copy strong,
.skill-run__copy small,
.skill-run__copy em,
.skill-run__copy time { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.skill-run__copy strong { font-size: 13px; }
.skill-run__copy small { color: var(--muted-strong); font-size: 11px; font-weight: 650; }
.skill-run__copy em { color: var(--muted-strong); font-size: 12px; font-style: normal; }
.skill-run__copy time { color: var(--muted); font-size: 11px; }
.skill-run__arrow { color: var(--muted); font-size: 18px; }
.skill-group__avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: 0 0 auto;
  border-radius: 50%;
  color: var(--accent-ink);
  background: var(--accent);
  font-size: 11px;
  font-weight: 900;
}
.skill-group__avatar img { width: 100%; height: 100%; object-fit: cover; }
.skill-group > span:nth-child(2) { min-width: 0; flex: 1; }
.skill-group strong,
.skill-group small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.skill-group strong { font-size: 13px; }
.skill-group small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.skill-group i { color: var(--muted); font-size: 17px; font-style: normal; }
.skill-panel__empty { padding: 30px 20px; color: var(--muted); font-size: 13px; }
.mobile-nav { display: none; }

.toast {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: max(24px, calc(var(--safe-bottom) + 14px));
  max-width: min(420px, calc(100vw - 30px));
  padding: 11px 15px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  background: rgba(22, 35, 46, .97);
  box-shadow: 0 15px 35px rgba(0,0,0,.3);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity .2s ease, transform .2s ease;
}
.toast--visible { opacity: 1; transform: translate(-50%, 0); }
.toast--error { border-color: rgba(255,125,120,.28); color: #ffc5c2; }

@media (min-width: 761px) and (max-width: 1120px) {
  .chat-layout { grid-template-columns: minmax(420px, 1fr) 350px; }
  .sidebar { display: none; }
}

@media (max-width: 760px) {
  body { background: var(--page); }
  .app-shell {
    width: 100%;
    height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .chat-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .chat-panel { padding-bottom: calc(64px + var(--safe-bottom)); }
  .skills-panel { display: none; border-left: 0; padding-bottom: calc(64px + var(--safe-bottom)); }
  .chat-layout--skills .chat-panel { display: none; }
  .chat-layout--skills .skills-panel { display: block; }
  .skill-panel__scroll {
    padding: calc(18px + var(--safe-top)) max(15px, var(--safe-right)) 26px max(15px, var(--safe-left));
  }
  .skill-panel__eyebrow { margin-bottom: 14px; font-size: 11px; }
  .skill-toolbar { grid-template-columns: minmax(0,1fr) 38px; }
  .combo--skill .combo__trigger { height: 46px; }
  .skill-toolbar__add { height: 38px; }
  .skill-toolbar__add { width: 38px; }
  .skill-info > div { min-height: 59px; }
  .skill-run,
  .skill-group { padding: 14px; }
  .mobile-nav {
    position: absolute;
    z-index: 15;
    right: 0;
    bottom: 0;
    left: 0;
    height: calc(64px + var(--safe-bottom));
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    padding: 7px max(22px, var(--safe-right)) var(--safe-bottom) max(22px, var(--safe-left));
    border-top: 1px solid var(--border);
    background: rgba(16, 26, 35, .96);
    backdrop-filter: blur(16px);
  }
  .mobile-nav__item {
    min-height: 50px;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 3px;
    border: 0;
    border-radius: 13px;
    color: var(--muted);
    background: transparent;
    font-size: 11px;
    font-weight: 750;
    cursor: pointer;
  }
  .mobile-nav__item svg { width: 20px; height: 20px; }
  .mobile-nav__item--active { color: var(--accent); background: rgba(255,208,47,.07); }
  .chat-header {
    min-height: calc(66px + var(--safe-top));
    padding: calc(10px + var(--safe-top)) max(15px, var(--safe-right)) 10px max(15px, var(--safe-left));
  }
  .mobile-brand { display: block; width: 36px; height: 36px; }
  .chat-header__identity { gap: 10px; }
  .chat-header h1 { font-size: 16px; }
  .channel-pill span { display: none; }
  .channel-pill { width: 34px; height: 34px; justify-content: center; padding: 0; }
  .messages { padding: 21px max(13px, var(--safe-right)) 18px max(13px, var(--safe-left)); }
  .message-bubble { max-width: 88%; }
  .task-card { width: 91%; }
  .composer-shell { padding-inline: max(11px, var(--safe-left)); }
  .auth-view { padding: max(20px, var(--safe-top)) max(16px, var(--safe-right)) max(20px, var(--safe-bottom)) max(16px, var(--safe-left)); }
  .auth-card { padding: 30px 22px; border-radius: 23px; }
}

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