/* MODIX — плашка чужого аккаунта модератора и лента действий клиента (v13.59-modact) */

/* ── Плашка активного чужого аккаунта под шапкой ─────────────────────────── */
.owner-ctx-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 12px 8px;
  padding: 8px 10px 8px 12px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.16), rgba(109, 91, 255, 0.14));
  border: 1px solid rgba(245, 158, 11, 0.38);
  box-shadow: 0 4px 14px rgba(24, 20, 56, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: relative;
  z-index: 6;
}
.owner-ctx-bar[hidden] { display: none !important; }
html[data-theme="dark"] .owner-ctx-bar {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(139, 92, 246, 0.2));
  border-color: rgba(251, 191, 36, 0.36);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.34);
}
.owner-ctx-ico {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex: 0 0 32px;
}
.owner-ctx-ico:not(.crystal-host) {
  background: var(--g-amber, linear-gradient(145deg, #f59e0b, #fbbf24));
  color: #fff;
  box-shadow: 0 3px 8px rgba(245, 158, 11, 0.32);
}
.owner-ctx-ico:not(.crystal-host) svg { width: 17px; height: 17px; }
.owner-ctx-ico:not(.crystal-host) svg path { fill: #fff !important; stroke: none !important; }
.owner-ctx-ico.crystal-host {
  background: transparent !important;
  box-shadow: none !important;
  border: 0 !important;
  padding: 0 !important;
}
.owner-ctx-ico.crystal-host > svg.crystal-icon {
  display: block !important;
  width: 32px !important;
  height: 32px !important;
  aspect-ratio: 1;
  filter: none !important;
}
.owner-ctx-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.owner-ctx-kicker {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #b45309;
}
html[data-theme="dark"] .owner-ctx-kicker { color: #fbbf24; }
.owner-ctx-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink, #111827);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.owner-ctx-acts {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.owner-ctx-btn {
  appearance: none;
  border: 1px solid rgba(109, 91, 255, 0.35);
  background: linear-gradient(135deg, #6d5bff, #8b5cf6);
  color: #fff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 7px 11px;
  border-radius: 11px;
  cursor: pointer;
  white-space: nowrap;
  min-height: 34px;
  box-shadow: 0 3px 10px rgba(109, 91, 255, 0.28);
  transition: transform 0.12s ease, opacity 0.12s ease;
}
.owner-ctx-btn:active { transform: scale(0.97); }
.owner-ctx-btn.ghost {
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink, #111827);
  border-color: var(--line, rgba(0, 0, 0, 0.12));
  box-shadow: none;
}
html[data-theme="dark"] .owner-ctx-btn.ghost {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink, #f3f4f6);
  border-color: rgba(255, 255, 255, 0.14);
}
@media (max-width: 360px) {
  .owner-ctx-bar { margin: 0 8px 6px; padding: 7px 8px 7px 10px; gap: 6px; }
  .owner-ctx-btn { padding: 6px 8px; font-size: 11.5px; }
}

/* Подсказка на шаге выбора чата в мастере поста */
.wiz-owner-alert {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(109, 91, 255, 0.12));
  border: 1px solid rgba(245, 158, 11, 0.4);
}
html[data-theme="dark"] .wiz-owner-alert {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(139, 92, 246, 0.16));
  border-color: rgba(251, 191, 36, 0.35);
}
.wiz-owner-alert .wo-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
}
.wiz-owner-alert .wo-sub {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.35;
}
.wiz-owner-alert .wo-acts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── Панель действий и истории клиента (Админка) ─────────────────────────── */
.ca-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

/* KPI-полоска */
.ca-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.ca-kpi {
  padding: 11px 10px;
  border-radius: 16px;
  background: var(--card, rgba(255, 255, 255, 0.85));
  border: 1px solid var(--line, rgba(15, 23, 42, 0.08));
  box-shadow: var(--sh, 0 2px 8px rgba(0, 0, 0, 0.05));
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.ca-kpi-val {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
}
.ca-kpi-val.green { color: #16a34a; }
.ca-kpi-val.violet { color: #7c3aed; }
html[data-theme="dark"] .ca-kpi-val.green { color: #4ade80; }
html[data-theme="dark"] .ca-kpi-val.violet { color: #a78bfa; }
.ca-kpi-lab {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Панель фильтров и поиска */
.ca-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ca-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 1px;
  -webkit-overflow-scrolling: touch;
}
.ca-tabs::-webkit-scrollbar { display: none; }
.ca-tab {
  appearance: none;
  border: 1px solid var(--line, rgba(15, 23, 42, 0.1));
  background: var(--card, rgba(255, 255, 255, 0.8));
  color: var(--ink);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 11px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  cursor: pointer;
  min-height: 36px;
  flex: 0 0 auto;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}
.ca-tab .ca-cnt {
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.14);
  color: var(--muted);
}
.ca-tab[aria-pressed="true"] {
  background: linear-gradient(135deg, #6d5bff, #8b5cf6);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 12px rgba(109, 91, 255, 0.28);
}
.ca-tab[aria-pressed="true"] .ca-cnt {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.ca-search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.ca-search-box > input.ca-search-inp {
  width: 100%;
  box-sizing: border-box;
  height: 48px !important;
  min-height: 48px !important;
  padding-right: 40px !important;
  font-size: 14px;
}
.ca-search-clear {
  position: absolute;
  right: 8px;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.18);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.ca-search-clear[hidden] { display: none; }

/* Карточка таймлайна с группировкой по дням */
.ca-feed-card {
  border-radius: var(--radius-card, 20px);
  background: var(--card, rgba(255, 255, 255, 0.88));
  border: 1px solid var(--line, rgba(15, 23, 42, 0.08));
  box-shadow: var(--card-sh, 0 8px 24px rgba(0, 0, 0, 0.08));
  overflow: hidden;
}
.ca-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px 7px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(100, 116, 139, 0.06);
  border-bottom: 1px solid var(--line-2, rgba(100, 116, 139, 0.1));
}
html[data-theme="dark"] .ca-day-head {
  background: rgba(255, 255, 255, 0.03);
}
.ca-day-head + .ca-item::before { display: none; }
.ca-day-group + .ca-day-group .ca-day-head {
  border-top: 1px solid var(--line, rgba(100, 116, 139, 0.14));
}

/* Элемент таймлайна (GitHub Primer + Stripe style) */
.ca-item {
  position: relative;
  display: flex;
  flex-direction: column;
}
.ca-item + .ca-item::before {
  content: "";
  position: absolute;
  left: 62px;
  right: 14px;
  top: 0;
  height: 1px;
  background: var(--line-2, rgba(100, 116, 139, 0.12));
}
.ca-row {
  appearance: none;
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
  font-family: inherit;
  color: inherit;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 14px;
  cursor: pointer;
  position: relative;
  transition: background 0.12s ease;
}
.ca-row:hover { background: rgba(109, 91, 255, 0.04); }
html[data-theme="dark"] .ca-row:hover { background: rgba(255, 255, 255, 0.03); }

/* Вертикальная линия таймлайна, соединяющая узлы дня */
.ca-rail {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 0 36px;
  align-self: stretch;
}
.ca-item:not(:last-child) .ca-rail::after {
  content: "";
  position: absolute;
  top: 38px;
  bottom: -13px;
  width: 2px;
  border-radius: 2px;
  background: var(--line-2, rgba(148, 163, 184, 0.24));
}
/* Один видимый кристальный значок без вложенной рамки/подложки */
.ca-node {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  position: relative;
  z-index: 1;
  flex: 0 0 36px;
}
.ca-node.crystal-host {
  background: transparent !important;
  box-shadow: none !important;
  border: 0 !important;
  padding: 0 !important;
}
.ca-node.crystal-host > svg.crystal-icon {
  display: block !important;
  width: 36px !important;
  height: 36px !important;
  aspect-ratio: 1;
  filter: none !important;
}
.ca-node:not(.crystal-host) {
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.14);
}
.ca-node:not(.crystal-host) svg { width: 18px; height: 18px; }
.ca-node:not(.crystal-host) svg path { fill: #fff !important; stroke: none !important; }
.ca-node:not(.crystal-host).green { background: var(--g-green, linear-gradient(145deg, #16a34a, #4ade80)); }
.ca-node:not(.crystal-host).blue { background: var(--g-blue, linear-gradient(145deg, #3b82f6, #60a5fa)); }
.ca-node:not(.crystal-host).violet { background: var(--g-violet, linear-gradient(145deg, #6d5bff, #a78bfa)); }
.ca-node:not(.crystal-host).amber { background: var(--g-amber, linear-gradient(145deg, #f59e0b, #fbbf24)); }
.ca-node:not(.crystal-host).red { background: var(--g-red, linear-gradient(145deg, #ef4444, #f87171)); }
.ca-node:not(.crystal-host).slate { background: var(--g-slate, linear-gradient(145deg, #64748b, #94a3b8)); }

.ca-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.ca-title {
  font-size: 13.8px;
  font-weight: 700;
  line-height: 1.28;
  color: var(--ink);
  word-break: break-word;
}
.ca-sub {
  font-size: 12.2px;
  line-height: 1.32;
  color: var(--muted);
  word-break: break-word;
}
.ca-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 3px;
}
.ca-pill {
  display: inline-flex;
  align-items: center;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 7px;
  line-height: 1.3;
  background: rgba(100, 116, 139, 0.13);
  color: var(--muted);
}
.ca-pill.green { background: rgba(22, 163, 74, 0.15); color: #15803d; }
.ca-pill.blue { background: rgba(59, 130, 246, 0.15); color: #1d4ed8; }
.ca-pill.violet { background: rgba(124, 58, 237, 0.15); color: #6d28d9; }
.ca-pill.amber { background: rgba(245, 158, 11, 0.18); color: #b45309; }
.ca-pill.red { background: rgba(239, 68, 68, 0.15); color: #b91c1c; }
html[data-theme="dark"] .ca-pill.green { color: #4ade80; }
html[data-theme="dark"] .ca-pill.blue { color: #60a5fa; }
html[data-theme="dark"] .ca-pill.violet { color: #c4b5fd; }
html[data-theme="dark"] .ca-pill.amber { color: #fbbf24; }
html[data-theme="dark"] .ca-pill.red { color: #f87171; }

.ca-right {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  padding-top: 1px;
  max-width: 34%;
  text-align: right;
}
.ca-amt {
  font-size: 13.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--ink);
}
.ca-amt.pos { color: #16a34a; }
.ca-amt.neg { color: #dc2626; }
html[data-theme="dark"] .ca-amt.pos { color: #4ade80; }
html[data-theme="dark"] .ca-amt.neg { color: #f87171; }
.ca-time {
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  white-space: nowrap;
}

/* Раскрываемые детали события */
.ca-drawer {
  margin: 0 14px 10px 56px;
  padding: 9px 11px;
  border-radius: 12px;
  background: rgba(100, 116, 139, 0.08);
  border: 1px solid var(--line-2, rgba(100, 116, 139, 0.14));
  display: flex;
  flex-direction: column;
  gap: 5px;
}
html[data-theme="dark"] .ca-drawer {
  background: rgba(255, 255, 255, 0.04);
}
.ca-drawer[hidden] { display: none; }
.ca-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 11.8px;
  line-height: 1.3;
}
.ca-meta-k { color: var(--muted); flex: 0 0 auto; }
.ca-meta-v {
  color: var(--ink);
  font-weight: 600;
  text-align: right;
  word-break: break-all;
  font-variant-numeric: tabular-nums;
}
.ca-drawer-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 3px;
}
.ca-copy-btn {
  appearance: none;
  border: 1px solid var(--line, rgba(100, 116, 139, 0.25));
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
}
.ca-copy-btn:hover { color: var(--ink); }

.ca-more-wrap {
  padding: 10px 14px 12px;
  border-top: 1px solid var(--line-2, rgba(100, 116, 139, 0.12));
}
.ca-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
@media (max-width: 360px) {
  .ca-kpis { gap: 6px; }
  .ca-kpi { padding: 9px 8px; }
  .ca-kpi-val { font-size: 13.5px; }
  .ca-row { padding: 10px 11px; gap: 9px; }
  .ca-drawer { margin: 0 11px 10px 48px; }
}
