/* Ева · Фабрика прототипов — тёмная тема, бирюзово-фиолетовый акцент (дизайн-гайд владельца). */
:root {
  --bg: #0b1220;
  --bg-deep: #070b15;
  --panel: rgba(255, 255, 255, 0.035);
  --panel-2: rgba(255, 255, 255, 0.06);
  --panel-3: rgba(255, 255, 255, 0.09);
  --stroke: rgba(255, 255, 255, 0.08);
  --stroke-2: rgba(255, 255, 255, 0.14);
  --text: #e8ebf3;
  --text-2: #a7b0c4;
  --text-3: #6d7891;
  --a1: #7c6cf6;
  --a2: #4fd3e8;
  --acc: linear-gradient(135deg, #7c6cf6 0%, #5b8cf0 50%, #4fd3e8 100%);
  --acc-soft: linear-gradient(135deg, rgba(124, 108, 246, 0.18), rgba(79, 211, 232, 0.14));
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
  --r-s: 10px;
  --r: 14px;
  --r-l: 20px;
  --r-xl: 26px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --side-w: 296px;
  --kb: 0px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font: 15px/1.5 var(--font);
  color: var(--text);
  background:
    radial-gradient(1100px 620px at 12% -12%, rgba(124, 108, 246, 0.17), transparent 62%),
    radial-gradient(900px 520px at 105% 0%, rgba(79, 211, 232, 0.1), transparent 60%),
    linear-gradient(180deg, #0b1220 0%, #0a101d 55%, #080c17 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: #8fdcf0; }
::selection { background: rgba(124, 108, 246, 0.45); }
:focus-visible { outline: 2px solid rgba(79, 211, 232, 0.7); outline-offset: 2px; border-radius: 8px; }
.i { flex: none; display: block; }
.hidden { display: none !important; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.grad-text { background: var(--acc); -webkit-background-clip: text; background-clip: text; color: transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(255, 255, 255, 0.16); }
::-webkit-scrollbar-track { background: transparent; }

.boot { height: 100dvh; display: grid; place-items: center; }
.boot img { animation: breathe 2.4s var(--ease) infinite; filter: drop-shadow(0 0 24px rgba(79, 211, 232, 0.35)); }
@keyframes breathe { 0%, 100% { transform: scale(1); opacity: 0.85; } 50% { transform: scale(1.06); opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes pulseDot { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.45; transform: scale(0.8); } }
.spin { animation: spin 0.9s linear infinite; }

/* ---------- кнопки и поля ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 14px;
  background: var(--panel-2); border: 1px solid var(--stroke); color: var(--text);
  font-weight: 600; font-size: 15px; white-space: nowrap;
  transition: background 0.25s var(--ease), border-color 0.25s var(--ease), transform 0.2s var(--ease), opacity 0.2s;
}
.btn:hover { background: var(--panel-3); border-color: var(--stroke-2); }
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.btn-primary {
  background: var(--acc); border: 0; color: #fff;
  box-shadow: 0 8px 28px -10px rgba(91, 140, 240, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn-primary:hover { filter: brightness(1.08); background: var(--acc); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--panel-2); }
.btn-danger { color: #fecaca; border-color: rgba(248, 113, 113, 0.3); background: rgba(248, 113, 113, 0.08); }
.btn-sm { height: 34px; padding: 0 12px; border-radius: 11px; font-size: 13.5px; }
.btn-block { width: 100%; }
.ibtn {
  width: 40px; height: 40px; border-radius: 12px; display: inline-grid; place-items: center; flex: none;
  color: var(--text-2); transition: background 0.2s var(--ease), color 0.2s;
}
.ibtn:hover { background: var(--panel-2); color: var(--text); }
.ibtn.on { color: var(--text); background: var(--panel-2); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3); font-weight: 600; }
.input, .textarea {
  width: 100%; min-height: 46px; padding: 11px 14px; border-radius: 14px;
  background: rgba(0, 0, 0, 0.25); border: 1px solid var(--stroke); outline: none; font-size: 16px;
  transition: border-color 0.2s var(--ease), background 0.2s;
}
.textarea { resize: vertical; min-height: 92px; line-height: 1.45; }
.input:focus, .textarea:focus { border-color: rgba(79, 211, 232, 0.55); background: rgba(0, 0, 0, 0.32); }
.err-text { color: var(--err); font-size: 13.5px; min-height: 20px; }

/* ---------- вход ---------- */
.login { height: 100dvh; display: grid; place-items: center; padding: 24px 18px calc(24px + var(--safe-b)); overflow-y: auto; }
.login-card {
  width: 100%; max-width: 400px; padding: 30px 26px 24px; border-radius: 28px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--stroke); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.7); animation: fadeUp 0.6s var(--ease);
}
.login-logo { width: 76px; height: 76px; margin: 0 auto 14px; display: block; filter: drop-shadow(0 0 22px rgba(79, 211, 232, 0.35)); }
.login h1 { margin: 0; text-align: center; font-size: 25px; font-weight: 700; letter-spacing: -0.01em; }
.login .sub { text-align: center; color: var(--text-2); margin: 6px 0 24px; font-size: 14.5px; }
.phone { display: flex; gap: 8px; }
.cc {
  position: relative; display: flex; align-items: center; gap: 6px; height: 50px; padding: 0 10px 0 12px; border-radius: 14px;
  background: rgba(0, 0, 0, 0.25); border: 1px solid var(--stroke); flex: none; font-size: 16px;
}
.cc select { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 16px; }
.cc .flag { font-size: 20px; line-height: 1; }
.phone .input { height: 50px; font-size: 17px; letter-spacing: 0.02em; }
.otp {
  height: 58px; text-align: center; font-size: 26px; letter-spacing: 0.5em; padding-left: 0.5em; font-family: var(--mono); font-weight: 600;
}
.login .hint { color: var(--text-3); font-size: 13px; text-align: center; margin-top: 14px; }
.linkbtn { color: #9ad9ec; font-size: 14px; padding: 6px 4px; }
.linkbtn[disabled] { color: var(--text-3); }
.login-foot { margin-top: 18px; display: flex; justify-content: space-between; align-items: center; }

/* ---------- каркас ---------- */
.shell { height: 100dvh; display: grid; grid-template-columns: var(--side-w) 1fr; }
.sidebar {
  display: flex; flex-direction: column; min-height: 0; padding: calc(14px + var(--safe-t)) 12px calc(12px + var(--safe-b)) calc(12px + var(--safe-l));
  border-right: 1px solid var(--stroke); background: linear-gradient(180deg, rgba(10, 15, 28, 0.75), rgba(8, 12, 22, 0.85));
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 14px; cursor: pointer; }
.brand img { width: 34px; height: 34px; filter: drop-shadow(0 0 12px rgba(79, 211, 232, 0.35)); }
.brand b { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; display: block; }
.brand small { font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-3); font-weight: 600; }
.side-new { margin: 0 2px 12px; }
.search { position: relative; margin: 0 2px 10px; }
.search .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.search input {
  width: 100%; height: 40px; border-radius: 12px; padding: 0 12px 0 38px; background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--stroke); outline: none; font-size: 14.5px;
}
.search input:focus { border-color: rgba(79, 211, 232, 0.45); }
.sec-label { font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-3); font-weight: 600; padding: 10px 10px 6px; }
.plist { flex: 1; overflow-y: auto; min-height: 0; margin: 0 -4px; padding: 0 4px; }
.pitem {
  width: 100%; display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 13px; text-align: left;
  transition: background 0.2s var(--ease); position: relative; margin-bottom: 2px;
}
.pitem:hover { background: var(--panel); }
.pitem.on { background: var(--acc-soft); box-shadow: inset 0 0 0 1px rgba(124, 108, 246, 0.28); }
.picon {
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; flex: none;
  background: linear-gradient(145deg, rgba(124, 108, 246, 0.25), rgba(79, 211, 232, 0.12)); color: #cfe9ff;
  border: 1px solid rgba(255, 255, 255, 0.07);
}
.pmeta { min-width: 0; flex: 1; }
.ptitle { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.psub { font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot-run { width: 8px; height: 8px; border-radius: 50%; background: var(--a2); box-shadow: 0 0 10px var(--a2); animation: pulseDot 1.4s infinite; flex: none; }
.side-foot { display: flex; align-items: center; gap: 8px; padding: 10px 4px 0; border-top: 1px solid var(--stroke); margin-top: 8px; }
.side-foot .who { flex: 1; min-width: 0; font-size: 13.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 6px; }

.main { min-width: 0; min-height: 0; display: flex; flex-direction: column; position: relative; }
.topbar {
  display: flex; align-items: center; gap: 10px; padding: calc(10px + var(--safe-t)) 18px 10px; min-height: 62px;
  border-bottom: 1px solid var(--stroke); background: rgba(9, 14, 26, 0.55); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  position: relative; z-index: 5;
}
.topbar .back { display: none; }
.ttl { min-width: 0; flex: 1; display: flex; align-items: center; gap: 10px; }
.ttl h2 { margin: 0; font-size: 16.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.01em; }
.ttl .picon { width: 30px; height: 30px; border-radius: 10px; }
.tabs { display: inline-flex; padding: 3px; border-radius: 13px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--stroke); flex: none; }
.tab {
  height: 34px; padding: 0 14px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--text-2);
  display: inline-flex; align-items: center; gap: 7px; transition: background 0.25s var(--ease), color 0.25s;
}
.tab.on { background: var(--panel-3); color: var(--text); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset; }
.tab .cnt { font-size: 11.5px; color: var(--text-3); font-weight: 600; }
.mchip {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px 0 12px; border-radius: 11px;
  background: var(--panel-2); border: 1px solid var(--stroke); font-size: 12.5px; font-weight: 700; letter-spacing: 0.06em; color: #d7e4ff; flex: none;
  transition: background 0.2s var(--ease), border-color 0.2s;
}
.mchip:hover { background: var(--panel-3); border-color: var(--stroke-2); }
.mchip .spark { color: var(--a2); }
.body { flex: 1; min-height: 0; display: flex; position: relative; }
.view { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; position: relative; }

/* ---------- чат ---------- */
.chat { flex: 1; overflow-y: auto; min-height: 0; padding: 18px 18px 8px; scroll-behavior: auto; overscroll-behavior: contain; }
.col { max-width: 820px; margin: 0 auto; }
.msg { display: flex; gap: 12px; margin: 0 0 22px; animation: fadeUp 0.45s var(--ease); }
.msg.user { justify-content: flex-end; }
.msg.user .bubble {
  max-width: min(640px, 86%); padding: 11px 15px; border-radius: 20px 20px 6px 20px;
  background: linear-gradient(150deg, rgba(124, 108, 246, 0.22), rgba(79, 211, 232, 0.1)); border: 1px solid rgba(124, 108, 246, 0.26);
  white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere;
}
.avatar { width: 32px; height: 32px; flex: none; border-radius: 10px; margin-top: 2px; filter: drop-shadow(0 0 10px rgba(79, 211, 232, 0.25)); }
.eva-body { flex: 1; min-width: 0; }
.eva-head { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 3px 0 6px; }
.eva-head b { font-weight: 700; }
.eva-head .model { font-size: 10.5px; letter-spacing: 0.12em; color: var(--text-3); font-weight: 700; text-transform: uppercase; }
.msg-time { font-size: 11.5px; color: var(--text-3); }
.msg.sys { justify-content: center; }
.sys-pill {
  max-width: 640px; padding: 10px 14px; border-radius: 16px; font-size: 13.5px; color: var(--text-2);
  background: var(--panel); border: 1px solid var(--stroke); display: flex; gap: 10px; align-items: flex-start; white-space: pre-wrap;
}
.sys-pill .i { color: var(--a2); margin-top: 2px; }

.md { font-size: 15px; line-height: 1.62; overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 10px; }
.md h1, .md h2, .md h3, .md h4 { margin: 16px 0 8px; line-height: 1.3; letter-spacing: -0.01em; }
.md h1 { font-size: 20px; } .md h2 { font-size: 18px; } .md h3 { font-size: 16px; } .md h4 { font-size: 15px; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 22px; }
.md li { margin: 3px 0; }
.md li::marker { color: var(--text-3); }
.md code { font-family: var(--mono); font-size: 0.88em; background: rgba(255, 255, 255, 0.07); padding: 2px 6px; border-radius: 6px; }
.md pre { position: relative; background: rgba(0, 0, 0, 0.38); border: 1px solid var(--stroke); border-radius: 14px; padding: 14px; overflow-x: auto; margin: 0 0 12px; }
.md pre code { background: none; padding: 0; font-size: 13px; line-height: 1.55; }
.md blockquote { margin: 0 0 10px; padding: 6px 14px; border-left: 3px solid var(--a1); color: var(--text-2); background: rgba(124, 108, 246, 0.06); border-radius: 0 10px 10px 0; }
.md table { border-collapse: collapse; margin: 0 0 12px; display: block; overflow-x: auto; max-width: 100%; }
.md th, .md td { border: 1px solid var(--stroke); padding: 7px 11px; text-align: left; font-size: 14px; }
.md th { background: var(--panel); }
.md hr { border: 0; border-top: 1px solid var(--stroke); margin: 14px 0; }
.md a { color: #8fdcf0; }
.copy-code { position: absolute; top: 8px; right: 8px; opacity: 0.6; }
.copy-code:hover { opacity: 1; }

.typing { display: inline-flex; align-items: center; gap: 10px; font-size: 14.5px; font-weight: 600; padding: 4px 0; }
.typing .shine {
  background: linear-gradient(90deg, #8a96b3 0%, #ffffff 40%, #8fdcf0 55%, #8a96b3 80%); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 2.2s linear infinite;
}
.orb { width: 14px; height: 14px; border-radius: 50%; background: var(--acc); box-shadow: 0 0 14px rgba(79, 211, 232, 0.7); animation: pulseDot 1.3s infinite; }

.acts { margin: 2px 0 10px; border-radius: 14px; border: 1px solid var(--stroke); background: rgba(255, 255, 255, 0.02); overflow: hidden; }
.acts-head { width: 100%; display: flex; align-items: center; gap: 8px; padding: 8px 12px; font-size: 13px; color: var(--text-2); text-align: left; }
.acts-head .chev { margin-left: auto; transition: transform 0.3s var(--ease); }
.acts.open .acts-head .chev { transform: rotate(180deg); }
.acts-list { display: none; padding: 0 12px 10px; }
.acts.open .acts-list { display: block; }
.act { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text-3); padding: 3px 0; }
.act .i { color: var(--text-3); }
.act.cur { color: var(--text-2); }
.act.cur .i { color: var(--a2); }

.pcards { display: flex; flex-direction: column; gap: 10px; margin: 12px 0 4px; }
.pcard {
  display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 18px; max-width: 560px;
  background: linear-gradient(150deg, rgba(124, 108, 246, 0.14), rgba(79, 211, 232, 0.06)); border: 1px solid rgba(124, 108, 246, 0.28);
  box-shadow: 0 10px 40px -24px rgba(91, 140, 240, 0.8); animation: fadeUp 0.5s var(--ease);
}
.pcard-ico { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--acc); color: #fff; flex: none; box-shadow: 0 0 22px rgba(79, 211, 232, 0.35); }
.pcard-meta { flex: 1; min-width: 0; }
.pcard-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard-sub { font-size: 12.5px; color: var(--text-2); }
.pcard-actions { display: flex; gap: 6px; flex: none; }
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 8px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.02em; }
.badge.ver { background: rgba(255, 255, 255, 0.08); color: var(--text); font-family: var(--mono); }
.badge.new { background: rgba(52, 211, 153, 0.15); color: #6ee7b7; }
.badge.work { background: rgba(79, 211, 232, 0.14); color: #8fe3f2; }
.badge.done { background: rgba(52, 211, 153, 0.15); color: #6ee7b7; }
.badge.fail { background: rgba(248, 113, 113, 0.15); color: #fca5a5; }
.err-line { display: flex; gap: 8px; align-items: flex-start; margin-top: 8px; font-size: 13.5px; color: #fca5a5; }
.stopped-line { margin-top: 6px; font-size: 12.5px; color: var(--text-3); }

.att-row { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; margin-bottom: 6px; }
.att {
  display: inline-flex; align-items: center; gap: 8px; max-width: 240px; height: 40px; padding: 0 12px 0 6px; border-radius: 12px;
  background: var(--panel-2); border: 1px solid var(--stroke); font-size: 13px; cursor: pointer;
}
.att img { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; }
.att .aico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: rgba(255, 255, 255, 0.06); color: var(--text-2); }
.att span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-img { display: block; max-width: 240px; max-height: 200px; border-radius: 14px; border: 1px solid var(--stroke); cursor: zoom-in; object-fit: cover; }

.load-more { display: flex; justify-content: center; margin: 4px 0 18px; }

/* ---------- поле ввода ---------- */
.composer-wrap { padding: 8px 18px calc(12px + var(--safe-b)); flex: none; }
.composer {
  max-width: 820px; margin: 0 auto; border-radius: 24px; padding: 8px; position: relative;
  background: linear-gradient(160deg, rgba(23, 31, 52, 0.92), rgba(14, 20, 36, 0.92)); border: 1px solid var(--stroke-2);
  box-shadow: 0 20px 60px -30px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(124, 108, 246, 0.05);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.composer.focus { border-color: rgba(124, 108, 246, 0.45); box-shadow: 0 20px 60px -30px rgba(0, 0, 0, 0.9), 0 0 0 4px rgba(124, 108, 246, 0.08); }
.composer.drag { border-color: rgba(79, 211, 232, 0.8); }
.c-atts { display: flex; gap: 8px; overflow-x: auto; padding: 4px 4px 8px; scrollbar-width: none; }
.c-atts::-webkit-scrollbar { display: none; }
.c-att {
  position: relative; flex: none; width: 64px; height: 64px; border-radius: 14px; overflow: hidden; background: var(--panel-2); border: 1px solid var(--stroke);
  display: grid; place-items: center; color: var(--text-2);
}
.c-att img { width: 100%; height: 100%; object-fit: cover; }
.c-att .nm { position: absolute; left: 4px; right: 4px; bottom: 3px; font-size: 9.5px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.c-att .rm { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; background: rgba(0, 0, 0, 0.65); display: grid; place-items: center; color: #fff; }
.c-att .prog { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(6, 10, 20, 0.6); font-size: 11px; font-weight: 700; }
.c-att.err { border-color: rgba(248, 113, 113, 0.6); }
.c-text {
  display: block; width: 100%; border: 0; outline: none; background: transparent; resize: none; padding: 8px 10px 4px;
  font-size: 16px; line-height: 1.45; max-height: 38vh; min-height: 30px;
}
.c-text::placeholder { color: var(--text-3); }
.c-row { display: flex; align-items: center; gap: 4px; padding-top: 4px; }
.c-row .grow { flex: 1; }
.send {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--acc); color: #fff; flex: none;
  box-shadow: 0 6px 22px -8px rgba(91, 140, 240, 0.9); transition: transform 0.2s var(--ease), opacity 0.2s, filter 0.2s;
}
.send:hover { filter: brightness(1.1); }
.send:active { transform: scale(0.94); }
.send[disabled] { opacity: 0.35; pointer-events: none; }
.send.stop { background: rgba(255, 255, 255, 0.12); box-shadow: none; }
.mic { width: 40px; height: 40px; border-radius: 50%; }
.rec { display: flex; align-items: center; gap: 10px; padding: 6px 4px 6px 10px; min-height: 52px; }
.rec .dot { width: 10px; height: 10px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 12px #ef4444; animation: pulseDot 1.1s infinite; flex: none; }
.rec .time { font-family: var(--mono); font-size: 14px; color: var(--text-2); min-width: 44px; }
.rec canvas { flex: 1; height: 36px; min-width: 0; }
.rec .lbl { flex: 1; font-size: 14px; color: var(--text-2); }
.composer-note { max-width: 820px; margin: 6px auto 0; text-align: center; font-size: 11.5px; color: var(--text-3); }

/* ---------- главная (новый проект) ---------- */
.home { flex: 1; overflow-y: auto; display: flex; flex-direction: column; padding: 0 18px; }
.hero { max-width: 760px; width: 100%; margin: auto; padding: 40px 0 24px; text-align: center; animation: fadeUp 0.6s var(--ease); }
.hero img { width: 64px; height: 64px; filter: drop-shadow(0 0 26px rgba(79, 211, 232, 0.4)); }
.hero h1 { font-size: 34px; font-weight: 300; letter-spacing: -0.02em; margin: 14px 0 6px; line-height: 1.2; }
.hero h1 b { font-weight: 700; }
.hero p { color: var(--text-2); margin: 0 auto 26px; max-width: 540px; }
.hero .composer { text-align: left; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 19px; font-size: 13.5px; color: var(--text-2);
  background: var(--panel); border: 1px solid var(--stroke); transition: background 0.2s var(--ease), color 0.2s, border-color 0.2s;
}
.chip:hover { background: var(--panel-2); color: var(--text); border-color: var(--stroke-2); }
.chip .i { color: var(--a2); }
.mobile-projects { display: none; }

/* ---------- файлы ---------- */
.files { flex: 1; overflow-y: auto; min-height: 0; padding: 16px 18px calc(24px + var(--safe-b)); }
.ftool { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.fcats { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; padding: 2px; }
.fcats::-webkit-scrollbar { display: none; }
.fcat {
  height: 34px; padding: 0 12px; border-radius: 11px; font-size: 13.5px; font-weight: 600; color: var(--text-2); white-space: nowrap; flex: none;
  background: var(--panel); border: 1px solid var(--stroke); display: inline-flex; align-items: center; gap: 7px; transition: all 0.2s var(--ease);
}
.fcat .n { color: var(--text-3); font-weight: 700; font-size: 12px; }
.fcat.on { background: var(--acc-soft); color: var(--text); border-color: rgba(124, 108, 246, 0.35); }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.fcard {
  border-radius: 18px; overflow: hidden; background: var(--panel); border: 1px solid var(--stroke); text-align: left; display: flex; flex-direction: column;
  transition: transform 0.25s var(--ease), border-color 0.25s, background 0.25s; animation: fadeUp 0.4s var(--ease);
}
.fcard:hover { transform: translateY(-2px); border-color: var(--stroke-2); background: var(--panel-2); }
.fthumb { position: relative; aspect-ratio: 4 / 3; display: grid; place-items: center; background: rgba(0, 0, 0, 0.25); color: var(--text-2); overflow: hidden; }
.fthumb img { width: 100%; height: 100%; object-fit: cover; }
.fthumb.proto { background: radial-gradient(circle at 30% 20%, rgba(124, 108, 246, 0.45), transparent 60%), radial-gradient(circle at 80% 90%, rgba(79, 211, 232, 0.35), transparent 60%), #0e1528; color: #fff; }
.fthumb .big { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: rgba(255, 255, 255, 0.08); }
.fthumb .dur { position: absolute; right: 8px; bottom: 8px; background: rgba(0, 0, 0, 0.65); border-radius: 7px; padding: 1px 7px; font-size: 11.5px; font-family: var(--mono); color: #fff; }
.fthumb .play { position: absolute; width: 42px; height: 42px; border-radius: 50%; background: rgba(0, 0, 0, 0.5); display: grid; place-items: center; color: #fff; }
.fthumb .proc { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(6, 10, 20, 0.55); }
.finfo { padding: 10px 12px 12px; }
.fname { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fsub { font-size: 12px; color: var(--text-3); display: flex; gap: 6px; align-items: center; margin-top: 3px; flex-wrap: wrap; }
.empty { text-align: center; color: var(--text-2); padding: 60px 20px; }
.empty .big { width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 14px; display: grid; place-items: center; background: var(--acc-soft); color: var(--a2); }
.empty h3 { margin: 0 0 6px; color: var(--text); font-size: 18px; }

/* ---------- просмотр файла и прототипа ---------- */
.viewer {
  position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; background: rgba(5, 8, 16, 0.96);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); animation: fadeIn 0.25s var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.vhead { display: flex; align-items: center; gap: 8px; padding: calc(10px + var(--safe-t)) 12px 10px calc(12px + var(--safe-l)); border-bottom: 1px solid var(--stroke); flex: none; }
.vtitle { flex: 1; min-width: 0; }
.vtitle b { display: block; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vtitle small { color: var(--text-3); font-size: 12px; }
.vchip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px 0 12px; border-radius: 11px; background: var(--panel-2); border: 1px solid var(--stroke); font-size: 13px; font-weight: 700; flex: none; }
.vbody { flex: 1; min-height: 0; display: flex; position: relative; }
.vstage { flex: 1; min-width: 0; display: grid; place-items: center; overflow: auto; padding: 16px; }
.vstage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 12px; }
.vstage video { max-width: 100%; max-height: 100%; border-radius: 12px; background: #000; }
.vstage audio { width: min(560px, 100%); }
.vstage iframe.pdf, .vstage object { width: 100%; height: 100%; border: 0; border-radius: 12px; background: #fff; }
.vstage .doc { width: 100%; max-width: 820px; align-self: start; padding: 22px 24px; border-radius: 18px; background: var(--panel); border: 1px solid var(--stroke); }
.frame-wrap { width: 100%; height: 100%; display: grid; place-items: center; }
.frame { width: 100%; height: 100%; border: 0; background: #fff; border-radius: 0; transition: width 0.45s var(--ease), height 0.45s var(--ease), border-radius 0.45s var(--ease); }
.frame-wrap.phone .frame { width: 390px; height: min(844px, 100%); border-radius: 36px; box-shadow: 0 0 0 10px #111827, 0 0 0 11px rgba(255, 255, 255, 0.12), 0 40px 100px -30px rgba(0, 0, 0, 0.9); }
.frame-wrap.tablet .frame { width: min(834px, 100%); height: min(1112px, 100%); border-radius: 26px; box-shadow: 0 0 0 10px #111827, 0 0 0 11px rgba(255, 255, 255, 0.12), 0 40px 100px -30px rgba(0, 0, 0, 0.9); }
.frame-wrap.desktop .frame { border-radius: 14px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12), 0 40px 100px -30px rgba(0, 0, 0, 0.9); }
.vstage.proto { padding: 18px; }
.vfoot { display: flex; align-items: center; gap: 8px; padding: 10px 12px calc(10px + var(--safe-b)); border-top: 1px solid var(--stroke); flex: none; }
.vfoot .grow { flex: 1; }
.devices { display: inline-flex; padding: 3px; border-radius: 12px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--stroke); }
.devices .ibtn { width: 36px; height: 34px; border-radius: 9px; }
.vers { width: 320px; flex: none; border-left: 1px solid var(--stroke); overflow-y: auto; padding: 12px; background: rgba(8, 12, 22, 0.75); }
.vers h4 { margin: 4px 6px 10px; font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-3); }
.vitem { width: 100%; text-align: left; padding: 10px 12px; border-radius: 13px; margin-bottom: 4px; display: flex; gap: 10px; transition: background 0.2s var(--ease); }
.vitem:hover { background: var(--panel); }
.vitem.on { background: var(--acc-soft); box-shadow: inset 0 0 0 1px rgba(124, 108, 246, 0.3); }
.vnum { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--panel-2); font-family: var(--mono); font-weight: 700; font-size: 13px; flex: none; }
.vitem.on .vnum { background: var(--acc); color: #fff; }
.vmeta { min-width: 0; flex: 1; }
.vmeta b { font-size: 13.5px; display: block; }
.vmeta small { display: block; font-size: 12px; color: var(--text-3); }
.vmeta .note { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--text-2); font-size: 12.5px; margin-top: 2px; }
.transcript { margin-top: 18px; padding: 14px 16px; border-radius: 14px; background: var(--panel); border: 1px solid var(--stroke); font-size: 14px; max-width: 560px; white-space: pre-wrap; }

/* ---------- лист и окна ---------- */
.backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(3, 6, 14, 0.62); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.3s var(--ease); }
.backdrop.show { opacity: 1; }
.sheet {
  width: min(520px, calc(100vw - 32px)); max-height: min(86dvh, 760px); display: flex; flex-direction: column; border-radius: 26px;
  background: linear-gradient(165deg, #18203a, #0f1528); border: 1px solid var(--stroke-2); box-shadow: 0 40px 120px -30px rgba(0, 0, 0, 0.9);
  transform: translateY(16px) scale(0.98); transition: transform 0.4s var(--ease); overflow: hidden;
}
.backdrop.show .sheet { transform: none; }
.sheet-grab { display: none; }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 18px 18px 8px 22px; }
.sheet-head h3 { margin: 0; flex: 1; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.sheet-body { padding: 8px 22px 6px; overflow-y: auto; }
.sheet-foot { display: flex; gap: 10px; padding: 14px 22px calc(18px + var(--safe-b)); }
.sheet-foot .btn { flex: 1; }
.opt {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; text-align: left; margin-bottom: 6px;
  border: 1px solid var(--stroke); background: var(--panel); transition: all 0.2s var(--ease);
}
.opt:hover { background: var(--panel-2); }
.opt.on { border-color: rgba(124, 108, 246, 0.55); background: var(--acc-soft); }
.opt .oi { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: rgba(255, 255, 255, 0.06); flex: none; color: var(--a2); }
.opt.on .oi { background: var(--acc); color: #fff; }
.opt b { display: block; font-size: 14.5px; letter-spacing: 0.04em; }
.opt small { color: var(--text-2); font-size: 13px; }
.opt .check { margin-left: auto; color: var(--a2); opacity: 0; }
.opt.on .check { opacity: 1; }
.opt-sec { font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-3); font-weight: 700; margin: 14px 4px 8px; }
.icons-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
.icons-grid button { height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--panel); border: 1px solid var(--stroke); color: var(--text-2); }
.icons-grid button.on { background: var(--acc); color: #fff; border-color: transparent; }
.menu { min-width: 220px; padding: 6px; border-radius: 16px; background: #141b31; border: 1px solid var(--stroke-2); box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.85); position: fixed; z-index: 70; animation: fadeUp 0.25s var(--ease); }
.menu button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 11px; font-size: 14px; text-align: left; }
.menu button:hover { background: var(--panel-2); }
.menu button.danger { color: #fca5a5; }
.urow { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--stroke); }
.urow:last-child { border-bottom: 0; }
.urow .meta { flex: 1; min-width: 0; }
.urow b { display: block; font-size: 14px; }
.urow small { color: var(--text-3); font-size: 12.5px; }
.switch { width: 46px; height: 28px; border-radius: 14px; background: rgba(255, 255, 255, 0.12); position: relative; flex: none; transition: background 0.25s var(--ease); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform 0.25s var(--ease); }
.switch.on { background: var(--acc); }
.switch.on::after { transform: translateX(18px); }
.implist { margin-top: 12px; }
.implist .row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); padding: 6px 0; }

#toasts { position: fixed; left: 50%; transform: translateX(-50%); top: calc(14px + var(--safe-t)); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(440px, calc(100vw - 24px)); }
.toast {
  pointer-events: auto; display: flex; gap: 10px; align-items: center; padding: 11px 15px; border-radius: 15px; font-size: 14px;
  background: #18203a; border: 1px solid var(--stroke-2); box-shadow: 0 20px 50px -18px rgba(0, 0, 0, 0.8); animation: fadeUp 0.35s var(--ease);
}
.toast.err { border-color: rgba(248, 113, 113, 0.45); }
.toast.err .i { color: var(--err); }
.toast.ok .i { color: var(--ok); }

.dropzone {
  position: absolute; inset: 10px; border-radius: 24px; border: 2px dashed rgba(79, 211, 232, 0.6); background: rgba(9, 16, 30, 0.82);
  display: grid; place-items: center; z-index: 20; font-weight: 600; color: #bdefff; pointer-events: none;
}

/* ---------- прототип панелью справа от чата (широкий экран) ---------- */
.body.split .view { flex: 1 1 46%; min-width: 380px; }
.body.split .pcard { flex-wrap: wrap; }
.body.split .pcard-actions { width: 100%; }
.body.split .pcard-actions .btn { flex: 1; }
.viewer.docked {
  position: relative; inset: auto; z-index: 2; flex: 1 1 54%; min-width: 440px; border-left: 1px solid var(--stroke);
  background: rgba(6, 10, 20, 0.55); backdrop-filter: none; -webkit-backdrop-filter: none; animation: slideIn 0.4s var(--ease);
}
.viewer.docked .vhead { padding-top: 10px; }
.viewer.docked .vers { position: absolute; right: 0; top: 0; bottom: 0; z-index: 3; box-shadow: -30px 0 60px -20px rgba(0, 0, 0, 0.85); }
.viewer.docked .vstage.proto { padding: 14px; }
@keyframes slideIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
.ttl { text-align: left; border-radius: 12px; padding: 4px 6px; margin-left: -6px; transition: background 0.2s var(--ease); }
.ttl:hover { background: var(--panel); }
.mobile-only { display: none; }
.shell.at-home .topbar.hidden { display: none; }

/* ---------- телефон и узкие экраны ---------- */
@media (max-width: 899px) {
  body { font-size: 15.5px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .shell.at-home .main { display: flex; }
  .topbar { padding: calc(8px + var(--safe-t)) 10px 8px; min-height: 56px; gap: 6px; }
  .topbar .back { display: inline-grid; }
  .mobile-only { display: flex; }
  .desk-tabs { display: none; }
  .ttl { margin-left: 0; }
  .ttl h2 { font-size: 16px; }
  .ttl .picon { display: none; }
  .tabs-row { padding: 8px 12px 0; display: flex; justify-content: center; }
  .tabs { width: 100%; }
  .tab { flex: 1; justify-content: center; }
  .chat { padding: 14px 12px 6px; }
  .msg { margin-bottom: 18px; gap: 10px; }
  .msg.user .bubble { max-width: 88%; }
  .avatar { width: 28px; height: 28px; }
  .composer-wrap { padding: 6px 8px calc(8px + var(--safe-b)); }
  .composer { border-radius: 22px; }
  .pcard { flex-wrap: wrap; }
  .pcard-actions { width: 100%; }
  .pcard-actions .btn { flex: 1; }
  .home { padding: 0 12px; }
  .hero { padding: 26px 0 12px; margin: 0; }
  .hero h1 { font-size: 27px; }
  .hero p { margin-bottom: 18px; font-size: 14.5px; }
  .mobile-projects { display: block; padding: 8px 0 calc(20px + var(--safe-b)); }
  .mobile-projects .pitem { background: var(--panel); border: 1px solid var(--stroke); padding: 12px; margin-bottom: 8px; border-radius: 16px; }
  .files { padding: 12px 12px calc(20px + var(--safe-b)); }
  .ftool { gap: 8px; }
  .ftool .fcats { order: 3; flex: 1 1 100%; }
  .ftool .search { flex: 1; width: auto !important; }
  .fgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .vers { position: absolute; inset: auto 0 0 0; width: auto; max-height: 62%; border-left: 0; border-top: 1px solid var(--stroke-2); border-radius: 24px 24px 0 0; z-index: 3; background: #10172b; padding-bottom: calc(12px + var(--safe-b)); box-shadow: 0 -30px 80px -20px rgba(0, 0, 0, 0.9); }
  .vstage { padding: 0; }
  .vstage.proto { padding: 0; }
  .frame-wrap .frame, .frame-wrap.phone .frame { width: 100%; height: 100%; border-radius: 0; box-shadow: none; }
  .devices { display: none; }
  .backdrop { align-items: flex-end; }
  .sheet { width: 100%; max-height: 88dvh; border-radius: 26px 26px 0 0; transform: translateY(100%); border-bottom: 0; }
  .sheet-grab { display: block; width: 40px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.22); margin: 10px auto 0; }
  .sheet-head { padding-top: 10px; }
  #toasts { top: auto; bottom: calc(90px + var(--safe-b)); }
}
@media (min-width: 900px) {
  .tabs-row { display: none; }
}
@media (hover: none) {
  .fcard:hover { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
