/* app-shell.css — каркас и ритм в духе Hermes Hub (Mini App), с цветом и движением.
   Подключается последним: перекрывает styles.css, не удаляя старые правила. */

:root {
  --app-w: 620px;
  --ink: #101114;
  --ink-2: #6b7280;
  --ink-3: #9aa0aa;
  --line: #ececf1;
  --surface: #ffffff;
  --canvas: #f7f8fa;
  --accent: #5e6ad2;
  --accent-soft: #eef0ff;
  --ok: #16a34a;
  --warm: #2563eb;
  --quest: #d97706;
  --casino: #7c3aed;
}

html, body { background: var(--canvas); }
body { color: var(--ink); }

/* ---------- каркас ---------- */
.shell {
  width: 100%;
  max-width: var(--app-w);
  margin: 0 auto;
  padding: 0 18px calc(104px + env(safe-area-inset-bottom));
}

/* ---------- шапка ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0 12px;
  margin: 0 -18px;
  padding-left: 18px;
  padding-right: 18px;
  background: color-mix(in srgb, var(--canvas) 86%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.topbar.is-stuck { border-bottom-color: var(--line); }

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 34px; height: 34px;
  flex: 0 0 34px;
  border-radius: 11px;
  background: linear-gradient(145deg, #6d78e0, #4f5bc4);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.02em;
  box-shadow: 0 4px 12px rgba(94, 106, 210, .28);
  position: relative;
}
.brand-mark span { font-size: 9px; position: absolute; right: 5px; top: 5px; opacity: .9; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text b { font-size: 15.5px; font-weight: 650; letter-spacing: -.015em; }
.brand-sub {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--ink-3); font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, .14);
  animation: pulse 2.6s ease-in-out infinite;
}
.status-dot.warn { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .16); animation: none; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(34, 197, 94, .14); }
  50% { box-shadow: 0 0 0 5px rgba(34, 197, 94, .06); }
}

.header-tools { display: flex; align-items: center; gap: 8px; }
.header-tools .icon-button {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  color: #6b7280;
  display: grid; place-items: center;
  transition: transform .16s, background .16s, color .16s;
}
.header-tools .icon-button:active { transform: scale(.92); background: #f1f2f6; }
.owner-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 11px; font-weight: 650; letter-spacing: .02em;
  display: grid; place-items: center;
  box-shadow: 0 2px 6px rgba(16, 17, 20, .18);
}

/* ---------- нижняя навигация ---------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  max-width: 100%;
  margin: 0 auto;
  padding: 7px 10px calc(7px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .94);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line);
}
.tab {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 6px 0 4px;
  border: 0;
  background: none;
  color: var(--ink-3);
  font-size: 10.5px;
  font-weight: 550;
  letter-spacing: -.01em;
  transition: color .18s;
  -webkit-tap-highlight-color: transparent;
}
.tab svg { transition: transform .22s cubic-bezier(.2, .9, .25, 1.2); }
.tab.active { color: var(--accent); }
.tab.active svg { transform: translateY(-1px) scale(1.07); }
.tab:active svg { transform: scale(.9); }
.tab.active::before {
  content: "";
  position: absolute;
  top: 0;
  width: 20px; height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--accent);
  animation: tabIn .24s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes tabIn { from { transform: scaleX(.3); opacity: 0; } to { transform: scaleX(1); opacity: 1; } }

/* ---------- поверхности ---------- */
.panel,
.deploy-card,
.dir-card,
.acc-card,
.ref-list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

/* цветные акценты направлений — тонкая полоса слева и тонированный бейдж */
.dir-card { position: relative; overflow: hidden; }
.dir-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  opacity: .9;
}
.dir-card[data-kind="warmup"]::before { background: var(--ok); }
.dir-card[data-kind="passive"]::before { background: var(--warm); }
.dir-card[data-kind="masslook"]::before { background: var(--quest); }
.dir-card[data-kind="quests"]::before { background: #db2777; }
.dir-card[data-kind="casino"]::before { background: var(--casino); }

/* ---------- заголовки экранов ---------- */
#main-content > .caption,
#main-content .caption:first-child {
  letter-spacing: .08em;
}
#main-content h1 {
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: -.03em;
  font-weight: 680;
  margin: 2px 0 6px;
}

/* ---------- движение ---------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
#main-content > * { animation: rise .42s cubic-bezier(.2, .8, .2, 1) both; }
#main-content > *:nth-child(2) { animation-delay: .03s; }
#main-content > *:nth-child(3) { animation-delay: .06s; }
#main-content > *:nth-child(4) { animation-delay: .09s; }
#main-content > *:nth-child(5) { animation-delay: .12s; }
#main-content > *:nth-child(6) { animation-delay: .15s; }

button { transition: transform .16s cubic-bezier(.2, .8, .2, 1), background-color .16s, color .16s, box-shadow .16s; }
button:active { transform: scale(.985); }
.button:active { transform: scale(.97); }

/* ---------- десктоп: тот же Mini App, только по центру ---------- */
@media (min-width: 760px) {
  .shell { padding-bottom: calc(118px + env(safe-area-inset-bottom)); }
  .tabbar {
    max-width: 560px;
    bottom: 18px;
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 6px 8px;
    box-shadow: 0 12px 32px rgba(16, 24, 40, .12), 0 2px 6px rgba(16, 24, 40, .05);
  }
  .tab.active::before { display: none; }
  .tab.active svg { transform: translateY(-1px) scale(1.06); }
}

@media (prefers-reduced-motion: reduce) {
  #main-content > * { animation: none; }
  .status-dot { animation: none; }
  * { transition-duration: .01ms !important; }
}

/* перекрытие старой «плавающей пилюли»: таббар прибит к низу на всю ширину */
.tabbar {
  left: 0;
  right: 0;
  transform: none;
  width: auto;
  max-width: 100%;
  gap: 0;
}
@media (min-width: 760px) {
  .tabbar { left: 0; right: 0; transform: none; width: auto; }
}

