/* ============================================================
   Пространство — рабочее пространство с проектами и чатами
   ============================================================ */

:root {
  --bg: #f5f6fa;
  --panel: #ffffff;
  --panel-2: #eef0f6;
  --text: #171a23;
  --muted: #6d7484;
  --line: #e4e7ef;
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --accent-soft: #eef0ff;
  --accent-ring: rgba(99, 102, 241, 0.16);
  --danger: #e5484d;
  --shadow: 0 10px 30px rgba(20, 24, 40, 0.08);
  --shadow-soft: 0 1px 2px rgba(16, 24, 40, 0.04);
  --radius: 16px;
}

[data-theme="dark"] {
  --bg: #0d0f15;
  --panel: #141720;
  --panel-2: #1c202a;
  --text: #eef0f6;
  --muted: #8c94a8;
  --line: #252a36;
  --accent: #6d72f6;
  --accent-2: #9b6bf7;
  --accent-soft: rgba(109, 114, 246, 0.16);
  --accent-ring: rgba(109, 114, 246, 0.2);
  --danger: #ff5d63;
  --shadow: 0 14px 36px rgba(0, 0, 0, 0.38);
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.25);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

input,
textarea {
  font: inherit;
  color: inherit;
}

::selection {
  background: var(--accent);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--muted) 28%, transparent);
  border-radius: 10px;
  border: 3px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--muted) 45%, transparent);
  border: 3px solid transparent;
  background-clip: padding-box;
}

/* ------------------------------ Layout ------------------------------ */

.app {
  display: flex;
  height: 100dvh;
  overflow: hidden;
}

.app.is-standalone .sidebar,
.app.is-standalone .backdrop {
  display: none;
}

.app.is-standalone .chat-head {
  background: color-mix(in srgb, var(--panel) 82%, transparent);
}

.chat-head__back {
  margin-left: -4px;
}

/* ------------------------------ Sidebar ----------------------------- */

.sidebar {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  flex: 0 0 308px;
  width: 308px;
  min-height: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
}

.sidebar__head {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 16px 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand__logo {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35);
}

.brand__text {
  min-width: 0;
}

.brand__name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.brand__sub {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.2;
}

.sidebar__close {
  display: none;
  margin-left: auto;
}

.sidebar__scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2px 10px 14px;
}

.side-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 10px 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.side-label__count {
  padding: 1px 7px;
  border-radius: 20px;
  background: var(--panel-2);
  font-size: 10.5px;
  letter-spacing: 0;
}

.side-empty {
  margin: 12px 6px;
  padding: 22px 16px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  text-align: center;
  color: var(--muted);
}

.side-empty__icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin: 0 auto 10px;
  border-radius: 12px;
  color: var(--accent);
  background: var(--accent-soft);
}

.side-empty__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.side-empty__text {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.5;
}

/* ------------------------------ Projects ---------------------------- */

.project {
  margin-bottom: 2px;
}

.project__row {
  display: flex;
  align-items: center;
  border-radius: 10px;
  transition: background 0.15s ease;
}

.project__row:hover {
  background: var(--panel-2);
}

.project__toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1;
  min-width: 0;
  padding: 9px 6px 9px 8px;
  border-radius: 10px;
  text-align: left;
}

.project__chevron {
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: transform 0.18s ease;
}

.project.is-open .project__chevron {
  transform: rotate(90deg);
}

.project__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project__count {
  padding: 1px 7px;
  border-radius: 20px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.project__row:hover .project__count {
  background: color-mix(in srgb, var(--muted) 14%, transparent);
}

.project__actions {
  display: flex;
  gap: 1px;
  padding-right: 4px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.project__row:hover .project__actions,
.project__row:focus-within .project__actions {
  opacity: 1;
}

.project__chats {
  display: none;
  margin-left: 15px;
  padding: 2px 0 6px 8px;
  border-left: 1px solid var(--line);
}

.project.is-open .project__chats {
  display: block;
  animation: reveal 0.18s ease;
}

.project__empty {
  display: block;
  width: 100%;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 11.5px;
  text-align: left;
}

.project__empty:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

/* ------------------------------- Chats ------------------------------ */

.chat-row {
  display: flex;
  align-items: center;
  position: relative;
  margin: 1px 0;
  border-radius: 10px;
  transition: background 0.15s ease;
}

.chat-row:hover {
  background: var(--panel-2);
}

.chat-row.is-active {
  background: var(--accent-soft);
}

.chat-row.is-active::before {
  content: "";
  position: absolute;
  left: -9px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
}

.chat {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
  min-width: 0;
  padding: 7px 6px 7px 8px;
  border-radius: 10px;
  text-align: left;
}

.chat__avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 10px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--h1, #6366f1), var(--h2, #8b5cf6));
  box-shadow: 0 2px 6px rgba(20, 24, 40, 0.14);
}

.chat__body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}

