/* X7 Business — стили по эталонному макету. Размеры в CSS-px для экрана 390px. */
:root {
  --bg: #04080E;
  --card: #0B1119;
  --card-2: #101822;
  --line: rgba(255, 255, 255, 0.055);
  --text: #F2F5FB;
  --text-2: #C9D1E0;
  --muted: #8B94A7;
  --green: #3DDC97;
  --green-bg: rgba(46, 204, 113, 0.14);
  --blue: #4F8BFF;
  --violet: #7A5CFF;
  --violet-grad: linear-gradient(135deg, #7E5BFF 0%, #5E66FF 100%);
  --red: #FF4D5E;
  --amber: #FFB020;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabs-h: 66px;
  --r: 18px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; overflow-x: hidden; }
body {
  min-height: 100vh;
  color: var(--text);
  font: 400 14px/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  font-feature-settings: "tnum" 1;
}
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
button:focus-visible, textarea:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
h1, h2, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
#app { max-width: 560px; margin: 0 auto; position: relative; }
main { padding: 0 18px calc(var(--tabs-h) + var(--safe-bottom) + 18px); }
body.with-composer main { padding-bottom: calc(var(--tabs-h) + var(--safe-bottom) + 196px); }
.view > * + * { margin-top: 12px; }

/* ---------- базовые элементы ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px 16px 16px;
  position: relative;
}
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.row.top { align-items: flex-start; }
.row.start { justify-content: flex-start; gap: 10px; }
.card-head { margin-bottom: 10px; }
.card-head h2 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
h2.mb { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.lbl { color: var(--muted); font-size: 13.5px; line-height: 1.25; }
.lbl.big { color: var(--text); font-size: 15px; font-weight: 600; }
.num-xl { font-size: 36px; font-weight: 800; letter-spacing: -0.025em; line-height: 1.1; margin: 14px 0 14px; }
.num-lg { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; margin: 6px 0 4px; }
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 5px 10px; border-radius: 999px;
  background: var(--green-bg); color: var(--green);
  font-size: 12.5px; font-weight: 600; line-height: 1; white-space: nowrap; flex: none;
}
.badge.lg { font-size: 17px; padding: 9px 16px; }
.badge.red { background: rgba(255, 77, 94, 0.14); color: #FF7A86; }
.badge.grey { background: rgba(139, 148, 167, 0.14); color: var(--muted); }
.link { color: var(--blue); font-size: 12.5px; font-weight: 500; white-space: nowrap; flex: none; display: inline-flex; align-items: center; gap: 3px; }
.link i { font-style: normal; font-size: 15px; line-height: 1; }
.select {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  padding: 8px 10px 8px 12px; border-radius: 11px;
  background: var(--card-2); border: 1px solid var(--line);
  font-size: 13px; font-weight: 500; color: var(--text-2);
}
.select svg { width: 14px; height: 14px; }
.btn-violet {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 12px 18px; border-radius: 13px;
  background: var(--violet-grad); color: #fff; font-size: 15px; font-weight: 600;
  box-shadow: 0 6px 18px -8px rgba(122, 92, 255, 0.8);
}
.btn-violet .plus { font-size: 19px; line-height: 1; font-weight: 400; margin-top: -1px; }
.btn-violet.wide { display: flex; width: 100%; padding: 12px; margin-top: 12px; font-size: 14px; }
.chips { display: flex; gap: 8px; }
.chips.scroll { overflow-x: auto; scrollbar-width: none; margin-left: -18px; margin-right: -18px; padding: 0 18px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  padding: 11px 16px; border-radius: 13px;
  background: var(--card); border: 1px solid var(--line);
  font-size: 14.5px; font-weight: 500; color: var(--text-2);
}
.chip i { font-style: normal; font-size: 11px; padding: 2px 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.08); color: var(--text-2); }
.chip.on { background: var(--violet-grad); border-color: transparent; color: #fff; }
.chip.on i { background: rgba(255, 255, 255, 0.22); color: #fff; }
.note { color: var(--muted); font-size: 12.5px; line-height: 1.45; padding: 2px 2px; }
.note.in { margin-top: 10px; padding: 0; }
.empty-row { color: var(--muted); font-size: 13px; line-height: 1.45; padding: 4px 0; }
.card.empty { text-align: center; padding: 22px 18px 16px; }
.card.empty h2 { font-size: 16px; font-weight: 600; }
.card.empty p { color: var(--muted); font-size: 13px; margin-top: 6px; }

/* ---------- Главная: hero ---------- */
.hero {
  position: relative;
  min-height: 214px;
  padding: 30px 0 0;
  margin: 0 -18px;
  padding-left: 18px; padding-right: 18px;
  background:
    radial-gradient(62% 70% at 82% 40%, rgba(34, 98, 240, 0.7) 0%, rgba(24, 70, 190, 0.34) 42%, transparent 74%),
    radial-gradient(45% 55% at 100% 0%, rgba(20, 60, 170, 0.5), transparent 70%);
}
.hero-text { position: relative; z-index: 1; max-width: 62%; }
.hero h1 { font-size: 25px; line-height: 1.5; font-weight: 700; letter-spacing: -0.02em; }
.hero-sub { margin-top: 10px; color: #A5AFC4; font-size: 13.5px; }
.status-pill {
  --tone: var(--green);
  display: inline-flex; align-items: center; gap: 10px;
  margin-top: 22px; padding: 8px 16px 8px 8px; border-radius: 14px; min-width: 232px;
  background: rgba(10, 18, 34, 0.85); border: 1px solid rgba(255, 255, 255, 0.05);
  max-width: 100%;
}
.status-pill[data-state="idle"] { --tone: #6FA0FF; }
.status-pill[data-state="paused"] { --tone: var(--red); }
.status-pill[data-state="stopping"], .status-pill[data-state="offline"] { --tone: var(--amber); }
.sp-ico {
  width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--tone) 18%, transparent); color: var(--tone);
}
.sp-ico svg { width: 15px; height: 15px; }
.status-pill[data-state="working"] .sp-ico { animation: pulse 1.8s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--tone) 50%, transparent); } 100% { box-shadow: 0 0 0 9px transparent; } }
.sp-txt { min-width: 0; }
.sp-txt b { display: block; font-size: 14px; font-weight: 600; color: var(--tone); line-height: 1.25; }
.sp-txt small { display: block; font-size: 12.5px; color: #A5AFC4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 168px; }
.sp-txt small:empty { display: none; }
.robot-wrap { position: absolute; right: -64px; top: 8px; width: 250px; height: 284px; pointer-events: none; z-index: 0; }
.robot-flat { position: absolute; right: 18px; top: 18px; width: 170px; height: 170px; filter: drop-shadow(0 10px 30px rgba(50, 110, 255, 0.55)); }
.robot-3d { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 0.5s ease; }
.hero.has-3d .robot-3d { opacity: 1; }
.robot-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 12px 32px rgba(50, 110, 255, 0.45)); }
.hero.has-3d .robot-flat, .hero.has-3d .robot-img { display: none; }
.view[data-view="home"] > .hero + .stop-row { margin-top: 18px; }
.view[data-view="home"] > .stop-row + .card { margin-top: 14px; }
.view[data-view="home"] > .stop-row, .view[data-view="home"] > .card, .view[data-view="home"] > .kpi3 { position: relative; z-index: 1; }