/* ---------- KPI: хабы-карточки ---------- */
.summary-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
.summary-grid > .metric.featured { grid-column: span 2; }
.metric { border-radius: 18px; }
.metric.featured {
  background: linear-gradient(135deg, #6f7ae8 0%, #5e6ad2 55%, #5560c4 100%);
  border-color: transparent;
  box-shadow: 0 10px 24px rgba(94, 106, 210, .22);
  position: relative;
  overflow: hidden;
}
.metric.featured::after {
  content: "";
  position: absolute;
  right: -40px; top: -60px;
  width: 170px; height: 170px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
}
.metric.featured::before {
  content: "";
  position: absolute;
  right: 26px; bottom: -70px;
  width: 130px; height: 130px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
}
.metric.featured .metric-value { font-size: 40px; letter-spacing: -.04em; }

/* активная вкладка: без старой пилюли, только цвет и полоска */
.tab.active { background: none; }

/* десктоп: плавающая пилюля по центру, не на всю ширину */
@media (min-width: 760px) {
  .tabbar {
    max-width: 560px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    bottom: 18px;
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 6px 8px;
    box-shadow: 0 12px 32px rgba(16, 24, 40, .12), 0 2px 6px rgba(16, 24, 40, .05);
  }
}

@media (min-width: 760px) {
  .tabbar { width: 560px; max-width: calc(100% - 32px); }
}

/* KPI лога: длинные значения не обрезаются */
.log-kpi-value {
  font-size: 21px;
  line-height: 1.15;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  word-break: break-word;
}
.log-kpi { overflow: visible; }

/* кнопки: явный размер, иначе в шапках наследуется font-size: 0 */
.button { font-size: 14px; line-height: 1; }
.button.secondary { font-size: 13.5px; height: 40px; padding: 0 14px; border-radius: 12px; }
.button.full { font-size: 15px; height: 50px; }

/* мобильный: кнопки в шапке — только иконка, без вылезающего текста */
@media (max-width: 759px) {
  .page-head .button { font-size: 0; width: 44px; min-width: 44px; padding: 0; }
  .page-head .button svg { width: 20px; height: 20px; }
}

/* ---------- План направления: система решает, панель показывает ---------- */
.plan-hero{display:flex;align-items:center;gap:14px;padding:16px 18px;border-radius:18px;
  background:linear-gradient(135deg,#6f7ae8 0%,#5e6ad2 58%,#5560c4 100%);
  color:#fff;box-shadow:0 14px 30px rgba(94,106,210,.24);position:relative;overflow:hidden}
.plan-hero::after{content:"";position:absolute;right:-40px;top:-60px;width:160px;height:160px;
  border-radius:50%;background:rgba(255,255,255,.12)}
.plan-hero-num{font-size:34px;font-weight:700;line-height:1;letter-spacing:-.03em;min-width:44px;text-align:center}
.plan-hero-title{font-size:15px;font-weight:600;letter-spacing:-.01em}
.plan-hero-sub{font-size:12.5px;opacity:.78;margin-top:2px}
.plan-block{margin-top:18px}
.plan-block-head{display:flex;align-items:baseline;justify-content:space-between;gap:10px;
  font-size:12px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--muted,#6b7280);margin-bottom:8px}
.plan-block-note{font-size:11px;font-weight:500;letter-spacing:0;text-transform:none;color:#9aa0ae;text-align:right}
.plan-who{display:flex;flex-direction:column;gap:2px;border:1px solid var(--line,#e8e9ef);border-radius:14px;overflow:hidden}
.plan-person{display:flex;align-items:center;gap:11px;padding:10px 12px;background:var(--surface,#fff)}
.plan-person + .plan-person{border-top:1px solid var(--line,#e8e9ef)}
.plan-empty{padding:14px;border:1px dashed var(--line,#e8e9ef);border-radius:14px;font-size:13px;color:#6b7280;line-height:1.45}
.plan-why{display:flex;flex-direction:column;gap:6px;font-size:13px;color:#4b5563}
.plan-why-row{display:flex;justify-content:space-between;gap:12px;padding:8px 12px;border-radius:10px;background:#f4f5f9}
.plan-why-row b{font-weight:600;color:#111827}
.plan-steps{display:flex;flex-direction:column;gap:10px}
.plan-step{display:flex;gap:12px;padding:12px 14px;border:1px solid var(--line,#e8e9ef);border-radius:14px;background:var(--surface,#fff)}
.plan-step-num{font-size:11px;font-weight:700;color:#5e6ad2;background:#eef0ff;border-radius:8px;
  height:22px;min-width:26px;display:flex;align-items:center;justify-content:center;letter-spacing:.02em}
.plan-step-title{font-size:13.5px;font-weight:600;margin-bottom:2px}
.plan-step-text{font-size:13px;color:#5b6271;line-height:1.4}
.plan-cmd{display:inline-block;margin-top:6px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;
  font-size:11.5px;background:#f4f5f9;border:1px solid #e8e9ef;border-radius:7px;padding:3px 7px;color:#3f4552;word-break:break-all}
.plan-limits{display:flex;flex-direction:column;gap:8px;font-size:13px}
.plan-limits > div{display:flex;justify-content:space-between;gap:12px;align-items:baseline}
.plan-limits span{color:#6b7280}
.plan-limits b{font-weight:600;text-align:right}
.plan-warn{display:flex;gap:10px;margin-top:16px;padding:12px 14px;border-radius:14px;
  background:#fff8ec;border:1px solid #f6e3c2;font-size:12.5px;line-height:1.45;color:#7a5a1e}
.plan-warn svg{width:17px;height:17px;flex:none;margin-top:1px;color:#c08a2e}
/* кнопка плана: своя подложка, чтобы не наезжать на текст */
#sheet-content > .plan-cta{position:sticky;bottom:0;z-index:3;margin-top:16px;
  padding:20px 0 calc(4px + env(safe-area-inset-bottom));
  background:linear-gradient(180deg,rgba(255,255,255,0) 0%,#fff 30%,#fff 100%)}
#sheet-content > .plan-cta .button.full{width:100%}
.plan-block-head{white-space:nowrap}
.plan-block-note{white-space:normal;max-width:58%}
.plan-more{margin-top:6px;font-size:12px;color:#8b91a1;text-align:center}
/* десктоп: пилюля таббара не должна накрывать карточки */
@media (min-width: 760px) { .shell { padding-bottom: calc(112px + env(safe-area-inset-bottom)); } }

/* Журнал в виде терминала */
.log-feed { gap: 0; border: 1px solid var(--line); border-radius: 16px; background: #fff; overflow: hidden; }
.term-item + .term-item { border-top: 1px solid #f1f2f7; }
.term-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 7px; padding: 9px 12px; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; font-size: 11.5px; line-height: 1.55; cursor: pointer; transition: background .12s ease; }
.term-row:hover { background: #fafbfe; }
.term-item.open .term-row { background: #f5f6fb; }
.term-time { color: #9aa0ae; flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.term-dot { width: 6px; height: 6px; border-radius: 50%; align-self: center; flex: 0 0 auto; background: #c3c7d4; }
.term-row.ok .term-dot { background: #16a34a; box-shadow: 0 0 0 3px rgba(22, 163, 74, .12); }
.term-row.error .term-dot { background: #e11d48; box-shadow: 0 0 0 3px rgba(225, 29, 72, .12); }
.term-acc { font-weight: 700; color: #1a1f2e; max-width: 44%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.term-act { color: #4b5267; }
.term-target { color: #6a5bd6; }
.term-count { background: #fde7ec; color: #be123c; border-radius: 6px; padding: 0 5px; font-weight: 700; font-size: 10.5px; }
.term-code { color: #a2a7b6; font-size: 10.5px; }
.term-row.error .term-code { color: #d1436a; }
.term-meta { flex-basis: 100%; color: #a2a7b6; font-size: 10.5px; margin-top: -2px; }
.term-item .log-detail { padding: 2px 12px 12px; }
.term-item .log-detail dl { margin: 0; }
@media (max-width: 420px) { .term-acc { max-width: 38%; } .term-row { font-size: 11px; } }

/* Терминал: одна строка на событие */
.term-acc { flex: 0 1 auto; max-width: 30%; }
.term-row:has(.term-meta:empty) .term-meta { display: none; }
.term-act { flex: 1 1 40%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.term-row .term-count, .term-row .term-code { flex: 0 0 auto; }
.term-row .term-meta { order: 9; }

/* ===== Дашборд: сводка фермы ===== */
.dash { display: grid; gap: 14px; }
.dash-kpis { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.dash-kpi {
  position: relative; display: grid; gap: 6px; padding: 16px 16px 14px;
  background: #fff; border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 1px 2px rgba(16,24,40,.04); overflow: hidden;
  animation: rise .42s cubic-bezier(.22,.9,.3,1) both;
}
.dash-kpi:nth-child(2){ animation-delay:.04s } .dash-kpi:nth-child(3){ animation-delay:.08s } .dash-kpi:nth-child(4){ animation-delay:.12s }
.dash-kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.dash-kpi-top svg { width: 16px; height: 16px; opacity: .55; }
.dash-kpi-value { font-size: 34px; line-height: 1; font-weight: 750; letter-spacing: -.03em; color: var(--ink); font-variant-numeric: tabular-nums lining-nums; font-feature-settings: "tnum" 1,"lnum" 1; }
.dash-kpi-note { font-size: 12px; color: var(--muted); }
.dash-kpi-note b { color: var(--ink); font-weight: 650; }
.dash-kpi.featured { background: linear-gradient(155deg, #6f7ae8 0%, #5e6ad2 52%, #4f59bb 100%); border-color: transparent; box-shadow: 0 10px 24px -12px rgba(94,106,210,.75); }
.dash-kpi.featured .dash-kpi-top, .dash-kpi.featured .dash-kpi-note { color: rgba(255,255,255,.78); }
.dash-kpi.featured .dash-kpi-note b { color: #fff; }
.dash-kpi.featured .dash-kpi-value { color: #fff; }
.dash-kpi.featured::after { content: ""; position: absolute; right: -34px; top: -46px; width: 128px; height: 128px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, rgba(255,255,255,.34), rgba(255,255,255,0) 68%); }

.dash-deploy { padding: 0; overflow: hidden; }
.dash-deploy .panel-head { padding: 16px 16px 10px; margin: 0; }
.dash-deploy .panel-head h2 { font-size: 16px; }
.dash-deploy-list { display: grid; }
.dash-dir {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; align-items: center;
  padding: 13px 16px; border-top: 1px solid #f1f2f7; width: 100%; text-align: left;
  background: none; border-left: 0; border-right: 0; border-bottom: 0; cursor: pointer;
  transition: background .16s;
}
.dash-dir:hover { background: #fafbff; }
.dash-dir:first-child { border-top: 1px solid #f1f2f7; }
.dash-dir-head { display: flex; align-items: center; gap: 9px; min-width: 0; }
.dash-dir-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 16%, transparent); }
.dash-dir-name { font-size: 14px; font-weight: 650; color: var(--ink); }
.dash-dir-when { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dash-dir-num { font-size: 19px; font-weight: 750; letter-spacing: -.02em; color: var(--ink); font-variant-numeric: tabular-nums lining-nums; }
.dash-dir-meter { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; }
.dash-bar { position: relative; flex: 1 1 auto; height: 6px; border-radius: 99px; background: #eef0f6; overflow: hidden; }
.dash-bar span { position: absolute; inset: 0 auto 0 0; border-radius: 99px; }
.dash-dir-who { grid-column: 1 / -1; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-dir-idle .dash-dir-name { color: #9aa0ae; }
.dash-dir-idle .dash-dir-num { color: #9aa0ae; }

.dash-row { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.dash-chart .panel-head, .dash-health .panel-head { margin-bottom: 10px; }
.dash-chart .chart { height: 152px; }
.dash-legend { display: grid; gap: 7px; margin-top: 12px; }
.dash-legend-row { display: grid; grid-template-columns: 92px 1fr 40px; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.dash-legend-row b { color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }
.dash-legend-row .dash-bar { height: 5px; }

.dash-health { display: grid; gap: 14px; }
.dash-ring-wrap { display: flex; align-items: center; gap: 16px; }
.dash-ring {
  --p: 25; width: 96px; height: 96px; border-radius: 50%; flex: 0 0 auto;
  background: conic-gradient(#16a34a calc(var(--p) * 1%), #eef0f6 0);
  display: grid; place-items: center; transition: --p .6s ease;
}
.dash-ring::before { content: ""; position: absolute; }
.dash-ring-in { width: 74px; height: 74px; border-radius: 50%; background: #fff; display: grid; place-items: center; text-align: center; }
.dash-ring-in b { display: block; font-size: 22px; font-weight: 750; letter-spacing: -.03em; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1; }
.dash-ring-in small { display: block; font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.dash-health-note { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.dash-health-note b { color: var(--ink); }
.dash-status { display: grid; gap: 8px; }
.dash-status-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.dash-status-row .lbl { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.dash-status-row b { font-variant-numeric: tabular-nums; }
.dash-dot { width: 7px; height: 7px; border-radius: 50%; background: #cbd2e0; }
.dash-dot.ok { background: #16a34a; } .dash-dot.warm { background: #f59e0b; } .dash-dot.bad { background: #e11d48; } .dash-dot.mute { background: #cbd2e0; }

.dash-feed { padding: 0; overflow: hidden; }
.dash-feed .panel-head { padding: 15px 16px 10px; margin: 0; }
.dash-feed-row { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; padding: 10px 16px; border-top: 1px solid #f1f2f7; }
.dash-feed-ico { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: #eef1fb; color: #5e6ad2; }
.dash-feed-ico svg { width: 14px; height: 14px; }
.dash-feed-ico.ok { background: #e9f9ef; color: #16a34a; }
.dash-feed-ico.err { background: #fdecf1; color: #e11d48; }
.dash-feed-main { min-width: 0; }
.dash-feed-title { font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-feed-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-feed-time { font-size: 11px; color: #9aa0ae; font-variant-numeric: tabular-nums; white-space: nowrap; }

@media (max-width: 760px) {
  .dash-kpis { grid-template-columns: repeat(2, minmax(0,1fr)); grid-auto-rows: 1fr; gap: 10px; }
  .dash-deploy .panel-head { flex-wrap: wrap; gap: 2px 8px; }
  .dash-deploy .panel-head .caption { flex: 1 0 100%; }
  .dash-kpi-note { font-size: 11.5px; line-height: 1.3; }
  .dash-kpi-value { font-size: 28px; }
  .dash-row { grid-template-columns: minmax(0,1fr); }
  .dash-dir-num { font-size: 17px; }
  .dash-chart .chart { height: 132px; }
}
.dash-feed-more { width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 12px; border: 0; border-top: 1px solid #f1f2f7; background: #fbfcff; font: inherit; font-size: 12.5px; font-weight: 650; color: #5e6ad2; cursor: pointer; }
.dash-feed-more svg { width: 14px; height: 14px; }
.dash-feed-more:hover { background: #f5f7ff; }
.dash-chart-note { margin-top: 8px; font-size: 11.5px; color: #9aa0ae; }
.dash-deploy-list { border-top: 0; }

/* Десктоп: дашборд шире, плитки в одну строку */
@media (min-width: 980px) {
  :root { --app-w: 1000px; }
  .tabbar { width: 640px; }
  .dash-kpi { padding: 18px; }
  .dash-kpi-top { font-size: 13px; white-space: nowrap; }
  .dash-kpi-note { font-size: 12.5px; }
  .dash-kpi-value { font-size: 38px; }
  .dash-chart .chart { height: 168px; }
  .dash-dir { grid-template-columns: 1fr auto 180px; }
  .dash-dir-meter { grid-column: auto; }
  .dash-dir-who { grid-column: 1 / 3; }
  .dash-dir-num { text-align: right; }
}

/* Ручной состав направления */
.dir-manual { color: #5e6ad2; font-weight: 600; }

/* ---------- казино: реальные цифры и кампании ---------- */
.cs-view { display: flex; flex-direction: column; gap: 14px; }
.cs-top { display: flex; align-items: center; gap: 10px; }
.cs-top h1 { margin: 0; font-size: 24px; letter-spacing: -0.02em; flex: 1; }
.cs-top .button.ghost {
  width: 40px; height: 40px; padding: 0; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--ink-2); background: var(--surface);
  border: 1px solid var(--line);
}
.cs-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cs-stat {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
}
.cs-stat-label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.cs-stat-value { font-size: 21px; letter-spacing: -0.02em; line-height: 1.2; }
.cs-stat-note { font-size: 11.5px; color: var(--ink-2); }
.cs-note { margin: 0; font-size: 12px; line-height: 1.45; color: var(--ink-2); }
.cs-list { display: flex; flex-direction: column; gap: 10px; }
.cs-card {
  display: flex; flex-direction: column; gap: 12px; padding: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 1px 2px rgba(16, 17, 20, .03);
}
.cs-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.cs-title h3 { margin: 0; font-size: 16px; letter-spacing: -0.01em; }
.cs-title p { margin: 2px 0 0; font-size: 12px; color: var(--ink-2); }
.cs-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.cs-stats .cs-stat { padding: 9px 10px; border-radius: 12px; background: #fafbfd; }
.cs-stats .cs-stat-value { font-size: 15px; }
.cs-stats .cs-stat-note { font-size: 10.5px; }
.cs-links { display: flex; flex-direction: column; gap: 6px; }
.cs-link {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  font-size: 11.5px; color: var(--ink-2);
}
.cs-link > span { width: 54px; flex: none; text-transform: uppercase; letter-spacing: .06em; font-size: 10.5px; color: var(--ink-3); }
.cs-link code {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 3px 7px; border-radius: 7px; background: #f3f4f8; color: var(--ink-2);
  font-size: 11px;
}
.cs-copy {
  flex: none; border: 0; background: none; padding: 2px 4px; cursor: pointer;
  font-size: 11px; color: var(--accent); font-weight: 600;
}
.cs-source { margin: 0; font-size: 11px; color: var(--ink-3); }
.cs-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cs-actions .button { height: 40px; border-radius: 12px; }
.cs-runs { display: flex; flex-direction: column; gap: 10px; }
.cs-run { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; }
.cs-run-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.cs-bar { height: 6px; border-radius: 999px; background: #eef0f5; overflow: hidden; }
.cs-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #6f7ae8, #4f59bb); transition: width .3s ease; }
.cs-run-note { margin: 0; font-size: 11.5px; color: var(--ink-2); }
.cs-foot { padding: 4px 2px 0; font-size: 11.5px; color: var(--ink-3); }
.cs-foot p { margin: 0 0 2px; }

/* мини-блок казино на обзоре */
.cs-mini { display: flex; flex-direction: column; gap: 2px; }
.cs-mini-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 2px; border: 0; border-top: 1px solid var(--line);
  background: none; text-align: left; font: inherit; font-size: 12.5px;
  color: var(--ink-2); cursor: pointer;
}
.cs-mini-row:first-child { border-top: 0; }
.cs-mini-row b { flex: 1; color: var(--ink); font-size: 13px; font-weight: 600; }
.cs-mini-money { color: var(--casino); font-weight: 600; }

/* формы шторки */
.cs-form { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.cs-label { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.cs-input {
  width: 100%; box-sizing: border-box; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  font: inherit; font-size: 14px; color: var(--ink); outline: none;
}
.cs-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cs-area { resize: vertical; min-height: 64px; line-height: 1.4; }
.cs-select {
  width: 100%; box-sizing: border-box; padding: 11px 12px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--surface); font: inherit; font-size: 14px; color: var(--ink);
}
.cs-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.cs-control { display: flex; align-items: center; gap: 8px; }
.cs-control .cs-input { flex: 1; }
.cs-suffix { font-size: 12px; color: var(--ink-3); }
.cs-hint { margin: 0; font-size: 11.5px; color: var(--ink-3); }
.cs-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cs-sep { height: 1px; background: var(--line); margin: 14px 0; }
.cs-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.cs-check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); margin: 6px 0 10px; }
.cs-acc-head { display: flex; align-items: center; gap: 10px; margin: 4px 0 8px; font-size: 13px; }
.cs-acc-head b { flex: 1; }
.cs-counter { font-size: 11.5px; color: var(--accent); font-weight: 600; }
.cs-accounts { display: flex; flex-direction: column; max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 14px; }
.cs-acc { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-top: 1px solid var(--line); font-size: 12.5px; }
.cs-acc:first-child { border-top: 0; }
.cs-acc-name { font-weight: 600; color: var(--ink); }
.cs-acc-meta { flex: 1; color: var(--ink-3); font-size: 11px; }
.cs-acc-dir { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--casino); }
.cs-plan {
  margin: 10px 0 0; padding: 10px; border-radius: 12px; background: #f7f8fc;
  border: 1px solid var(--line); font-size: 11px; line-height: 1.45; white-space: pre-wrap;
  max-height: 220px; overflow: auto; color: var(--ink-2);
}
@media (max-width: 420px) {
  .cs-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cs-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.dir-card-link { cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
.dir-card-link:active { transform: scale(.995); }
@media (min-width: 980px) {
  .cs-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cs-card { padding: 18px; }
}
.dash-casino .panel-head .button.ghost { height: 32px; padding: 0 10px; font-size: 12px; border-radius: 9px; }
.cas-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.cas-kpi { display: flex; flex-direction: column; gap: 1px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 12px; background: #fafbfd; }
.cas-kpi-label { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); }
.cas-kpi-value { font-size: 15px; letter-spacing: -0.01em; }
.cas-kpi-note { font-size: 10.5px; color: var(--ink-2); }
@media (max-width: 420px) { .cas-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.model-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.model-row:first-of-type { border-top: 0; }
.model-row-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.model-row-text b { font-size: 13.5px; }
.model-row-value { font-size: 13px; color: var(--ink-2); }
.model-row-note { font-size: 11.5px; color: var(--ink-3); }
.model-row .button { height: 32px; padding: 0 12px; border-radius: 9px; font-size: 12.5px; flex: none; }
.model-sheet .segmented { margin-bottom: 12px; }
.model-sheet .model-list { display: flex; flex-direction: column; gap: 8px; }

/* ============================================================
   Apple-style слой (24.10.2026)
   Принципы: отклик на касание мгновенный, движение — пружинное
   и прерываемое, материалы — полупрозрачные, типографика —
   с оптическим трекингом. Источник: github.com/emilkowalski/skills
   (apple-design), перевод WWDC «Designing Fluid Interfaces».
   ============================================================ */
:root {
  --spring: cubic-bezier(.34, 1.3, .64, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --press: cubic-bezier(.2, .7, .3, 1);
  --glass: rgba(255, 255, 255, .72);
  --hair: rgba(16, 17, 20, .07);
  --lift-1: 0 1px 2px rgba(16,17,20,.05), 0 6px 18px -8px rgba(16,17,20,.16);
  --lift-2: 0 2px 4px rgba(16,17,20,.05), 0 18px 40px -18px rgba(16,17,20,.28);
}

/* ---------- кнопки: мгновенный отклик, материал, светлая кромка ---------- */
.button, .icon-button, .tabbar button, .cs-mini-row, .dir-card-link {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.button {
  position: relative;
  isolation: isolate;
  min-height: 44px;
  border-radius: 14px;
  font-weight: 620;
  letter-spacing: -.01em;
  transition: transform .14s var(--press), box-shadow .2s var(--ease-out),
              background-color .18s var(--ease-out), opacity .18s;
  will-change: transform;
}
.button:active { transform: scale(.965); transition-duration: .07s; }
.button::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.22);
  opacity: .9;
}
.button.secondary::after { box-shadow: inset 0 1px 0 rgba(255,255,255,.9); }
.button.primary {
  background: linear-gradient(180deg, #6b76dd 0%, #5561c8 100%);
  box-shadow: 0 1px 1px rgba(60,52,140,.28), 0 10px 22px -10px rgba(84,72,190,.55);
  color: #fff;
}
.button.primary:active { box-shadow: 0 1px 1px rgba(60,52,140,.3), 0 4px 10px -6px rgba(84,72,190,.5); }
.button.secondary {
  background: rgba(255,255,255,.86);
  backdrop-filter: saturate(160%) blur(8px);
  -webkit-backdrop-filter: saturate(160%) blur(8px);
  border: 1px solid var(--hair);
  box-shadow: var(--lift-1);
}
.button.ghost { background: transparent; box-shadow: none; }
.button.danger { background: #fff1f2; box-shadow: inset 0 0 0 1px rgba(204,86,104,.16); }
.button:focus-visible,
.icon-button:focus-visible,
.tabbar button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(94,106,210,.30), var(--lift-1);
}
.button:disabled, .button[aria-disabled="true"] { opacity: .45; transform: none; box-shadow: none; }
.icon-button { transition: transform .14s var(--press), background-color .18s; }
.icon-button:active { transform: scale(.92); }

/* ---------- таббар: стекло + пружинная пилюля ---------- */
.tabbar {
  background: rgba(255,255,255,.78);
  backdrop-filter: saturate(180%) blur(22px);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  border: 1px solid rgba(255,255,255,.55);
  box-shadow: 0 10px 34px -14px rgba(16,17,20,.28), 0 1px 0 rgba(255,255,255,.9) inset;
}
.tabbar button { transition: color .18s var(--ease-out), transform .16s var(--press); }
.tabbar button:active { transform: scale(.94); }
.tabbar button.is-active { transition: color .2s var(--ease-out); }

/* ---------- панели: материал и мягкая глубина ---------- */
.panel, .dash-kpi, .dir-card, .log-feed, .plan-who, .plan-step {
  transition: transform .22s var(--ease-out), box-shadow .25s var(--ease-out);
}
.panel { box-shadow: var(--lift-1); border-color: var(--hair); }
.dash-kpi { box-shadow: var(--lift-1); border-color: var(--hair); }
.dash-kpi.featured {
  box-shadow: 0 1px 2px rgba(16,17,20,.05), 0 22px 48px -22px rgba(84,72,190,.42);
}

/* ---------- появление: лёгкий подъём, шаг за шагом ---------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to   { opacity: 1; transform: none; }
}
.dash > .panel, .dash-kpis > .dash-kpi, .dash-feed-row, .dash-dir {
  animation: rise .5s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}
.dash-kpis > .dash-kpi:nth-child(1) { --i: 0; }
.dash-kpis > .dash-kpi:nth-child(2) { --i: 1; }
.dash-kpis > .dash-kpi:nth-child(3) { --i: 2; }
.dash-kpis > .dash-kpi:nth-child(4) { --i: 3; }
.dash > .panel:nth-of-type(1) { --i: 2; }
.dash > .panel:nth-of-type(2) { --i: 3; }
.dash > .panel:nth-of-type(3) { --i: 4; }
.dash > .panel:nth-of-type(4) { --i: 5; }

/* числа: живые, но не дёргаются */
.dash-kpi-value, .dash-dir-num, .dash-ring-in b, .cas-kpi-value {
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
}

/* ---------- график: градиент, отрисовка, живая точка ---------- */
.chart-wrap { position: relative; }
.chart { overflow: visible; }
.chart .grid-line { stroke: rgba(16,17,20,.07); stroke-dasharray: 3 7; }
.chart .area { opacity: 0; animation: fadeIn .9s var(--ease-out) .25s both; }
.chart .line {
  stroke-dasharray: var(--len, 1200);
  stroke-dashoffset: var(--len, 1200);
  animation: draw 1.15s var(--ease-out) .1s both;
  filter: drop-shadow(0 6px 12px rgba(124,109,232,.28));
}
.chart .dot { opacity: 0; animation: pop .45s var(--spring) both; }
.chart .dot:nth-of-type(1) { animation-delay: .35s; }
.chart .dot:nth-of-type(n) { animation-delay: .5s; }
.chart .dot:hover { r: 5; }
.chart .last-dot { animation: pulse 2.4s ease-in-out 1.4s infinite; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fadeIn { to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: none; } }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .45; }
}

/* ---------- кольцо прогресса: обводка растёт ---------- */
.dash-ring { animation: ringIn 1s var(--ease-out) both; }
@keyframes ringIn { from { transform: scale(.92); opacity: .4; } to { transform: none; opacity: 1; } }

/* ---------- живые полосы направлений ---------- */
.dash-bar span, .dash-dir-bar span {
  transition: width .9s var(--ease-out);
  animation: barIn 1s var(--ease-out) both;
  transform-origin: left center;
}
@keyframes barIn { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------- live-индикатор ---------- */
.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34,197,94,.5);
  animation: livePulse 2s var(--ease-out) infinite;
  display: inline-block;
}
@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(34,197,94,.5); }
  70% { box-shadow: 0 0 0 7px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}
.dash-live { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-3); font-weight: 550; }

/* ---------- шторка: приезжает от триггера ---------- */
#sheet, .sheet { transform-origin: bottom center; }

/* ---------- доступность ---------- */
@media (prefers-reduced-motion: reduce) {
  .dash > .panel, .dash-kpis > .dash-kpi, .dash-feed-row, .dash-dir,
  .chart .line, .chart .dot, .chart .area, .dash-ring, .dash-bar span,
  .dash-dir-bar span, .live-dot {
    animation: none !important;
  }
  .chart .line { stroke-dashoffset: 0; }
  .chart .dot, .chart .area { opacity: 1; }
  .button, .tabbar button, .icon-button { transition-duration: .01ms; }
}
@media (prefers-reduced-transparency: reduce) {
  .tabbar, .button.secondary { background: #fff; backdrop-filter: none; -webkit-backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  .panel, .dash-kpi, .dir-card { border-color: rgba(16,17,20,.28); }
  .button.secondary { border-color: rgba(16,17,20,.35); }
}

/* повторная отрисовка без перезапуска анимаций (автообновление каждые 30 с) */
.no-anim .dash > .panel,
.no-anim .dash-kpis > .dash-kpi,
.no-anim .dash-feed-row,
.no-anim .dash-dir,
.no-anim .chart .line,
.no-anim .chart .dot,
.no-anim .chart .area,
.no-anim .dash-ring,
.no-anim .dash-bar span,
.no-anim .dash-dir-bar span { animation: none !important; }
.no-anim .chart .line { stroke-dashoffset: 0; }
.no-anim .chart .dot, .no-anim .chart .area { opacity: 1; }

/* мини-графики в KPI */
.kpi-spark { margin-top: 10px; margin-bottom: 2px; height: 34px; }
.kpi-spark svg { display: block; width: 100%; height: 34px; }
.kpi-meter { margin-top: 12px; height: 5px; border-radius: 99px; background: rgba(16,17,20,.06); overflow: hidden; }
.kpi-meter span { display: block; height: 100%; border-radius: 99px; animation: barIn .9s var(--ease-out) both; }
.dash-kpi .dash-kpi-note { margin-top: 8px; }

/* выравнивание KPI: карточки одинаковой высоты, подпись прижата к низу */
.dash-kpis { align-items: stretch; }
.dash-kpi { display: flex; flex-direction: column; gap: 6px; }
.dash-kpi .dash-kpi-note { margin-top: auto; padding-top: 6px; }
.dash-kpi .kpi-spark, .dash-kpi .kpi-meter { margin-top: auto; }
.dash-kpi .kpi-spark + .dash-kpi-note, .dash-kpi .kpi-meter + .dash-kpi-note { margin-top: 6px; }

/* мини-график сразу под цифрой, воздух — перед подписью */
.dash-kpi .kpi-spark, .dash-kpi .kpi-meter { margin-top: 8px; }

/* крупные кнопки в шторках: та же геометрия, что у остальных */
.button.full { border-radius: 15px; min-height: 48px; }
.sheet .button.full { margin-top: 10px; }

/* ============ WebApp-каркас на широких экранах ============
   В Telegram Mini App окно всегда узкое: на десктопе показываем
   ту же «телефонную» колонну по центру, а не растянутый сайт. */
@media (min-width: 900px) {
  :root { --app-w: 440px; }
  html { background: #e8ebf3; }
  body {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background:
      radial-gradient(120% 90% at 50% 0%, #f4f5fb 0%, #e6e9f3 55%, #dde1ee 100%);
  }
  #app {
    position: relative;
    width: 460px;
    max-width: 100%;
    height: calc(100dvh - 40px);
    overflow-y: auto;
    overscroll-behavior: contain;
    border-radius: 38px;
    background: var(--canvas);
    box-shadow:
      0 34px 70px -26px rgba(18, 22, 45, .45),
      0 0 0 1px rgba(16, 17, 20, .07);
    scrollbar-width: none;
  }
  #app::-webkit-scrollbar { display: none; }
  .shell { padding-bottom: 8px; }
  .tabbar {
    position: sticky;
    bottom: 0;
    left: auto;
    right: auto;
    transform: none;
    width: auto;
    max-width: none;
    margin: 8px 10px 10px;
    border-radius: 24px;
    border: 1px solid rgba(16, 17, 20, .06);
    box-shadow: 0 -2px 24px -12px rgba(16, 17, 20, .28);
  }
  #sheet {
    width: min(440px, calc(100vw - 32px));
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    border-radius: 26px;
  }
  .topbar { padding-top: 6px; }

  /* узкая колонна — те же сетки, что на телефоне */
  .dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-kpi.featured { grid-column: span 2; }
  .dash-kpi { padding: 14px; }
  .dash-kpi-top { font-size: 12px; white-space: normal; }
  .dash-kpi-value { font-size: 30px; }
  .dash-kpi-note { font-size: 12px; }
  .dash-dir { grid-template-columns: 1fr auto; }
  .dash-dir-meter { grid-column: 1 / -1; }
  .dash-dir-who { grid-column: 1 / -1; }
  .dash-chart .chart { height: 140px; }
  .cs-kpis, .cas-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .summary-grid > .metric.featured { grid-column: span 2; }
  .cs-card { padding: 14px; }
  .panel-head { flex-wrap: wrap; }
}

/* ============ Задания: аккаунты × действие ============ */
.head-actions { display: flex; gap: 8px; flex-shrink: 0; }
.task-list { display: flex; flex-direction: column; gap: 8px; }
.task-row {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-2, #f7f8fa);
  box-shadow: inset 0 0 0 1px var(--hair);
}
.task-row-main { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.task-row-title { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.task-row-meta { font-size: 12px; color: var(--muted); white-space: nowrap; }
.task-row-err { font-size: 12px; color: var(--danger, #c0392b); }
.task-bar { height: 4px; border-radius: 99px; background: rgba(16, 17, 20, .08); overflow: hidden; }
.task-bar i { display: block; height: 100%; border-radius: 99px; background: var(--purple, #5e6ad2); transition: width .4s var(--ease-out); }

.task-sheet { display: flex; flex-direction: column; gap: 10px; }
.task-sub { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.act-list { display: flex; flex-direction: column; gap: 8px; }
.act-card {
  display: flex; flex-direction: column; gap: 3px; align-items: flex-start;
  width: 100%; text-align: left; padding: 13px 14px; border: 0; cursor: pointer;
  border-radius: 14px; background: var(--surface, #fff);
  box-shadow: inset 0 0 0 1px var(--hair);
  transition: box-shadow .18s var(--ease-out), transform .18s var(--ease-out), background .18s;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.act-card:active { transform: scale(.99); }
.act-card.on { background: rgba(94, 106, 210, .07); box-shadow: inset 0 0 0 1.5px var(--purple, #5e6ad2); }
.act-card.off { opacity: .5; cursor: default; }
.act-title { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.act-short { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.act-off { font-size: 11.5px; color: var(--danger, #c0392b); }

.task-params { display: flex; flex-direction: column; gap: 10px; }
.task-field { display: flex; flex-direction: column; gap: 6px; }
.task-field-label { font-size: 12.5px; color: var(--muted); }
.task-field-check { flex-direction: row-reverse; align-items: center; justify-content: flex-end; gap: 8px; }
.task-count { font-size: 12.5px; color: var(--muted); }
.task-quick { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.task-quick::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; border: 0; cursor: pointer; padding: 7px 12px; border-radius: 99px;
  font-size: 12.5px; font-weight: 500; color: var(--text, #16171a);
  background: rgba(16, 17, 20, .05);
  transition: background .16s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.chip.on { background: var(--purple, #5e6ad2); color: #fff; }
.sheet-actions {
  position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 0 calc(2px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--canvas, #f4f5fb) 70%, rgba(244, 245, 251, 0));
}
.sheet-actions .button { flex: 0 0 auto; min-width: 150px; }

/* шапка: группы кнопок на узком экране остаются с подписями */
@media (max-width: 759px) {
  .page-head { flex-wrap: wrap; row-gap: 10px; }
  .page-head > div:first-child { flex: 1 1 100%; min-width: 0; }
  .page-head .head-actions { width: auto; margin-left: auto; }
  .page-head .head-actions .button {
    flex: 0 0 auto; width: auto; min-width: 0; padding: 0 13px;
    font-size: 13.5px; height: 42px;
  }
  .page-head .head-actions .button svg { width: 18px; height: 18px; }
}

/* статусы заданий: цвет прогресса по результату */
.task-row.is-done .task-bar i { background: #34c759; }
.task-row.is-failed .task-bar i { background: #ff3b30; }
.task-row.is-partial .task-bar i { background: #ff9f0a; }
.task-row.is-queued .task-bar i { background: #c7c7cc; }
.task-row.is-failed .task-row-title { color: #b3261e; }

/* ── Терминал журнала (светлый, в палитре панели) ─────────────────
   Моно-строка как в настоящем terminal tail: время · уровень · актор ·
   событие · бейдж направления. Тап раскрывает детали.
   Референсы: react-logviewer, HyperDX/SigNoz log explorer, Vercel logs. */
.term{
  border-radius:20px;
  overflow:hidden;
  background:#fff;
  border:1px solid rgba(16,17,20,.08);
  box-shadow:0 10px 30px rgba(16,17,20,.07), 0 1px 0 rgba(255,255,255,.9) inset;
  color:#1c1d22;
  font-family:ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  -webkit-tap-highlight-color:transparent;
}
.term-bar{
  display:flex;align-items:center;gap:8px;
  padding:10px 12px;
  border-bottom:1px solid rgba(16,17,20,.07);
  background:linear-gradient(180deg,#fcfcfe,#f6f7fa);
}
.term-lights{display:flex;gap:5px;flex:0 0 auto}
.term-lights i{width:9px;height:9px;border-radius:50%;background:#ff5f57;box-shadow:inset 0 0 0 .5px rgba(0,0,0,.12)}
.term-lights i:nth-child(2){background:#febc2e}
.term-lights i:nth-child(3){background:#28c840}
.term-title{font-size:11px;color:#8a91a0;letter-spacing:.02em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1 1 auto;min-width:0}
.term-title b{color:#3a3f4a;font-weight:600}
.term-live{
  display:inline-flex;align-items:center;gap:5px;flex:0 0 auto;
  font-size:9.5px;letter-spacing:.14em;text-transform:uppercase;color:#1a9c4b;
}
.term-live i{width:6px;height:6px;border-radius:50%;background:#34c759;animation:termPulse 2.2s ease-out infinite}
@keyframes termPulse{
  0%{box-shadow:0 0 0 0 rgba(52,199,89,.45)}
  70%{box-shadow:0 0 0 6px rgba(52,199,89,0)}
  100%{box-shadow:0 0 0 0 rgba(52,199,89,0)}
}
.term-periods{display:flex;gap:1px;margin-left:6px;flex:0 0 auto}
.term-period{
  font:inherit;font-size:10px;line-height:1;color:#8a91a0;background:transparent;
  border:0;padding:5px 6px;border-radius:6px;transition:background .18s,color .18s;
}
.term-period.on{color:#3f45a8;background:rgba(94,106,210,.13);font-weight:600}
.term-stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:1px;background:rgba(16,17,20,.06)}
.term-stat{background:#fff;padding:9px 10px 10px;display:flex;flex-direction:column;gap:2px}
.term-stat b{font-size:15px;letter-spacing:-.02em;color:#1c1d22;font-weight:600;font-variant-numeric:tabular-nums}
.term-stat span{font-size:9px;letter-spacing:.08em;text-transform:uppercase;color:#8a91a0}
.term-stat.ok b{color:#1a9c4b}
.term-stat.err b{color:#d92d20}
.term-hist-wrap{padding:10px 12px 18px;border-top:1px solid rgba(16,17,20,.05);background:#fff}
.term-hist{display:flex;align-items:flex-end;gap:2px;height:42px;position:relative}
.term-hist-col{flex:1 1 0;display:flex;flex-direction:column;justify-content:flex-end;align-items:stretch;position:relative;height:100%}
.term-hist-col i{display:block;background:rgba(94,106,210,.55);border-radius:2px 2px 0 0;transition:height .5s var(--ease-out)}
.term-hist-col u{display:block;background:#ff3b30;border-radius:0 0 1px 1px}
.term-hist-col em{
  position:absolute;bottom:-14px;left:50%;transform:translateX(-50%);
  font-style:normal;font-size:8px;color:#a2a8b4;letter-spacing:.02em;
}
.term-tools{display:flex;flex-wrap:wrap;gap:6px;align-items:center;padding:14px 12px 8px;border-top:1px solid rgba(16,17,20,.05)}
.term-chips{display:flex;flex-wrap:wrap;gap:4px}
.term-chip{
  font:inherit;font-size:10px;letter-spacing:.02em;color:#5f6673;
  background:#f2f3f7;border:1px solid rgba(16,17,20,.05);
  border-radius:999px;padding:5px 9px;transition:all .18s var(--ease-out);
}
.term-chip.on{color:#fff;background:#5e6ad2;border-color:#5e6ad2;font-weight:600}
.term-chip.err.on{background:#d92d20;border-color:#d92d20;color:#fff}
.term-search-box{
  display:flex;align-items:center;gap:6px;flex:1 1 130px;min-width:110px;
  background:#f4f5f8;border:1px solid rgba(16,17,20,.06);
  border-radius:999px;padding:0 10px;color:#9aa0ac;
}
.term-search-box svg{width:12px;height:12px;flex:0 0 auto}
.term-search{flex:1 1 auto;min-width:0;border:0;background:transparent;color:#1c1d22;font:inherit;font-size:11px;padding:7px 0;outline:none}
.term-search::placeholder{color:#a2a8b4}
.term-body{
  max-height:min(56vh,520px);
  overflow-y:auto;overscroll-behavior:contain;
  padding:4px 0 6px;
  scrollbar-width:thin;scrollbar-color:rgba(16,17,20,.14) transparent;
  transition:opacity .2s;
}
.term-body.is-loading{opacity:.45}
.term-body::-webkit-scrollbar{width:3px}
.term-body::-webkit-scrollbar-thumb{background:rgba(16,17,20,.14);border-radius:3px}
.term-day{
  display:flex;align-items:center;gap:8px;
  padding:10px 12px 6px;margin-top:2px;
  font-size:9px;letter-spacing:.14em;text-transform:uppercase;color:#9aa0ac;
}
.term-day:before{content:"";width:6px;height:6px;border-radius:50%;border:1px solid #c7cbd4}
.term-day:after{content:"";flex:1;height:1px;background:linear-gradient(90deg,rgba(16,17,20,.08),transparent)}
.term-item{border-left:2px solid transparent}
.term-line{
  display:flex;flex-wrap:nowrap;align-items:baseline;gap:5px;
  padding:6px 12px 6px 10px;
  font-size:11.5px;line-height:1.45;
  cursor:pointer;
  transition:background .15s;
}
.term-line:hover{background:#f7f8fb}
.term-line.open{background:rgba(94,106,210,.07)}
.term-item:has(.term-line.is-error){border-left-color:rgba(217,45,32,.7)}
.term-t{color:#a2a8b4;font-size:10px;flex:0 0 auto;letter-spacing:.01em;font-variant-numeric:tabular-nums}
.term-dot{width:5px;height:5px;border-radius:50%;background:#34c759;flex:0 0 auto;align-self:center}
.term-line.is-error .term-dot{background:#ff3b30;box-shadow:0 0 0 2px rgba(255,59,48,.14)}
.term-line.is-recorded .term-dot{background:#c7c7cc}
.term-who{color:#1c1d22;font-weight:600;flex:0 0 auto;max-width:42%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.term-msg{color:#4a4f59;flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.term-line.is-error .term-msg{color:#b3261e}
.term-target{color:#8a91a0}
.term-count{color:#a35c00;background:rgba(255,159,10,.13);border-radius:4px;padding:1px 4px;font-size:9.5px;flex:0 0 auto}
.term-merged{color:#0a84c1;font-size:9.5px;flex:0 0 auto;opacity:.9}
.term-tag{
  margin-left:auto;
  font-size:8.5px;letter-spacing:.08em;text-transform:uppercase;
  padding:2.5px 5px;border-radius:5px;flex:0 0 auto;align-self:center;
  background:rgba(94,106,210,.10);color:#4b53b8;
}
.term-tag.tag-passive{background:rgba(26,156,75,.10);color:#177a3c}
.term-tag.tag-masslook{background:rgba(255,159,10,.14);color:#a35c00}
.term-tag.tag-quests{background:rgba(191,90,242,.12);color:#8b34b8}
.term-tag.tag-system{background:rgba(16,17,20,.06);color:#6b7280}
.term-line.is-ghost{opacity:.58}
.term-err{
  display:block;margin:0 12px 4px 62px;
  font-size:10px;line-height:1.45;color:#b3261e;
  word-break:break-word;opacity:.95;
}
.term-foot{
  display:flex;align-items:center;gap:10px;
  padding:8px 12px;
  border-top:1px solid rgba(16,17,20,.07);
  background:#fbfbfd;
  font-size:9.5px;color:#8a91a0;letter-spacing:.02em;
}
.term-tail{margin-left:auto;color:#a2a8b4}
.term-foot .term-tail:after{content:"▍";margin-left:4px;color:#34c759;animation:termCaret 1.1s steps(1) infinite}
@keyframes termCaret{50%{opacity:0}}
.term-empty{display:flex;flex-direction:column;gap:4px;align-items:center;padding:34px 16px;color:#8a91a0;font-size:11px}
.term-empty b{color:#5f6673;font-weight:600;letter-spacing:.06em}
.term-detail{padding:0 12px 8px 17px}
.term-detail .log-detail{background:#f8f9fb;border:1px solid rgba(16,17,20,.06);border-radius:10px;padding:8px 10px;margin:2px 0 6px}
.term-detail .log-pair{display:grid;grid-template-columns:104px minmax(0,1fr);gap:8px;padding:2.5px 0;font-size:10.5px;line-height:1.4}
.term-detail dt{color:#8a91a0;margin:0}
.term-detail dd{color:#33363d;margin:0;word-break:break-word}
.term-detail .log-raw{margin-top:6px}
.term-detail .log-raw summary{font-size:10px;color:#6b7280;cursor:pointer}
.term-detail .log-raw pre{
  max-height:220px;overflow:auto;margin:6px 0 0;padding:8px;
  background:#fff;border:1px solid rgba(16,17,20,.07);border-radius:8px;
  font-size:9.5px;line-height:1.5;color:#4a4f59;
}
.term-more{display:flex;justify-content:center;padding:12px 0 2px}
.term-end{font-size:10px;color:#a2a8b4;letter-spacing:.06em}
.term-sources{margin-top:12px}
.term-details{background:rgba(255,255,255,.6);border:1px solid var(--hair);border-radius:16px;padding:0 14px}
.term-details summary{padding:13px 0;font-size:12.5px;font-weight:600;color:var(--ink);cursor:pointer;list-style:none}
.term-details summary::-webkit-details-marker{display:none}
.term-details summary:after{content:"›";float:right;color:#a4abb8;transform:rotate(90deg);transition:transform .2s}
.term-details[open] summary:after{transform:rotate(-90deg)}
.term-src-list{padding:0 0 12px;display:flex;flex-direction:column;gap:9px}
.term-src{display:flex;align-items:baseline;gap:7px;font-size:11px;color:#6b7387}
.term-src-dot{width:6px;height:6px;border-radius:50%;background:#34c759;flex:0 0 auto;align-self:center}
.term-src.off .term-src-dot{background:#c7c7cc}
.term-src-dot.sched{background:#5e6ad2}
.term-src b{color:#1c1d22;font-weight:600;font-size:11.5px}
.head-actions{flex:0 0 auto;margin-left:auto}
.head-actions .button{width:auto;font-size:13px}
@media (max-width:420px){
  .term-stats{grid-template-columns:repeat(2,minmax(0,1fr))}
  .term-stat{padding:8px 10px}
  .term-stat b{font-size:14px}
  .term-line{font-size:11px}
  .term-who{max-width:52%}
  .term-periods{margin-left:auto}
}
@media (max-width:400px){
  .term-live{display:none}
  .term-periods{margin-left:auto}
  .term-chips{gap:3px}
  .term-chip{padding:5px 8px;font-size:9.5px}
}

.term-refresh{
  flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;
  width:26px;height:26px;padding:0;border:0;border-radius:8px;
  background:rgba(16,17,20,.05);color:#5f6673;transition:background .18s,transform .18s;
}
.term-refresh svg{width:13px;height:13px}
.term-refresh:active{transform:scale(.92);background:rgba(16,17,20,.1)}

/* ── Витрина казино: карточка казино + плагины-механики ───────────── */
.cs-hero {
  padding: 18px 16px 16px;
  border-radius: 24px;
  background: #fff;
  border: 1px solid var(--hair);
  box-shadow: var(--lift-1);
}
.cs-hero-top { display: flex; align-items: center; gap: 12px; }
.cs-arb { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  filter: drop-shadow(0 10px 18px rgba(43,147,72,.22)); }
.cs-hero-title { flex: 1 1 auto; min-width: 0; }
.cs-hero-title h3 { margin: 0; font-size: 20px; letter-spacing: -.02em; color: var(--ink); }
.cs-hero-title p { margin: 3px 0 0; font-size: 11.5px; color: var(--ink-3); }
.cs-games { margin: 14px 0 2px; display: flex; flex-direction: column; gap: 8px; }
.cs-games-head { display: flex; align-items: baseline; justify-content: space-between; }
.cs-games-head b { font-size: 12px; color: var(--ink); letter-spacing: .01em; }
.cs-games-head span { font-size: 10px; color: var(--ink-3); letter-spacing: .04em; text-transform: uppercase; }
.cs-game {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 11px 12px; border-radius: 16px; background: #fbfbfd;
  border: 1px solid var(--hair); cursor: pointer;
  transition: transform .16s var(--ease-out), background .16s var(--ease-out);
}
.cs-game:hover { background: #f6f7fb; }
.cs-game:active { transform: scale(.985); }
.cs-game-emoji { font-size: 19px; width: 24px; text-align: center; }
.cs-game-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cs-game-body b { font-size: 13px; color: var(--ink); font-weight: 600; }
.cs-game-note { font-size: 10.5px; color: var(--ink-3); }
.cs-game-go { color: #c7c7cc; font-size: 18px; line-height: 1; }
.cs-games-head .cs-add {
  border: 0; background: var(--accent-soft); color: var(--accent);
  font-size: 11px; font-weight: 600; padding: 5px 10px; border-radius: 999px;
  cursor: pointer; transition: transform .16s var(--ease-out);
}
.cs-games-head .cs-add:active { transform: scale(.96); }
.cs-arb {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 18px; font-size: 30px; line-height: 1;
  background: linear-gradient(160deg, #f2fbe9, #e3f4d7);
  border: 1px solid rgba(43,147,72,.18);
  box-shadow: 0 6px 16px -8px rgba(43,147,72,.45);
}
.cs-arb.is-neutral {
  background: linear-gradient(160deg, #f6f7fa, #eef0f5);
  border-color: var(--hair);
  box-shadow: 0 6px 16px -10px rgba(16,17,20,.35);
}

/* ============================================================
   Чёткость каркаса: убираем стекло/блюр, ставим плоский бар
   (по правилам Emil Kowalski: непрозрачные поверхности,
   один уровень глубины, отклик на нажатие)
   ============================================================ */
:root {
  --ink-2: #5d6470;
  --ink-3: #878e99;
  --line: #e8e9ee;
  --hair: rgba(16, 17, 20, .08);
}

.topbar {
  background: var(--canvas);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  padding-top: calc(12px + env(safe-area-inset-top));
  border-bottom: 1px solid transparent;
  transition: border-color .18s var(--ease-out);
}
.topbar.is-stuck {
  border-bottom-color: var(--line);
  box-shadow: 0 10px 18px -18px rgba(16, 17, 20, .45);
}

.tabbar {
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 100%;
  margin: 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: 0 -8px 20px -18px rgba(16, 17, 20, .5);
  padding: 7px 6px calc(5px + env(safe-area-inset-bottom));
  gap: 0;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.tab {
  min-width: 0;
  min-height: 0;
  padding: 0;
  gap: 2px;
  border-radius: 12px;
  color: var(--ink-3);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0;
  background: none;
}
.tab-ico {
  display: grid;
  place-items: center;
  width: 46px;
  height: 27px;
  border-radius: 9px;
  transition: background-color .16s var(--ease-out), transform .16s var(--ease-out);
}
.tab-ico svg { width: 20px; height: 20px; }
.tab-label { font-size: 10.5px; line-height: 1.15; }
.tab.active { color: var(--accent); }
.tab.active .tab-ico { background: var(--accent-soft); }
.tab.active svg { transform: none; }
.tab:active .tab-ico { transform: scale(.9); background: #f1f2f6; }

@media (min-width: 720px) {
  .tabbar {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(var(--app-w), 100%);
    max-width: var(--app-w);
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    border: 1px solid var(--line);
    border-bottom: 0;
  }
}

/* Кнопки и стекло: без блюра, только плоскость и граница */
.button.secondary {
  background: #fff;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(16, 17, 20, .04);
}
.tab-ico { background: transparent; }
.tab { color: #6f7681; font-weight: 560; }
.tab.active { color: #4f5bc4; font-weight: 650; }
.tab.active .tab-ico { background: #e7eaff; box-shadow: inset 0 0 0 1px rgba(94, 106, 210, .10); }
.tab-ico svg { width: 21px; height: 21px; stroke-width: 1.75; }
.tab.active .tab-ico { background: #e3e7ff; }
.tab.active { color: #4553c4; }
.tab-label { font-size: 11px; letter-spacing: .005em; }
.dir-card { padding: 14px 14px 12px; }
.dir-top { align-items: center; gap: 10px; }
.dir-name h3 { font-size: 16px; letter-spacing: -.015em; }
.dir-desc { margin: 7px 0 0; font-size: 12.5px; line-height: 1.42; color: var(--ink-3); }
.dir-meta { margin-top: 10px; }

/* Шторка задания: одно выбранное действие + смена */
.act-card .act-change{margin-left:auto;align-self:flex-start;border:0;background:transparent;color:var(--purple);
  font:inherit;font-size:12.5px;font-weight:600;padding:2px 0;cursor:pointer}
.act-card .act-change:active{opacity:.6}

/* ── Терминал: тёмная колодка внутри светлой панели (как в скрине Дениса) ── */
.term:not(.is-light){
  background:#0b0d12;
  border:1px solid rgba(255,255,255,.08);
  box-shadow:0 18px 40px -22px rgba(10,12,18,.55), 0 1px 0 rgba(255,255,255,.05) inset;
  color:#e6e9f0;
}
.term:not(.is-light) .term-bar{background:linear-gradient(180deg,#141821,#101319);border-bottom:1px solid rgba(255,255,255,.07)}
.term:not(.is-light) .term-title{color:#7b8497}
.term:not(.is-light) .term-title b{color:#eef1f7}
.term:not(.is-light) .term-live{color:#34d16b}
.term:not(.is-light) .term-live i{background:#34d16b}
.term:not(.is-light) .term-period{color:#7b8497}
.term:not(.is-light) .term-period.on{color:#c8d0ff;background:rgba(123,140,255,.18);font-weight:600}
.term:not(.is-light) .term-refresh{background:rgba(255,255,255,.06);color:#9aa4b8}
.term:not(.is-light) .term-refresh:active{background:rgba(255,255,255,.12)}
.term:not(.is-light) .term-stats{background:rgba(255,255,255,.06)}
.term:not(.is-light) .term-stat{background:#0f121a}
.term:not(.is-light) .term-stat b{color:#eef1f7}
.term:not(.is-light) .term-stat span{color:#7b8497}
.term:not(.is-light) .term-stat.ok b{color:#34d16b}
.term:not(.is-light) .term-stat.err b{color:#ff5c52}
.term:not(.is-light) .term-hist-wrap{background:#0f121a;border-top:1px solid rgba(255,255,255,.05)}
.term:not(.is-light) .term-hist-col i{background:rgba(123,140,255,.75)}
.term:not(.is-light) .term-hist-col u{background:#ff453a}
.term:not(.is-light) .term-hist-col em{color:#5f6779}
.term:not(.is-light) .term-tools{border-top:1px solid rgba(255,255,255,.05)}
.term:not(.is-light) .term-chip{color:#9aa4b8;background:#171b25;border:1px solid rgba(255,255,255,.07)}
.term:not(.is-light) .term-chip.on{color:#0b0d12;background:#c8d0ff;border-color:#c8d0ff;font-weight:600}
.term:not(.is-light) .term-chip.err.on{background:#ff453a;border-color:#ff453a;color:#fff}
.term:not(.is-light) .term-search-box{background:#161a24;border:1px solid rgba(255,255,255,.08);color:#6a7180}
.term:not(.is-light) .term-search{color:#e6e9f0}
.term:not(.is-light) .term-search::placeholder{color:#5f6779}
.term:not(.is-light) .term-body{scrollbar-color:rgba(255,255,255,.18) transparent}
.term:not(.is-light) .term-body::-webkit-scrollbar-thumb{background:rgba(255,255,255,.18)}
.term:not(.is-light) .term-day{color:#6a7180}
.term:not(.is-light) .term-day:before{border-color:#3a4152}
.term:not(.is-light) .term-day:after{background:linear-gradient(90deg,rgba(255,255,255,.10),transparent)}
.term:not(.is-light) .term-line:hover{background:rgba(255,255,255,.035)}
.term:not(.is-light) .term-line.open{background:rgba(123,140,255,.12)}
.term:not(.is-light) .term-t{color:#6a7180}
.term:not(.is-light) .term-dot{background:#34d16b}
.term:not(.is-light) .term-line.is-error .term-dot{background:#ff453a;box-shadow:0 0 0 2px rgba(255,69,58,.22)}
.term:not(.is-light) .term-line.is-recorded .term-dot{background:#4b5263}
.term:not(.is-light) .term-who{color:#eef1f7}
.term:not(.is-light) .term-msg{color:#aeb6c6}
.term:not(.is-light) .term-line.is-error .term-msg{color:#ff8a80}
.term:not(.is-light) .term-target{color:#8b93a3}
.term:not(.is-light) .term-count{color:#ffc266;background:rgba(255,179,64,.16)}
.term:not(.is-light) .term-merged{color:#7fc4ff}
.term:not(.is-light) .term-tag{background:rgba(123,140,255,.16);color:#c3ccff}
.term:not(.is-light) .term-tag.tag-passive{background:rgba(52,209,107,.16);color:#7ee2a4}
.term:not(.is-light) .term-tag.tag-masslook{background:rgba(255,179,64,.16);color:#ffc266}
.term:not(.is-light) .term-tag.tag-quests{background:rgba(214,150,255,.16);color:#e0b6ff}
.term:not(.is-light) .term-tag.tag-casino{background:rgba(255,120,90,.16);color:#ffab9a}
.term:not(.is-light) .term-tag.tag-system{background:rgba(255,255,255,.08);color:#9aa4b8}
.term:not(.is-light) .term-err{color:#ff8a80}
.term:not(.is-light) .term-foot{background:#101319;border-top:1px solid rgba(255,255,255,.07);color:#6a7180}
.term:not(.is-light) .term-tail{color:#5f6779}
.term:not(.is-light) .term-foot .term-tail:after{color:#34d16b}
.term:not(.is-light) .term-empty{color:#7b8497}
.term:not(.is-light) .term-empty b{color:#aeb6c6}
.term:not(.is-light) .term-detail .log-detail{background:#11151d;border:1px solid rgba(255,255,255,.07)}
.term:not(.is-light) .term-detail dt{color:#7b8497}
.term:not(.is-light) .term-detail dd{color:#d7dce7}
.term:not(.is-light) .term-detail .log-raw summary{color:#9aa4b8}
.term:not(.is-light) .term-detail .log-raw pre{background:#0c0f15;border:1px solid rgba(255,255,255,.07);color:#aeb6c6}
.term:not(.is-light) .term-end{color:#5f6779}
.term:not(.is-light) .term-details{background:#101319;border:1px solid rgba(255,255,255,.07)}
.term:not(.is-light) .term-details summary{color:#e6e9f0}
.term:not(.is-light) .term-src{color:#8b93a3}
.term:not(.is-light) .term-src b{color:#e6e9f0}

@media (max-width:520px){
  .term-bar{gap:6px;padding:9px 10px}
  .term-title{font-size:10px}
  .term-live{font-size:8.5px;letter-spacing:.1em}
  .term-live span{display:none}
  .term-period{padding:4px 5px;font-size:9.5px}
  .term-periods{margin-left:2px}
  .term-refresh{width:24px;height:24px}
  .term-chip{font-size:9.5px;padding:4.5px 8px}
  .term-line{font-size:11px}
}

/* ── Журнал: плотная консоль (перекрывает прежние размеры) ── */
.term-kpis{
  display:flex;align-items:center;gap:10px;
  padding:9px 12px;
  background:#0f121a;
  border-bottom:1px solid rgba(255,255,255,.05);
  font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,monospace;
  overflow:hidden;
}
.term-kpi{display:inline-flex;align-items:baseline;gap:4px;flex:0 0 auto}
.term-kpi b{font-size:13px;font-weight:650;color:#eef1f7;letter-spacing:-.01em;font-variant-numeric:tabular-nums}
.term-kpi i{font-style:normal;font-size:9px;letter-spacing:.1em;text-transform:uppercase;color:#6a7180}
.term-kpi.ok b{color:#34d16b}
.term-kpi.err b{color:#ff5c52}
.term-sep{width:1px;height:14px;background:rgba(255,255,255,.09);flex:0 0 auto}
.term-hist-wrap{padding:6px 10px 13px;background:#0f121a}
.term-hist{height:24px}
.term-hist-col em{bottom:-10px;font-size:7.5px}
.term-tools{padding:8px 10px 6px;gap:5px}
.term-chips{flex-wrap:nowrap;overflow-x:auto;gap:4px;scrollbar-width:none;padding-bottom:1px}
.term-chips::-webkit-scrollbar{display:none}
.term-chip{font-size:9.5px;padding:4px 8px;white-space:nowrap}
.term-search-box{padding:0 9px;border-radius:9px;height:30px}
.term-search{font-size:10.5px;padding:5px 0}
.term-body{padding:2px 0 4px}
.term-item{content-visibility:auto;contain-intrinsic-size:auto 26px}
.term-day{padding:7px 10px 3px;font-size:8.5px;letter-spacing:.12em}
.term-line{padding:3.5px 10px 3.5px 8px;font-size:10.8px;line-height:1.35;gap:4px}
.term-t{font-size:9px}
.term-who{max-width:38%}
.term-count{font-size:8.5px;padding:0 3px}
.term-merged{font-size:8.5px}
.term-tag{font-size:7.8px;padding:1.5px 4px;letter-spacing:.06em}
.term-err{margin:0 10px 3px 54px;font-size:9.2px;line-height:1.35}
.term-foot{font-size:9px;padding:6px 10px}
.term-body{max-height:min(64vh,600px)}
.term-hist-col.is-zero{opacity:0}

/* ── Направления: чёткая карточка (контраст + иерархия) ── */
.dir-card{
  padding:15px 15px 0;
  border-radius:16px;
  border:1px solid #e5e7ee;
  background:#fff;
  box-shadow:0 1px 2px rgba(16,24,40,.05), 0 10px 24px -20px rgba(16,24,40,.28);
}
.dir-card::before{width:0}
.dir-top{align-items:flex-start;gap:12px}
.dir-icon{
  width:38px;height:38px;border-radius:12px;flex:0 0 auto;
  display:grid;place-items:center;
  background:color-mix(in srgb, var(--dir-accent) 11%, #fff);
  color:var(--dir-accent);
  box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--dir-accent) 16%, transparent);
}
.dir-icon svg{width:19px;height:19px;stroke-width:1.9}
.dir-name{flex:1 1 auto;min-width:0}
.dir-name h3{font-size:16.5px;font-weight:670;line-height:1.2;color:#111318;letter-spacing:-.022em}
.dir-sub{display:block;margin-top:2px;font-size:10.5px;font-weight:560;letter-spacing:.02em;color:#98a0ae}
.dir-desc{margin:10px 0 0;font-size:12.5px;line-height:1.45;color:#5b6270;letter-spacing:-.004em}
.chip{font-size:10.5px;font-weight:640;letter-spacing:0;padding:3.5px 8px;border-radius:7px;align-self:center}
.chip.on{background:#e7f8ed;color:#0b7a3b;box-shadow:inset 0 0 0 1px #c6ecd4}
.chip.off{background:#f1f2f6;color:#767e8c;box-shadow:inset 0 0 0 1px #e5e7ee}
.chip.violet{background:#eeeeff;color:#4b57c9;box-shadow:inset 0 0 0 1px #dcdcff}
.dir-meta{margin-top:12px;display:flex;flex-direction:column;gap:5px;align-items:flex-start}
.dir-schedule{display:inline-flex;align-items:center;gap:5px;font-size:11.5px;font-weight:540;color:#7c8492}
.dir-schedule svg{width:12px;height:12px;opacity:.75}
.dir-nums{display:inline-flex;flex-wrap:wrap;align-items:baseline;gap:4px;font-size:12.5px;color:#636b79;line-height:1.4}
.dir-nums b{font-size:13.5px;font-weight:690;color:#111318;font-variant-numeric:tabular-nums;letter-spacing:-.01em}
.dir-nums i{font-style:normal;color:#c2c7d1;margin:0 1px}
.dir-foot{
  margin:13px -15px 0;padding:11px 15px;
  border-top:1px solid #eef0f4;
  display:flex;align-items:center;gap:8px;
}
.dir-foot .button{height:35px;padding:0 14px;border-radius:10px;font-size:12.5px;font-weight:620;box-shadow:none}
.dir-foot .button.primary{background:var(--purple);color:#fff;box-shadow:0 1px 2px rgba(94,106,210,.35)}
.dir-foot .button.primary svg{width:13px;height:13px}
.dir-foot .button.secondary{background:#f5f6f9;border:1px solid #e5e7ee;color:#3d434f}
.dir-limit{margin-left:auto;max-width:48%;text-align:right;font-size:10.5px;line-height:1.35;color:#9aa1ae;letter-spacing:-.005em}
.dir-crew{margin-top:11px;display:flex;align-items:center;gap:8px}
.dir-crew-avatars{display:flex;align-items:center}
.dir-crew-avatar{
  width:22px;height:22px;border-radius:50%;margin-right:-6px;
  display:grid;place-items:center;
  background:#eef0f7;color:#4d5566;font-size:8.5px;font-weight:700;
  box-shadow:0 0 0 1.5px #fff;
}
.dir-crew-more{width:22px;height:22px;border-radius:50%;display:grid;place-items:center;background:#111318;color:#fff;font-size:8px;font-weight:700;box-shadow:0 0 0 1.5px #fff}
.dir-crew-empty{font-size:10.5px;color:#a6adba}
.dir-crew-count{font-size:11px;font-weight:560;color:#7c8492}
.dir-manual{color:#5e6ad2;font-weight:640}
.dir-hint{margin-top:10px;padding:7px 9px;border-radius:8px;background:#f6f7fb;font-size:10.8px;line-height:1.4;color:#6b7382}

/* ── Сводка направлений: белая, контрастная, без «фиолетовой каши» ── */
.dir-hero{
  grid-template-columns:150px minmax(0,1fr);
  align-items:center;gap:16px;
  background:#fff;color:#111318;
  border:1px solid #e5e7ee;border-radius:16px;
  padding:15px 16px;
  box-shadow:0 1px 2px rgba(16,24,40,.05);
}
.dir-hero-main{gap:3px}
.dir-hero-label{font-size:10px;letter-spacing:.07em;color:#8b93a1;opacity:1;font-weight:640}
.dir-hero-value{font-size:42px;font-weight:700;color:#111318;letter-spacing:-.035em}
.dir-hero-sub{font-size:11.5px;color:#7c8492;opacity:1;font-weight:520}
.dir-bar{height:4px;background:#edeff4;margin-top:9px}
.dir-bar i{background:var(--purple)}
.dir-hero-side{grid-template-columns:repeat(4,minmax(0,1fr));gap:0}
.dir-hero .kpi{background:transparent;border:0;border-left:1px solid #eef0f4;border-radius:0;padding:0 0 0 13px;gap:1px}
.dir-hero .kpi:first-child{border-left:0;padding-left:0}
.dir-hero .kpi-title{color:#8b93a1;font-size:9.5px;font-weight:640;letter-spacing:.04em}
.dir-hero .kpi-value{font-size:20px;color:#111318;font-weight:690;letter-spacing:-.02em;font-variant-numeric:tabular-nums}
.dir-hero .kpi-note{color:#a2a9b6;font-size:10px}
@media (max-width:700px){
  .dir-hero{grid-template-columns:1fr;gap:14px;padding:14px}
  .dir-hero-side{grid-template-columns:repeat(4,minmax(0,1fr))}
  .dir-hero .kpi{padding-left:10px}
  .dir-hero .kpi-value{font-size:17px}
  .dir-hero .kpi-note{display:none}
}
.head-actions .button.ghost{background:#fff;border:1px solid #e5e7ee;color:#3d434f;box-shadow:0 1px 2px rgba(16,24,40,.04)}
/* пустые состояния — компактно */
.empty{padding:22px 16px;gap:6px}
.empty .empty-ico,.empty svg{width:26px;height:26px}
.empty h3,.empty strong{font-size:13.5px}
.empty p{font-size:11.5px;line-height:1.45;max-width:34ch}
.panel-head h2{font-size:15px;letter-spacing:-.015em}
.queue .empty{padding:18px 12px}
/* карточка направления: кнопки всегда внизу, лимит — отдельной строкой */
.dir-card{display:flex;flex-direction:column}
.dir-note{
  display:flex;align-items:center;gap:5px;
  margin-top:9px;font-size:10.5px;font-weight:540;color:#98a0ae;letter-spacing:-.005em;
}
.dir-note svg{width:11px;height:11px;opacity:.7}
.dir-foot{margin-top:auto}
.dir-limit{display:none}
.dir-crew-avatar{background:#e8ebf3;color:#414a5c;width:21px;height:21px;font-size:8px}
.dir-crew-more{width:21px;height:21px;font-size:7.5px}
/* выравнивание и контраст карточек */
.dir-grid{align-items:start}
.dir-card{height:100%}
.dir-desc{color:#4f5665}
.dir-nums{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}
.dir-money{white-space:nowrap}
.dir-crew-avatar{background:#dfe4ef;color:#39414f;box-shadow:0 0 0 1.5px #fff}
.dir-crew-more{box-shadow:0 0 0 1.5px #fff}
@media (max-width:700px){
  .dir-nums{white-space:normal}
}
/* iOS: не даём странице зумиться при фокусе в поле (16px минимум) */
@media (pointer:coarse){
  .term-search{font-size:16px;padding:3px 0}
  .term-search::placeholder{font-size:12px}
  .task-field input,.task-field textarea,.task-field select,.search input,.input{font-size:16px}
}
/* нижнее меню: чуть крупнее иконки и чётче подпись */
.tab-ico svg{width:22px;height:22px;stroke-width:1.9}
.tab-label{font-size:10.5px;font-weight:600;letter-spacing:.01em}
.tab.active .tab-label{font-weight:700}
.dir-nums{flex-wrap:nowrap;gap:3px;font-size:12px}
.dir-nums b{font-size:13px}
.dir-crew-avatar{width:24px;height:24px;background:#d6dce9;color:#2f3745;font-size:8.5px;margin-right:-7px}
.dir-crew-more{width:24px;height:24px;font-size:8px}
@media (max-width:700px){.dir-nums{flex-wrap:wrap;font-size:12.5px}}
/* кнопка темы журнала */
.term-theme{
  flex:0 0 auto;width:26px;height:26px;border-radius:8px;border:1px solid transparent;
  background:transparent;color:#8b93a1;display:grid;place-items:center;cursor:pointer;
  -webkit-tap-highlight-color:transparent;transition:background .12s ease,color .12s ease;
}
.term-theme:active{transform:scale(.94)}
.term:not(.is-light) .term-theme{background:rgba(255,255,255,.06);color:#9aa4b8}
.term:not(.is-light) .term-theme:hover{color:#e6e9f0}
.term.is-light .term-theme{background:#fff;border-color:#e5e7ee;color:#5b6270}
/* светлая тема журнала: базовые светлые правила уже в файле, тут только правки плотной сетки */
.term.is-light .term-kpis{background:#fbfbfd}
.term.is-light .term-kpi b{color:#111318}
.term.is-light .term-kpi.ok b{color:#12a150}
.term.is-light .term-kpi.err b{color:#e5484d}
.term.is-light .term-kpi i{color:#8b93a1}
.term.is-light .term-sep{background:#e5e7ee}
.term.is-light .term-hist-wrap{background:#fbfbfd}
.term.is-light .term-hist-col i{background:#8f9bf0}
.term.is-light .term-hist-col u{background:#f0848a}
.term.is-light .term-line{color:#2a2f38}
.term.is-light .term-err{color:#c0363b;background:#fdf3f3}
.term.is-light .term-chip.on{background:#111318;border-color:#111318;color:#fff}
.term.is-light .term-search-box{background:#f2f3f7}
.term.is-light .term-search{color:#111318}
.term.is-light .term-chip.on{background:#5e6ad2;border-color:#5e6ad2;color:#fff}
.term.is-light .term-chip.err.on{background:#d92d20;border-color:#d92d20}