.chat__top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-row.is-active .chat__name {
  color: var(--accent);
}

.chat__time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10px;
}

.chat__preview {
  overflow: hidden;
  color: var(--muted);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat__more {
  margin-right: 4px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.chat-row:hover .chat__more,
.chat-row:focus-within .chat__more,
.chat-row.is-active .chat__more {
  opacity: 1;
}

/* --------------------------- Sidebar footer ------------------------- */

.sidebar__foot {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--line);
}

.theme-row {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 12.5px;
  transition: background 0.15s ease, color 0.15s ease;
}

.theme-row:hover {
  background: var(--panel-2);
  color: var(--text);
}

.theme-row__icon {
  display: grid;
  place-items: center;
}

.switch {
  position: relative;
  width: 34px;
  height: 20px;
  margin-left: auto;
  border-radius: 20px;
  background: var(--line);
  transition: background 0.2s ease;
}

.switch i {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
  transition: transform 0.2s ease;
}

.switch.is-on {
  background: var(--accent);
}

.switch.is-on i {
  transform: translateX(14px);
}

.side-foot__note {
  padding: 0 8px;
  color: var(--muted);
  font-size: 10.5px;
  opacity: 0.75;
}

/* ------------------------------ Buttons ----------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.btn--primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.3);
}

.btn--primary:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow: 0 9px 24px rgba(99, 102, 241, 0.36);
}

.btn--primary:active {
  transform: translateY(0);
}

.btn--ghost {
  color: var(--text);
  background: var(--panel-2);
}

.btn--ghost:hover {
  background: var(--line);
}

.btn--danger {
  color: #fff;
  background: var(--danger);
  box-shadow: 0 6px 16px rgba(229, 72, 77, 0.26);
}

.btn--danger:hover {
  filter: brightness(1.05);
}

.btn--block {
  width: 100%;
}

.btn--lg {
  height: 46px;
  padding: 0 22px;
  border-radius: 14px;
  font-size: 14.5px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 10px;
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.icon-btn:hover {
  background: var(--panel-2);
  color: var(--text);
}

.icon-btn:active {
  transform: scale(0.94);
}

.icon-btn.is-on {
  color: var(--accent);
  background: var(--accent-soft);
}

.mini-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border-radius: 8px;
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease;
}

.mini-btn:hover {
  background: color-mix(in srgb, var(--muted) 14%, transparent);
  color: var(--text);
}

/* -------------------------------- Main ------------------------------ */

.main {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  background-color: var(--bg);
  background-image:
    radial-gradient(820px 520px at 88% -12%, rgba(99, 102, 241, 0.1), transparent 62%),
    radial-gradient(720px 420px at -4% 104%, rgba(139, 92, 246, 0.09), transparent 62%);
}

/* ------------------------------- Welcome ---------------------------- */

.welcome {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 40px 24px;
}

.welcome__inner {
  max-width: 560px;
  text-align: center;
  animation: rise 0.35s ease;
}

.welcome__art {
  position: relative;
  width: 130px;
  height: 112px;
  margin: 0 auto 26px;
}

.welcome__art::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 52%;
  width: 210px;
  height: 210px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(99, 102, 241, 0.24), transparent 64%);
  filter: blur(4px);
}

.art-tile {
  position: absolute;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 20px;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 14px 30px rgba(20, 24, 40, 0.2);
}