/* STOP */
.stop-row {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 9px;
  padding: 13px; border-radius: 14px;
  background: var(--card); border: 1px solid rgba(255, 77, 94, 0.28);
  color: #FF6B7A; font-size: 14px; font-weight: 600;
  transition: transform 0.12s ease;
}
.stop-row:active { transform: scale(0.985); }
.stop-ico { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; background: rgba(255, 77, 94, 0.16); color: var(--red); box-shadow: 0 0 14px rgba(255, 77, 94, 0.45); }
.stop-ico svg { width: 14px; height: 14px; }
.stop-row.is-resume { border-color: rgba(61, 220, 151, 0.3); color: var(--green); }
.stop-row.is-resume .stop-ico { background: var(--green-bg); color: var(--green); box-shadow: 0 0 14px rgba(61, 220, 151, 0.4); }
.stop-row:disabled { opacity: 0.55; }

/* Баланс и KPI */
.balance { background: linear-gradient(160deg, #0D1726 0%, #0A1019 60%); }
.balance { padding: 20px 16px 20px; }
.balance .num-xl { margin: 12px 0 12px; }
.coin {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: #3B2300;
  background: linear-gradient(145deg, #FFD36E 0%, #FF9A2E 100%);
  box-shadow: 0 6px 16px -6px rgba(255, 154, 46, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.coin svg { width: 20px; height: 20px; }
.delta-green { display: inline-flex; align-items: center; gap: 5px; color: var(--green); font-size: 15px; font-weight: 600; }
.delta-green svg { width: 15px; height: 15px; }
.kpi3, .kpi4, .kpi2 { display: grid; gap: 12px; }
.kpi3 { grid-template-columns: repeat(3, 1fr); }
.kpi4 { display: flex; overflow-x: auto; scrollbar-width: none; margin-left: -18px; margin-right: -18px; padding: 0 18px; }
.kpi4::-webkit-scrollbar { display: none; }
.kpi4 .kpi { flex: 0 0 108px; }
.kpi2 { grid-template-columns: repeat(2, 1fr); }
.kpi { padding: 19px 14px 17px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; min-width: 0; }
.kpi .badge { margin-top: 5px; }
.kpi .lbl { font-size: 13.5px; }
.kpi b { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; margin: 0; white-space: nowrap; }
.kpi4 .kpi { padding: 16px 12px 14px; gap: 8px; min-height: 118px; justify-content: space-between; }
.kpi4 .kpi .lbl { font-size: 13px; }
.kpi4 .kpi b { font-size: 24px; }
.kpi2 .kpi { padding: 16px 14px 15px; gap: 8px; }
.kpi2 .kpi .badge { margin-top: 2px; }
.kpi.ico { padding-right: 56px; }
.kico { position: absolute; right: 14px; top: 18px; width: 40px; height: 40px; display: grid; place-items: center; filter: drop-shadow(0 0 12px currentColor); }
.kico svg { width: 34px; height: 34px; }

/* График */
.chart-card .lbl { margin-top: 2px; }
.chart { position: relative; height: 142px; margin-top: 14px; display: flex; flex-direction: column; }
.chart.tall { height: 176px; }
.chart svg { width: 100%; flex: 1; min-height: 0; overflow: visible; display: block; }
.chart .ch-x { height: 18px; margin-top: 6px; display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); }
.chart .ch-x span { width: 1px; display: flex; justify-content: center; white-space: nowrap; }
.chart .ch-y { position: absolute; left: 0; top: 0; bottom: 24px; display: flex; flex-direction: column; justify-content: space-between; font-size: 11.5px; color: var(--muted); }
.chart.has-y svg { margin-left: 36px; width: calc(100% - 36px); }
.chart.has-y .ch-x { margin-left: 36px; }
.chart .tip {
  position: absolute; transform: translate(var(--tx, -50%), calc(-100% - 12px));
  padding: 4px 9px; border-radius: 9px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
  background: #1C1B3A; border: 1px solid rgba(160, 130, 255, 0.35); color: #B49CFF;
}
.chart .tip::after { content: ""; position: absolute; left: var(--ax, 50%); bottom: -5px; width: 8px; height: 8px; transform: translateX(-50%) rotate(45deg); background: #1C1B3A; border-right: 1px solid rgba(160, 130, 255, 0.35); border-bottom: 1px solid rgba(160, 130, 255, 0.35); }

/* Лента действий */
.actions li { display: grid; grid-template-columns: 40px 24px 1fr; gap: 11px; align-items: center; padding: 6.5px 0; font-size: 14px; }
.actions time { color: var(--muted); font-size: 13px; }
.actions .ai { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; }
.actions .ai svg { width: 14px; height: 14px; }
.actions .ai.ok { background: rgba(46, 204, 113, 0.18); color: var(--green); }
.actions .ai.info { background: rgba(79, 139, 255, 0.18); color: #7FB0FF; }
.actions .ai.agent { background: rgba(122, 92, 255, 0.22); color: #B49CFF; }
.actions .ai.bad { background: rgba(255, 77, 94, 0.18); color: #FF7A86; }
.actions .ai.warn { background: rgba(255, 176, 32, 0.2); color: var(--amber); }
.actions .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }

/* ---------- Агент ---------- */
.agent-head { display: flex; align-items: center; gap: 12px; padding-top: 10px; }
.agent-title h1 { font-size: 23px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
.avatar {
  width: 52px; height: 52px; border-radius: 50%; flex: none; display: grid; place-items: center; overflow: hidden;
  background: #0E1222; border: 2px solid transparent;
  background-image: linear-gradient(#0E1222, #0E1222), linear-gradient(135deg, #8F5CFF, #5A4BFF);
  background-origin: border-box; background-clip: padding-box, border-box;
}
.avatar svg, .avatar img { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; }
.avatar .avatar-img { object-fit: cover; object-position: 50% 6%; transform: scale(1.9); transform-origin: 50% 12%; }
.online { --tone: var(--green); font-size: 13px; font-weight: 500; color: var(--tone); display: inline-flex; align-items: center; gap: 6px; margin-top: 3px; }
.online::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--tone); box-shadow: 0 0 8px var(--tone); }
.online[data-state="paused"] { --tone: var(--red); }
.online[data-state="offline"], .online[data-state="stopping"] { --tone: var(--amber); }
.gear { margin-left: auto; width: 36px; height: 36px; display: grid; place-items: center; color: #AAB3C7; }
.gear svg { width: 24px; height: 24px; }

.bubble { position: relative; padding: 12px 14px 20px; border-radius: 16px; max-width: 92%; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.bubble.agent-b { background: var(--card); border: 1px solid var(--line); border-top-left-radius: 6px; align-self: flex-start; }
.bubble.me { margin-left: auto; background: var(--violet-grad); color: #fff; border-bottom-right-radius: 6px; max-width: 84%; align-self: flex-end; box-shadow: 0 10px 26px -14px rgba(122, 92, 255, 0.95); }
.bubble.is-error { border-color: rgba(255, 77, 94, 0.4); }
.b-text { white-space: pre-wrap; }
.b-err { color: #FF8597; margin-top: 8px; }
.b-time { position: absolute; right: 10px; bottom: 6px; font-size: 10.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 3px; }
.bubble.me .b-time { color: rgba(255, 255, 255, 0.75); }
.b-time svg { width: 13px; height: 13px; }
.bubble a { color: #8FB5FF; }
.more { display: block; margin-top: 8px; color: #8FB5FF; font-weight: 600; font-size: 13px; }
.intro .b-text { white-space: pre-line; }

.quick { display: grid; grid-template-columns: repeat(10, 1fr); gap: 8px; }
.quick button {
  display: flex; align-items: center; gap: 8px; text-align: left; min-width: 0;
  grid-column: span 5; min-height: 48px; padding: 10px 8px 10px 10px; border-radius: 13px;
  background: var(--card); border: 1px solid var(--line);
  font-size: 12px; font-weight: 500; letter-spacing: -0.01em; color: var(--text-2); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.quick button > span { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.quick button:nth-child(5) { grid-column: span 6; }
.quick button:nth-child(6) { grid-column: span 4; }
.qi { width: 22px; height: 22px; flex: none; display: grid; place-items: center; }
.qi svg { width: 22px; height: 22px; }
.qi.big { width: 36px; height: 36px; border-radius: 10px; background: rgba(79, 139, 255, 0.14); }
.qi.big svg { width: 20px; height: 20px; }

.chat { display: flex; flex-direction: column; gap: 10px; }
.chat:empty { display: none; }
.task-card { padding: 14px 14px 22px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); max-width: 92%; position: relative; }
.task-card h3 { margin: 0 0 10px; font-size: 14.5px; font-weight: 600; }
.steps { display: flex; flex-direction: column; gap: 8px; }
.steps li { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--text-2); }
.steps li i {
  width: 22px; height: 22px; border-radius: 6px; flex: none; display: grid; place-items: center; font-style: normal;
  font-size: 12px; font-weight: 600; background: #C9D3EA; color: #1B2440;
}
.steps li.done i { background: rgba(61, 220, 151, 0.22); color: var(--green); }
.steps li.now i { background: var(--violet-grad); color: #fff; }
.steps li.todo { color: var(--muted); }
.steps li.todo i { background: rgba(201, 211, 234, 0.35); color: #5A6480; }
.budget { margin-top: 12px; padding: 12px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.08); }
.budget .bh { display: flex; align-items: center; gap: 9px; font-size: 14px; }
.budget .bh b { font-weight: 600; }
.budget .bi { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; border: 1.5px solid var(--green); color: var(--green); }
.budget .bi svg { width: 12px; height: 12px; }
.budget .bar { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 13px; color: var(--text-2); }
.budget .bar i { flex: 1; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.budget .bar i span { display: block; height: 100%; width: 0; min-width: 6px; border-radius: 3px; background: var(--green); transition: width 1s linear; }
.task-now { display: flex; align-items: center; gap: 9px; margin-top: 12px; font-size: 13.5px; color: var(--text-2); }
.task-now .bi { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--green); display: grid; place-items: center; color: var(--green); }
.task-now .bi svg { width: 12px; height: 12px; }
.task-now .timer { margin-left: auto; color: var(--green); font-weight: 600; }

/* Поле ввода и инструменты */
.composer {
  position: fixed; left: 0; right: 0; bottom: calc(var(--tabs-h) + var(--safe-bottom));
  max-width: 560px; margin: 0 auto; padding: 10px 12px 8px;
  background: linear-gradient(transparent, var(--bg) 18%); z-index: 6;
}
.composer-row { display: flex; align-items: flex-end; gap: 8px; }
.input-pill {
  flex: 1; display: flex; align-items: flex-end; gap: 8px;
  padding: 4px 12px 4px 16px; border-radius: 22px;
  background: var(--card-2); border: 1px solid rgba(255, 255, 255, 0.07);
}
.input-pill textarea { flex: 1; resize: none; border: 0; outline: 0; background: none; color: var(--text); font: inherit; font-size: 14px; max-height: 120px; padding: 10px 0; }
.input-pill textarea::placeholder { color: var(--muted); }
.smile { color: var(--muted); padding: 9px 0; display: grid; place-items: center; }
.smile svg { width: 22px; height: 22px; }
.round-btn { width: 44px; height: 44px; flex: none; border-radius: 50%; background: var(--card-2); border: 1px solid rgba(255, 255, 255, 0.07); color: var(--text-2); display: grid; place-items: center; }
.round-btn svg { width: 20px; height: 20px; }
.round-btn:not(:disabled) { background: var(--violet-grad); color: #fff; border-color: transparent; }
.tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.tools button {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 9px 4px 8px; border-radius: 12px; background: var(--card); border: 1px solid var(--line);
  font-size: 11.5px; font-weight: 500; color: var(--text-2); white-space: nowrap;
}
.tools button i { width: 24px; height: 24px; display: grid; place-items: center; }
.tools button i svg { width: 24px; height: 24px; }
.tools .danger { color: #FF7A86; }
.suggest-btn {
  display: flex; align-items: center; justify-content: center; gap: 7px; margin: 8px auto 0;
  padding: 9px 20px; border-radius: 12px; background: var(--card); border: 1px solid var(--line);
  font-size: 13px; font-weight: 500; color: var(--text-2);
}

/* ---------- Страницы ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; padding-top: 10px; }
.page-head h1 { font-size: 27px; font-weight: 700; letter-spacing: -0.015em; margin-right: auto; }
.back { width: 34px; height: 34px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); font-size: 22px; line-height: 1; margin-right: 4px; }

/* Контент: сетка роликов */
.video-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.video-card { display: flex; flex-direction: column; gap: 8px; padding: 8px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); text-align: left; min-width: 0; }
.video-card .thumb {
  aspect-ratio: 9 / 13; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: linear-gradient(160deg, #141C33 0%, #0B1222 100%); color: var(--text-2); font-size: 13px; font-weight: 600;
}
.video-card.ghost .thumb { border: 1px dashed rgba(255, 255, 255, 0.16); }
.plus-big { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-size: 28px; font-weight: 300; background: var(--violet-grad); color: #fff; line-height: 1; }
.v-title { font-size: 12.5px; color: var(--text-2); padding: 0 4px; line-height: 1.35; }
.v-foot { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 2px; }

/* Список с рангами (топ / последние задачи / план) */
.top-list li { display: grid; grid-template-columns: 30px 1fr auto; gap: 12px; align-items: center; padding: 8px 0; }
.top-list li i {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-style: normal; font-size: 14px; font-weight: 600;
  background: rgba(255, 255, 255, 0.06); color: var(--text-2);
}
.top-list li:nth-child(1) i { background: rgba(255, 90, 90, 0.22); color: #FFB3B3; }
.top-list li:nth-child(2) i { background: rgba(255, 150, 70, 0.22); color: #FFD0A8; }
.top-list li:nth-child(3) i { background: rgba(61, 220, 151, 0.2); color: #9FF0CF; }
.top-list li span { min-width: 0; }
.top-list li b { display: block; font-size: 13.5px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-list li small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-list li em { font-style: normal; font-size: 12.5px; font-weight: 600; color: var(--green); white-space: nowrap; }
.top-list li em.bad { color: #FF7A86; }
.top-list li em.muted { color: var(--muted); }
.top-list.road li i { background: rgba(255, 255, 255, 0.06); color: var(--muted); }
.top-list.road li.done i { background: rgba(61, 220, 151, 0.2); color: var(--green); }
.top-list.road li.now i { background: var(--violet-grad); color: #fff; }
.top-list.road li em { color: var(--muted); }
.top-list.road li.done em { color: var(--green); }
.top-list.road li.now em { color: #B49CFF; }

/* Финансы */
.sources li { display: grid; grid-template-columns: 1fr auto auto; gap: 4px 12px; align-items: center; padding: 10px 0 12px; }
.sources li + li { border-top: 1px solid transparent; }
.sources li span { font-size: 14.5px; color: var(--text-2); }
.sources li em { font-style: normal; font-size: 14px; color: var(--text-2); }
.sources li b { font-size: 14px; font-weight: 600; min-width: 56px; text-align: right; }
.sources li i { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.07); overflow: hidden; margin-top: 4px; }
.sources li i span { display: block; height: 100%; border-radius: 4px; min-width: 0; }
.sales li { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 8px 0; }
.sales .si { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: rgba(122, 92, 255, 0.2); color: #A48BFF; }
.sales b { display: block; font-size: 13.5px; font-weight: 500; }
.sales small { color: var(--muted); font-size: 12px; }
.sales em { font-style: normal; color: var(--green); font-weight: 600; }
.sales .empty-row { display: block; }
.link-card { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; }
.link-card b { display: block; font-size: 14px; font-weight: 600; }
.link-card small { display: block; font-size: 12px; color: var(--muted); }
.chev { margin-left: auto; font-size: 22px; color: var(--muted); }

/* Журнал */
.task-list { display: flex; flex-direction: column; gap: 8px; }
.task { padding: 13px 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.task-head { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--muted); }
.task-prompt { margin-top: 5px; font-weight: 500; font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.task-body { margin-top: 10px; color: var(--text-2); font-size: 13.5px; overflow-wrap: anywhere; }
.status { font-weight: 600; }
.status.done { color: var(--green); }
.status.failed, .status.rejected { color: #FF7A86; }
.status.cancelled { color: var(--amber); }
.status.running, .status.cancel_requested, .status.queued { color: #7FB0FF; }
.ghost-btn { display: block; width: 100%; margin-top: 12px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); color: var(--muted); font-weight: 600; font-size: 13px; }

/* ---------- Нижнее меню ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 7;
  max-width: 560px; margin: 0 auto;
  height: calc(var(--tabs-h) + var(--safe-bottom)); padding: 6px 4px var(--safe-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(5, 8, 14, 0.96); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; color: #8A93A8; font-size: 12.5px; font-weight: 500; }
.tab svg { width: 24px; height: 24px; }
.tab .o { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tab.is-active { color: #5F93FF; }
.tab.is-active svg { color: #4F8BFF; filter: drop-shadow(0 0 7px rgba(79, 139, 255, 0.9)); }
.tab.is-active .o { fill: rgba(79, 139, 255, 0.95); stroke: #7FAFFF; }

/* ---------- Настройки ---------- */
.sheet { position: fixed; inset: 0; z-index: 20; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(2, 4, 10, 0.7); }
.sheet-body {
  position: absolute; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto;
  padding: 20px 18px calc(16px + var(--safe-bottom)); border-radius: 22px 22px 0 0;
  background: #0C1320; border-top: 1px solid var(--line); animation: up 0.22s ease-out;
}
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.sheet-body h2 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.setting:empty { display: none; }
.setting-name { font-weight: 600; font-size: 14px; }
.setting-hint { font-size: 12.5px; color: var(--muted); }
.stepper { display: flex; align-items: center; gap: 4px; flex: none; }
.stepper button { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-size: 18px; }
.stepper output { min-width: 38px; text-align: center; font-weight: 700; font-size: 17px; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); flex: none; }
.seg button { padding: 6px 12px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--violet-grad); color: #fff; }

.toast {
  position: fixed; left: 16px; right: 16px; z-index: 30; bottom: calc(var(--tabs-h) + var(--safe-bottom) + 14px);
  max-width: 528px; margin: 0 auto; padding: 12px 16px; border-radius: 13px;
  background: #151D2E; border: 1px solid var(--line); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5); font-size: 13.5px;
}
body.with-composer .toast { bottom: calc(var(--tabs-h) + var(--safe-bottom) + 200px); }
.toast.is-error { border-color: rgba(255, 77, 94, 0.55); }
.gate { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px; text-align: center; background: var(--bg); color: var(--muted); }

@media (max-width: 374px) {
  .hero h1 { font-size: 23px; }
  .status-pill { min-width: 0; }
  .robot-wrap { width: 228px; height: 260px; right: -72px; top: 10px; }
  .kpi b { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- MVP-2: предложения и проекты ---------- */
.proposals li { padding: 12px 0; border-top: 1px solid var(--line); }
.proposals li:first-child { border-top: 0; padding-top: 2px; }
.proposals b { display: block; font-size: 14px; font-weight: 600; line-height: 1.35; }
.proposals small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 4px; line-height: 1.4; }
.proposals .pj { color: #B49CFF; }
.prop-btns { display: flex; gap: 8px; margin-top: 10px; }
.prop-btns button { flex: 1; padding: 9px; border-radius: 11px; font-size: 13px; font-weight: 600; }
.prop-btns .ok { background: rgba(61, 220, 151, 0.14); color: var(--green); border: 1px solid rgba(61, 220, 151, 0.3); }
.prop-btns .no { background: var(--card-2); color: var(--muted); border: 1px solid var(--line); }
.prop-btns button:disabled { opacity: 0.5; }
.proposals-card { border-color: rgba(122, 92, 255, 0.35); background: linear-gradient(160deg, #141634 0%, #0B1119 70%); }

.project-list { display: flex; flex-direction: column; gap: 10px; }
.project { display: block; width: 100%; text-align: left; padding: 16px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); }
.project .row { align-items: flex-start; }
.project b { font-size: 15px; font-weight: 600; line-height: 1.3; }
.project p { color: var(--muted); font-size: 13px; margin-top: 6px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.project .meta { display: flex; gap: 14px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.project .meta em { font-style: normal; color: var(--text-2); font-weight: 600; }
.st-badge { flex: none; }
.st-idea, .st-research { background: rgba(79, 139, 255, 0.15); color: #7FB0FF; }
.st-testing { background: rgba(122, 92, 255, 0.2); color: #B49CFF; }
.st-active { background: var(--green-bg); color: var(--green); }
.st-paused { background: rgba(255, 176, 32, 0.15); color: var(--amber); }
.st-stopped, .st-done { background: rgba(139, 148, 167, 0.14); color: var(--muted); }

.pj-summary { color: var(--text-2); font-size: 14px; line-height: 1.5; margin-top: 10px; white-space: pre-wrap; }
.pj-goal { margin-top: 10px; font-size: 13px; color: var(--muted); }
.pj-goal:empty { display: none; }
.seg.wide { display: flex; margin-top: 14px; }
.seg.wide button { flex: 1; }
.exp-list li, .insight-list li { padding: 10px 0; border-top: 1px solid var(--line); font-size: 13.5px; line-height: 1.45; }
.exp-list li:first-child, .insight-list li:first-child { border-top: 0; padding-top: 2px; }
.exp-list .row { align-items: flex-start; }
.exp-list b { font-weight: 500; }
.exp-list small, .insight-list small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.exp-list .res { color: var(--text-2); margin-top: 6px; }
.insight-list i { font-style: normal; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; margin-right: 6px; background: rgba(255,255,255,.07); color: var(--text-2); }
.insight-list i.lesson { background: rgba(122, 92, 255, 0.2); color: #B49CFF; }
.insight-list i.risk { background: rgba(255, 77, 94, 0.16); color: #FF7A86; }
.insight-list i.idea { background: rgba(255, 176, 32, 0.15); color: var(--amber); }
.insight-list a { color: #8FB5FF; font-size: 12.5px; }
.view[data-view="project"] .page-head { align-items: flex-start; }
.view[data-view="project"] .page-head h1 { font-size: 21px; line-height: 1.25; padding-top: 4px; }

/* ---------- Ролики ---------- */
.video-card .thumb { position: relative; overflow: hidden; }
.video-card .thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.video-card .thumb .dur { position: absolute; right: 8px; bottom: 8px; padding: 2px 7px; border-radius: 7px; background: rgba(0,0,0,.6); color: #fff; font-size: 11.5px; font-weight: 600; }
.video-card .thumb .play { position: absolute; width: 46px; height: 46px; border-radius: 50%; background: rgba(0,0,0,.45); display: grid; place-items: center; backdrop-filter: blur(4px); }
.video-card .thumb .play svg { width: 20px; height: 20px; color: #fff; margin-left: 3px; }
.video-card .thumb.proc { background: linear-gradient(160deg, #18204a, #0B1222); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255,255,255,.15); border-top-color: #8F7BFF; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.v-title b { display: block; color: var(--text); font-weight: 600; }
.badge.red { background: rgba(255, 77, 94, 0.14); color: #FF7A86; }
.player-body { max-height: 92vh; overflow-y: auto; }
.player-body video { display: block; width: auto; max-width: 100%; height: min(62vh, 560px); margin: 0 auto 14px; border-radius: 14px; background: #000; aspect-ratio: 9 / 16; }
.player-body h2 { font-size: 16px; }
.player-body .row { gap: 10px; margin-top: 12px; }
.player-body .row .ghost-btn, .player-body .row .btn-violet { margin-top: 0; flex: 1; }
.voice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.voice-grid button { padding: 12px 6px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.voice-grid button small { display: block; font-size: 11.5px; font-weight: 500; color: var(--muted); margin-top: 2px; }
.voice-grid button:disabled { opacity: 0.4; }
.voice-grid.paid button { border-color: rgba(122, 92, 255, 0.35); }
.video-card .thumb.wait { background: linear-gradient(160deg, #2a1d5c, #0B1222); }