.art-tile--back {
  left: 54px;
  top: 0;
  background: linear-gradient(135deg, #f59e0b, #f97316);
  transform: rotate(12deg);
}

.art-tile--mid {
  left: 6px;
  top: 24px;
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  transform: rotate(-10deg);
}

.art-tile--front {
  left: 36px;
  top: 46px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  transform: rotate(4deg);
}

.welcome h1 {
  margin: 0 0 10px;
  font-size: 30px;
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.welcome p {
  max-width: 440px;
  margin: 0 auto 28px;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.65;
}

.welcome__badge {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  border-radius: 20px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 14px 30px rgba(99, 102, 241, 0.32);
}

.welcome__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 0 0 28px;
  text-align: left;
}

.step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.step__num {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: 8px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 11px;
  font-weight: 700;
}

.step__title {
  font-size: 12.5px;
  font-weight: 700;
}

.step__text {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.45;
}

/* ------------------------------ Chat head --------------------------- */

.chat-head {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 72px;
  height: 72px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 74%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.chat-head__avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 12px;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--h1, #6366f1), var(--h2, #8b5cf6));
  box-shadow: 0 4px 12px rgba(20, 24, 40, 0.16);
}

.chat-head__meta {
  flex: 1;
  min-width: 0;
}

.chat-head__title {
  overflow: hidden;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-head__sub {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.chat-head__sub span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dot {
  width: 3px;
  height: 3px;
  flex: 0 0 3px;
  border-radius: 50%;
  background: var(--muted);
  opacity: 0.6;
}

.chat-head__actions {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

/* ------------------------------ Messages ---------------------------- */

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px 24px 8px;
}

.messages.is-empty {
  display: flex;
  align-items: center;
  justify-content: center;
}

.messages__inner {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
}

.chat-intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 0 12px;
  text-align: center;
}

.chat-intro__avatar {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  border-radius: 18px;
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--h1, #6366f1), var(--h2, #8b5cf6));
  box-shadow: 0 10px 24px rgba(20, 24, 40, 0.18);
}

.chat-intro__name {
  margin-top: 12px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.chat-intro__sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.chat-intro__hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  box-shadow: var(--shadow-soft);
}

.chat-task {
  width: 100%;
  max-width: 540px;
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  text-align: left;
  box-shadow: var(--shadow-soft);
}

.chat-task__label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.chat-task__text {
  margin-top: 6px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.day {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 10px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.day::before,
.day::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.day span {
  flex: 0 0 auto;
}

.msg {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 2px;
}

.msg.is-first {
  margin-top: 10px;
}

.msg--me {
  justify-content: flex-end;
}

.msg__avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  margin-top: 1px;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, #0ea5e9, #8b5cf6);
  box-shadow: 0 3px 8px rgba(14, 165, 233, 0.25);
}

.msg__avatar-spacer {
  width: 30px;
  flex: 0 0 30px;
}

.msg__body {
  display: flex;
  flex-direction: column;
  max-width: min(72%, 560px);
}

.msg--me .msg__body {
  align-items: flex-end;
}

.msg__bubble {
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: var(--shadow-soft);
}

.msg--bot .msg__bubble {
  border-bottom-left-radius: 6px;
}

.msg--me .msg__bubble {
  border-color: transparent;
  border-bottom-right-radius: 6px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.28);
}

.msg__meta {
  display: flex;
  gap: 5px;
  margin-top: 4px;
  padding: 0 4px;
  color: var(--muted);
  font-size: 10.5px;
}

.typing {
  margin-top: 10px;
}

.typing__bubble {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  border-bottom-left-radius: 6px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.typing__bubble i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted);
  animation: typing 1.2s infinite;
}

.typing__bubble i:nth-child(2) {
  animation-delay: 0.15s;
}

.typing__bubble i:nth-child(3) {
  animation-delay: 0.3s;
}

/* ------------------------------ Composer ---------------------------- */

.composer {
  flex: 0 0 auto;
  padding: 12px 24px 18px;
  background: linear-gradient(to top, var(--bg) 72%, transparent);
}

.composer__inner {
  max-width: 820px;
  margin: 0 auto;
}

.composer__box {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 8px 8px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.composer__box:focus-within {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 0 0 4px var(--accent-ring), var(--shadow);
}

.composer textarea {
  flex: 1;
  min-width: 0;
  min-height: 24px;
  max-height: 160px;
  padding: 8px 0;
  border: 0;
  outline: none;
  background: none;
  font-size: 14px;
  line-height: 1.5;
  resize: none;
}

.composer textarea::placeholder {
  color: var(--muted);
}

.composer__send {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 14px rgba(99, 102, 241, 0.3);
  transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.composer__send:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(99, 102, 241, 0.36);
}

.composer__send:active:not(:disabled) {
  transform: scale(0.95);
}

.composer__send:disabled {
  color: var(--muted);
  background: var(--panel-2);
  box-shadow: none;
  cursor: default;
}

.composer__hint {
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

/* ------------------------------- Modal ------------------------------ */

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(13, 15, 23, 0.44);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.16s ease;
}

.modal-layer.is-open {
  opacity: 1;
}

.modal {
  width: 100%;
  max-width: 424px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(9, 12, 24, 0.3);
  transform: translateY(10px) scale(0.98);
  transition: transform 0.18s ease;
}

.modal-layer.is-open .modal {
  transform: none;
}

.modal__head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
}

.modal__head-text {
  min-width: 0;
}

.modal__title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.modal__sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.modal__head .icon-btn {
  margin-top: -4px;
  margin-left: auto;
}

.modal__form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field__label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.field__input {
  height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: var(--bg);
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field__input::placeholder {
  color: var(--muted);
  opacity: 0.8;
}

.field__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-ring);
}

.field__input.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px rgba(229, 72, 77, 0.14);
}

.field__error {
  display: none;
  margin-top: -10px;
  color: var(--danger);
  font-size: 11.5px;
}

.field__error.is-visible {
  display: block;
}

.field__textarea {
  height: auto;
  min-height: 92px;
  padding: 10px 13px;
  line-height: 1.5;
  resize: vertical;
}

.field__hint {
  margin-top: -2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.link-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
}

.link-box__input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: none;
  color: var(--muted);
  font-size: 12.5px;
}

.link-box .btn {
  height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  font-size: 12px;
}

.modal__hint {
  display: flex;
  gap: 6px;
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
}

.modal__hint svg {
  flex: 0 0 auto;
  margin-top: 2px;
}

.modal__text {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.65;
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 2px;
}

/* -------------------------------- Menu ------------------------------ */

.menu {
  position: fixed;
  z-index: 130;
  min-width: 198px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 16px 44px rgba(9, 12, 24, 0.2);
  opacity: 0;
  transform: translateY(-4px) scale(0.98);
  transform-origin: top left;
  transition: opacity 0.13s ease, transform 0.13s ease;
}

.menu.is-open {
  opacity: 1;
  transform: none;
}

.menu__item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  text-align: left;
  transition: background 0.12s ease;
}

.menu__item:hover {
  background: var(--panel-2);
}

.menu__item.is-danger {
  color: var(--danger);
}

.menu__item.is-danger:hover {
  background: rgba(229, 72, 77, 0.1);
}

/* -------------------------------- Toast ----------------------------- */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 150;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 15px;
  border-radius: 12px;
  background: #171b25;
  color: #fff;
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.26);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

[data-theme="dark"] .toast {
  border: 1px solid var(--line);
  background: #252a36;
}

.toast.is-open {
  opacity: 1;
  transform: none;
}

.toast__icon {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
}

/* ----------------------------- Backdrop ----------------------------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(10, 12, 20, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.app.is-drawer-open .backdrop {
  opacity: 1;
  pointer-events: auto;
}

.mobile-only {
  display: none;
}

/* ---------------------------- Animations ---------------------------- */

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes typing {
  0%,
  60%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

/* ----------------------------- Responsive --------------------------- */

@media (hover: none) {
  .project__actions,
  .chat__more {
    opacity: 1;
  }
}

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 80;
    width: min(86vw, 320px);
    transform: translateX(-102%);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.28);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .app.is-drawer-open .sidebar {
    transform: none;
  }

  .sidebar__close {
    display: inline-flex;
  }

  .mobile-only {
    display: inline-flex;
  }

  .chat-head {
    gap: 10px;
    padding: 0 12px;
  }

  .messages {
    padding: 16px 12px 4px;
  }

  .composer {
    padding: 10px 12px 14px;
  }

  .composer__hint {
    display: none;
  }

  .msg__body {
    max-width: 82%;
  }

  .welcome {
    padding: 32px 18px;
  }

  .welcome h1 {
    font-size: 25px;
  }

  .steps {
    grid-template-columns: 1fr;
  }

  .welcome__menu {
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 30;
    border: 1px solid var(--line);
    background: var(--panel);
    box-shadow: var(--shadow);
  }

  .toasts {
    bottom: 16px;
    width: calc(100% - 24px);
  }

  .toast {
    max-width: 100%;
  }
}

@media (min-width: 901px) {
  .backdrop {
    display: none;
  }

  .mobile-only {
    display: none !important;
  }
}

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

/* Interview workspace and invitation views */

[hidden] { display: none !important; }
.muted { color: var(--muted); }
.stack { display: grid; gap: 16px; }
.form-error { margin: 0; color: var(--danger); font-size: 13px; overflow-wrap: anywhere; }
.btn { text-decoration: none; }
.btn:disabled { opacity: .58; cursor: wait; }
.btn--danger-outline { color: var(--danger); }
.btn--danger-outline:hover { background: color-mix(in srgb, var(--danger) 9%, transparent); }
.field__input { width: 100%; }
.field__textarea { resize: vertical; }

.entry {
  display: grid;
  min-height: 100dvh;
  place-items: center;
  overflow: auto;
  padding: 22px;
  background: radial-gradient(700px 550px at 50% 20%, var(--accent-soft), transparent 78%), var(--bg);
}
.entry-card {
  width: min(100%, 410px);
  padding: clamp(24px, 5vw, 36px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.entry-card h1, .entry-card h2 { margin: 16px 0 4px; font-size: 27px; letter-spacing: -.03em; }
.entry-card p { margin: 0 0 22px; }
.entry-card .form-error { margin: 0; }
.invite-card { text-align: center; }
.invite-card .brand__logo { margin-inline: auto; }
.invite-card p:last-of-type { margin-bottom: 16px; }

.brand-home { display: flex; align-items: center; gap: 10px; text-align: left; min-width: 0; }
.brand-home .brand__name, .brand-home .brand__sub { display: block; }
.sidebar__head { gap: 13px; }
@media (min-width: 901px) { .sidebar .sidebar__close { display: none; } }
.sidebar-empty { padding-inline: 8px; }
.sidebar-settings { justify-content: flex-start; }
.project-search { height: 38px; }
.chat__preview { margin-top: 3px; }
.chat__avatar { background: var(--accent-soft); color: var(--accent); box-shadow: none; }

.workspace-top { flex-basis: 62px; height: 62px; }
.workspace-crumb { color: var(--muted); font-weight: 650; }
.workspace-scroll { flex: 1; min-height: 0; overflow: auto; }
.workspace-content { width: min(100%, 1216px); margin-inline: auto; padding: 28px clamp(16px, 3.6vw, 46px) 48px; }
.workspace-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 24px; }
.workspace-heading h1 { margin: 0; font-size: clamp(24px, 3vw, 35px); letter-spacing: -.04em; line-height: 1.15; overflow-wrap: anywhere; }
.workspace-heading p { max-width: 62ch; margin: 8px 0 0; overflow-wrap: anywhere; }
.title-line { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.toolbar, .dialog-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.workspace-heading .toolbar { justify-content: flex-end; flex-shrink: 0; }
.dialog-actions { justify-content: flex-end; }
.workspace-heading .project-toolbar { flex-shrink: 1; min-width: 0; max-width: 100%; }
.breadcrumb-button { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); margin: 0 0 17px; }
.breadcrumb-button:hover { color: var(--accent); }
.surface { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-soft); min-width: 0; }
.surface h2 { margin: 0; font-size: 16px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat-card { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 2px 8px; padding: 15px; color: var(--muted); }
.stat-card strong { grid-column: 2; color: var(--text); font-size: 23px; line-height: 1.1; }
.stat-card > span:last-child { grid-column: 2; font-size: 12px; overflow-wrap: anywhere; }
.status-point { width: 8px; height: 8px; border-radius: 50%; background: var(--state); }
.status { display: inline-flex; align-items: center; gap: 5px; width: fit-content; max-width: 100%; border-radius: 100px; padding: 2px 8px; background: color-mix(in srgb, var(--state) 12%, var(--panel)); color: var(--state); font-size: 11px; font-weight: 650; white-space: nowrap; }
.status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status--waiting, .status-point--waiting { --state: #85571b; }
.status--active, .status-point--active { --state: #2459b5; }
.status--completed, .status-point--completed { --state: #237853; }
.status--blocked, .status-point--blocked { --state: #aa393f; }
[data-theme=dark] .status--waiting, [data-theme=dark] .status-point--waiting { --state: #e7b369; }
[data-theme=dark] .status--active, [data-theme=dark] .status-point--active { --state: #94b5ff; }
[data-theme=dark] .status--completed, [data-theme=dark] .status-point--completed { --state: #7dd5a7; }
[data-theme=dark] .status--blocked, [data-theme=dark] .status-point--blocked { --state: #ff9a9d; }
.project-overview { padding: 16px; }
.project-overview h2 { margin: 0 8px 10px; }
.overview-row { display: flex; width: 100%; align-items: center; gap: 10px; min-height: 51px; padding: 8px; border-radius: 10px; text-align: left; }
.overview-row:hover { background: var(--panel-2); }
.overview-row > strong, .overview-title { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.overview-title { display: grid; }
.overview-title small { color: var(--muted); }
.overview-row > svg { flex: 0 0 16px; color: var(--muted); }
.overview-icon { flex: 0 0 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; color: var(--accent); background: var(--accent-soft); }
.empty-note { margin: 12px 8px; color: var(--muted); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(260px, 1fr); align-items: start; gap: 16px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.admin-transcript .section-head { padding: 12px 18px; border-bottom: 1px solid var(--line); }
.admin-messages { padding: 9px 16px 22px; min-height: 145px; }
.admin-messages .msg__body { max-width: 88%; }
.interview-details { padding: 16px; }
.interview-details dl { margin: 14px 0 16px; }
.interview-details dt { margin-top: 12px; font-size: 12px; color: var(--muted); font-weight: 650; }
.interview-details dd { margin: 3px 0 0; overflow-wrap: anywhere; }
.prompt-detail { max-height: 240px; overflow: auto; white-space: pre-wrap; padding: 9px; background: var(--bg); border-radius: 8px; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px; }
.inline-action { display: inline-flex; align-items: center; min-height: 23px; color: var(--muted); }
.inline-action:hover { color: var(--accent); }
.settings-content { max-width: 940px; }
.settings-form { padding: 18px; margin-bottom: 14px; }
.settings-form textarea { min-height: 90px; }
.qavo-dialog { color: var(--text); width: min(92vw, 520px); max-width: 520px; max-height: 90dvh; overflow-y: auto; transform: none; }
.qavo-dialog::backdrop { background: rgba(13, 15, 23, .48); backdrop-filter: blur(4px); }
.toast-region { position: fixed; right: 18px; bottom: 18px; max-width: min(360px, calc(100vw - 36px)); padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px; z-index: 99; background: var(--panel); color: var(--text); box-shadow: var(--shadow); }

.interview-top .chat-head__title { margin: 0; font-size: 17px; }
.interview-topic { display: block; margin-bottom: 0; overflow-wrap: anywhere; max-width: 85ch; line-height: 1.25; }
.interview-top { min-height: 72px; height: auto; flex-basis: auto; padding-block: 10px; }
.interview-thread { width: min(100%, 760px); margin-inline: auto; }
.interview-footer .composer__inner { width: min(100%, 760px); }
.interview-footer .form-error, .closed-note { margin: 0 0 9px; }
.closed-note { padding: 10px; text-align: center; background: var(--panel-2); color: var(--text); border-radius: 9px; }
.agent-wait { margin: 12px 0; }
.interview-footer textarea { max-height: 148px; field-sizing: content; }
.msg__bubble { overflow-wrap: anywhere; }
.msg--pending .msg__bubble { opacity: .8; }
.msg__delivery { color: var(--muted); }

.avatar-form { display: flex; align-items: flex-start; gap: 14px; }
.avatar-fields { min-width: 0; display: grid; gap: 10px; }
.avatar-file { width: 100%; max-width: 100%; }
.avatar-note { margin: 6px 0 14px; }
.avatar-preview {
  width: 60px;
  height: 60px;
  flex: 0 0 60px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
}
.avatar-preview, .chat-head__avatar, .msg__avatar { position: relative; }
.interviewer-avatar-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
  background: var(--panel);
}

@media (max-width: 1160px) and (min-width: 901px) {
  .sidebar { flex-basis: 265px; width: 265px; }
}

@media (max-width: 1020px) and (min-width: 901px), (max-width: 730px) {
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .workspace-heading { flex-wrap: wrap; }
  .workspace-heading .toolbar { justify-content: flex-start; }
}

@media (max-width: 540px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace-content { padding-top: 20px; }
  .workspace-heading { margin-bottom: 17px; }
  .overview-row { gap: 6px; }
  .overview-row .status { padding-inline: 4px; }
  .overview-icon { flex-basis: 27px; height: 27px; }
  .entry { place-items: center; }
}

@media (max-height: 460px) {
  .entry { place-items: start center; }
}
