﻿@import url("./aidc-dialogs.css");
@import url("./responsive-scaling.css");

/* ═══════════════════════════════════════════════════════════════════════════
   AIDC Theme — centralized dark palette (v2, inline).
   Все основные фоновые цвета вынесены сюда. Чтобы сделать сайт светлее/темнее,
   меняй ТОЛЬКО значения переменных ниже.
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
  --aidc-bg-base:       #0d0e10;
  --aidc-bg-surface:    #16171a;
  --aidc-bg-elevated:   #1d1e21;
  --aidc-bg-card:       #222325;
  --aidc-bg-overlay:    #1e1f21;
  --aidc-bg-folder:     #272829;
  --aidc-bg-dialog-from:#1a1b1d;
  --aidc-bg-dialog-to:  #141516;
  --aidc-text-primary:  #f5f5f5;
  --aidc-text-secondary:#d0d0d4;
  --aidc-text-muted:    #9a9a9e;
  --aidc-border:        rgba(255,255,255,0.10);
  --aidc-border-subtle: rgba(255,255,255,0.06);
}

/* При сворачивании панели дерева — уменьшать ширину первой колонки (универсально для всех страниц) */
.main--tree-collapsed {
  grid-template-columns: 60px 420px 1fr !important;
}
.tree-toolbar-actions .icon-btn[data-action="restore-trash"] svg,
.tree-toolbar-actions .icon-btn[data-action="restore-trash"] img,
.tree-toolbar-actions .icon-btn[data-action="new-project"] svg,
.tree-toolbar-actions .icon-btn[data-action="new-project"] img {
  width: 18px !important;
  height: 18px !important;
}
/* Строка поиска в тулбаре структуры проектов */
.tree-toolbar-search-row {
  width: 100%;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
}
.tree-toolbar-search-row .tree-search {
  width: 100%;
  padding: 0 12px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  color: #e8e8f5;
  font-size: 15px;
  transition: border .15s, background .15s;
  outline: none;
}
.tree-toolbar-search-row .tree-search:focus {
  border-color: #ff62c5;
  background: rgba(255,255,255,0.08);
}
.tree-toolbar-actions .icon-btn[data-action="move"] svg,
.tree-toolbar-actions .icon-btn[data-action="duplicate"] svg,
.tree-toolbar-actions .icon-btn[data-action="delete"] svg,
.tree-toolbar-actions .icon-btn[data-action="move"] img,
.tree-toolbar-actions .icon-btn[data-action="duplicate"] img,
.tree-toolbar-actions .icon-btn[data-action="delete"] img {
  width: 14px !important;
  height: 14px !important;
}
/* === Универсальный тулбар с иконками (AI Design Space) === */
.tree-toolbar-actions {
  display: flex;
  gap: 6px;
  justify-content: space-between;
}

.tree-toolbar-actions .icon-btn {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  border-radius: 8px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.04);
  transition: background .15s ease, box-shadow .15s ease;
}

.tree-toolbar-actions .icon-btn:hover {
  background: rgba(255,255,255,0.08);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.12);
}

.tree-toolbar-actions .icon-btn.is-active {
  background: rgba(236,0,140,0.18);
  box-shadow: 0 0 0 1px rgba(236,0,140,0.5);
}

.tree-toolbar-actions .icon-btn svg,
.tree-toolbar-actions .icon-btn img {
  width: 16px !important;
  height: 16px !important;
}
/* === Универсальные классы скролла и высот для всех модулей (AIDC) === */
.aidc-scroll-host {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.aidc-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.aidc-scroll::-webkit-scrollbar {
  width: 0;
  height: 0;
}

html { min-height: 100%; }
/* [v1.9.55] Покраска <html> в цвет body — глобальный фикс «чёрной/белой
   полосы под футером». Истинная причина: responsive-scaling.css ставит
   html { zoom: 0.85 / 0.78 / ... } на FullHD/HD-экранах, при этом
   потомок с min-height:100vh физически занимает только (zoom × 100%)
   высоты окна → снизу остаётся щель шириной (1-zoom) × 100vh, через
   которую виден фон <html> (по умолчанию прозрачный → браузерный фон).
   Тот же приём применён в editor-layout.css (v1.9.38). */
html { background: var(--aidc-bg-base); }
/* Zoom/scale managed by responsive-scaling.css — do NOT set fixed zoom here */
/* Telegram WebApp: keep native 100% zoom to match TG viewport */
html[data-tg="1"] { zoom: 1; --zoom: 1; }
body { margin: 0; }
/* Global icon color for site (light gray) */
:root {
  --icon-color: #bfbfbf;
}

/* Apply icon color to inline SVGs and common icon containers by default.
  Default to stroke-only (outline) coloring to avoid unexpectedly filling
  icon shapes. If an icon should be filled, set fill explicitly on the
  element or use a helper class like `.icon--filled`.
  Canvas format bars are excluded — they control SVG appearance via inline styles + injected CSS. */
svg { fill: none; stroke: var(--icon-color); }
/* Reset: let canvas format-bar SVGs use their own inline styles without interference */
.canvas-format-bar svg { fill: initial; stroke: initial; stroke-width: initial; }
.icon, .icon * { color: var(--icon-color); }
svg[stroke] { stroke: var(--icon-color); }
/* For svg images embedded via <img src="...svg"> try to harmonize color via filters (best-effort). */
.rv2-icon-btn img, img.icon, img[src$="calendar.svg"] { filter: grayscale(100%) brightness(0.85); opacity: .95; }
/* ******** Utility classes added by chore/remove-inline-display ******** */
/* Utility to hide elements instead of using inline style="display:none" */
.is-hidden { display: none !important; }
/* ************************************************************* */

/* ================= Global hint / tooltip styles (AIDC) ================ */
/* Use the `.aidc-hint` class for all small helper texts, hints and tooltips.
   This block intentionally uses site color tokens to match the dark theme.
   Backward-compatible selector :is(...) ensures existing classes that end
   with "-hint" get the same appearance. For new hints use `.aidc-hint`. */
.aidc-hint,
:is(.refp-hint, .refp-error-hint, .auth-hint, .refp-footer .refp-hint, .refp-error) {
  display: block;
  color: #dcd9e8; /* light lavender */
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  border: 1px solid rgba(255,255,255,0.04);
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.35;
  box-shadow: 0 6px 24px rgba(0,0,0,0.6);
  margin: 6px 0;
}

.aidc-hint small, .aidc-hint .muted, .aidc-hint .muted--light {
  color: rgba(220, 217, 232, 0.72);
  font-size: 12px;
}

/* Error / warning variant */
.aidc-hint--error, .refp-error-hint {
  border: 1px solid rgba(236,0,140,0.28);
  background: linear-gradient(180deg, rgba(236,0,140,0.03), rgba(255,0,140,0.01));
  color: #ffd9ee;
}

/* Compact variant for inline tiny hints */
.aidc-hint--compact { padding: 4px 6px; font-size: 12px; border-radius: 8px; display: inline-block; }

/* End of global hint styles */

/* Ensure hints don't overflow their container or the viewport. For simple
   inline/block hints we limit width and enable safe wrapping. For floating
   tooltips use the overlays/dialog root so they aren't clipped by overflow:hidden
   parents (see docs in assets/css/README-hints.md). */
.aidc-hint {
  max-width: min(560px, 100%);
  box-sizing: border-box;
  word-break: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;
}

/* If a hint should float above content (e.g., popover), prefer mounting it
   into the global dialog root (#aidc-dialog-root) or using AIDC overlays.
   These rules make floating hints render above other UI and avoid clipping. */
.aidc-hint--floating {
  position: absolute;
  z-index: 1200000;
  left: 0; top: 0;
  transform: translate3d(0,0,0);
  max-width: 80vw;
}

/* ================= Custom tooltip (floating) ================= */
.aidc-overlays-root,
#aidc-overlays-root {
  pointer-events: none;
}
.aidc-overlays-root > *,
#aidc-overlays-root > * {
  pointer-events: auto;
}
/* Tooltip must NEVER receive pointer events — prevents flicker/jitter */
#aidc-global-tooltip,
.aidc-tooltip {
  pointer-events: none !important;
}
.aidc-tooltip {
  pointer-events: none !important; /* NEVER capture mouse — prevents flicker */
  opacity: 0;
  transition: opacity .12s ease;
  padding: 8px 10px;
  white-space: normal;
  line-height: 1.2;
  font-size: 13px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(10,10,14,0.96), rgba(9,9,12,0.94));
  color: #e0e0e4;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 8px 32px rgba(0,0,0,0.7);
  max-width: min(320px, 90vw);
}
/* Arrow pointing up (tooltip is below element) */
.aidc-tooltip .aidc-tooltip__arrow {
  position: absolute; width: 10px; height: 10px; transform: rotate(45deg);
  background: inherit; border-left: 1px solid rgba(255,255,255,0.04); border-top: 1px solid rgba(255,255,255,0.04);
  left: 50%; margin-left: -5px; top: -5px;
}
/* Arrow pointing down (tooltip is above element) */
.aidc-tooltip.aidc-tooltip--above .aidc-tooltip__arrow {
  top: auto; bottom: -5px;
  border-left: none; border-top: none;
  border-right: 1px solid rgba(255,255,255,0.04); border-bottom: 1px solid rgba(255,255,255,0.04);
}
/* Arrow pointing right (tooltip is left of element) */
.aidc-tooltip.aidc-tooltip--left .aidc-tooltip__arrow {
  left: auto; right: -5px; top: 50%; margin-top: -5px; margin-left: 0;
  border-left: none; border-top: none;
  border-right: 1px solid rgba(255,255,255,0.04); border-bottom: 1px solid rgba(255,255,255,0.04);
}
/* Arrow pointing left (tooltip is right of element) */
.aidc-tooltip.aidc-tooltip--right .aidc-tooltip__arrow {
  left: -5px; right: auto; top: 50%; margin-top: -5px; margin-left: 0;
  border-right: none; border-bottom: none;
  border-left: 1px solid rgba(255,255,255,0.04); border-top: 1px solid rgba(255,255,255,0.04);
}

/* small responsive tweak */
@media (max-width: 420px) {
  .aidc-tooltip { font-size: 12px; padding: 6px 8px; }
}

/* ================= Quota banner ================= */
.aidc-quota-banner {
  position: fixed;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 120000;
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.aidc-quota-banner__inner {
  pointer-events: auto;
  width: min(980px, 100%);
  background: linear-gradient(135deg, rgba(16,18,26,0.98), rgba(24,18,28,0.96));
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 18px 60px rgba(0,0,0,0.6);
  border-radius: 14px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
}
.aidc-quota-banner__text {
  color: #f1eef7;
  font-size: 14px;
  line-height: 1.35;
}
.aidc-quota-banner__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.aidc-quota-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.05);
  color: #f1eef7;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
}
.aidc-quota-btn--primary {
  background: rgba(255,98,197,0.18);
  border-color: rgba(255,98,197,0.45);
}
.aidc-quota-banner__close {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.25);
  color: #f1eef7;
  cursor: pointer;
}
@media (max-width: 720px) {
  .aidc-quota-banner__inner {
    grid-template-columns: 1fr;
  }
  .aidc-quota-banner__close {
    justify-self: start;
  }
}

/* tooltip: fixed above everything, never intercepts mouse (prevents flicker) */
.aidc-tooltip { position: fixed !important; z-index: 2147483647 !important; pointer-events: none !important; }

/* Minimal styles for confirm overlays mounted via AIDC_OVERLAYS */
.aidc-overlay.aidc-confirm { position: relative; }
.aidc-confirm__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.56);
  backdrop-filter: blur(4px);
}
.aidc-confirm__panel {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(180deg, var(--aidc-bg-dialog-from) 0%, var(--aidc-bg-dialog-to) 100%);
  color: #e9e9f4;
  border-radius: 12px;
  padding: 16px;
  width: 380px;
  max-width: 92vw;
  box-shadow: 0 12px 48px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,255,255,0.02);
  z-index: 1000000;
}
.aidc-confirm__body { margin-bottom: 12px; font-size: 15px; line-height: 1.4; }
.aidc-confirm__actions { display: flex; gap: 8px; justify-content: flex-end; }
.aidc-confirm__cancel { background: rgba(255,255,255,0.06); color: #d6d6e5; border-radius: 8px; padding: 8px 12px; border: none; cursor: pointer; }
.aidc-confirm__ok { background: linear-gradient(120deg, #ff62c5, #ff008c); color: #07040a; border: none; padding: 8px 12px; border-radius: 8px; cursor: pointer; }

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main.aidc-layout {
  flex: 1 1 0%;
  min-height: 0;
}

a {
  color: inherit;
  text-decoration: none;
}
.panel, .panel--left, .panel--center, .panel--right, .aidc-col {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.module-stack, .stack {
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

[data-module] {
  min-height: 0;
  display: flex;
  flex-direction: column;
}
[data-module] .module-head {
  flex: 0 0 auto;
}
[data-module] .module-body {
  flex: 1 1 auto;
  min-height: 0;
}
/* Карточка папки в списке проектов */
.folder-card {
  background: linear-gradient(90deg, #23243a 60%, #23243a 100%);
  border: 1.5px dashed #4e4e7e;
  color: #b6b7d6;
  cursor: pointer;
  transition: border 0.2s, box-shadow 0.2s;
}
.folder-card:hover {
  border: 1.5px solid #7a7ad6;
  box-shadow: 0 2px 8px 0 rgba(122,122,214,0.08);
  background: linear-gradient(90deg, #2a2b4a 60%, #23243a 100%);
}
.folder-card .project-title {
  font-weight: 600;
  color: #e9e9f4;
}
.folder-card .thumb-label {
  color: #7a7ad6;
  font-weight: 700;
}
.folder-card .thumb-type {
  color: #b6b7d6;
  font-size: 12px;
}
/* --- Стили для инлайн-редактирования названия и описания (input, textarea) --- */
.details-title-edit, .details-path-edit {
  background: rgba(20, 18, 28, 0.98);
  color: #f5f5ff;
  border: 1px solid #ff62c5;
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 18px;
  font-weight: 600;
  box-shadow: 0 2px 12px rgba(255,0,140,0.08);
  outline: none;
  scrollbar-width: thin;
  scrollbar-color: #ff62c5 #181825;
}

.details-title-edit:focus, .details-path-edit:focus {
  border-color: #00b4ff;
}
.details-desc-edit {
  background: rgba(20, 18, 28, 0.98);
  color: #f5f5ff;
  border: 1px solid #ff62c5;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 15px;
  box-shadow: 0 2px 12px rgba(255,0,140,0.08);
  outline: none;
  resize: vertical;
  transition: border-color 0.18s;
}
.details-desc-edit:focus {
  border-color: #00b4ff;
}

/* --- Стили для полей редактирования дерева --- */
.tree-edit-input, .tree-edit-textarea {
  background: rgba(20, 18, 28, 0.98);
  color: #f5f5ff;
  border: 1px solid #ff62c5;
  border-radius: 12px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 4px 24px rgba(255,0,140,0.12);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
  margin-top: 2px;
  scrollbar-width: thin;
  scrollbar-color: #ff62c5 #181825;
}
.tree-edit-textarea {
  padding: 10px 14px;
  resize: vertical;
  min-height: 32px;
}
.tree-edit-input:focus, .tree-edit-textarea:focus {
  border-color: #00b4ff;
  box-shadow: 0 0 0 2px rgba(0,180,255,0.27);
}
.tree-edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.tree-edit-btn {
  border-radius: 999px;
  padding: 5px 14px;
  border: none;
  background: linear-gradient(120deg, #ff62c5, #ff008c);
  color: #07040a;
  font-size: 12px;
  font-weight: 550;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08);
  transition: background 0.2s;
}
.tree-edit-btn.cancel {
  background: rgba(255,255,255,0.08);
  color: #d0d0df;
}

/* ---------- Панели и layout для дерева проектов ---------- */


.main {
  flex: 1;
  display: grid;
  grid-template-columns: 300px 420px 1fr;
  gap: 18px;
  min-height: 0;
}

.main.main--tree-standalone {
  grid-template-columns: 300px minmax(0, 1fr);
}

@media (max-width: 1200px) {
  .main {
    grid-template-columns: 1fr 1.2fr;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .panel-right {
    grid-column: 1 / -1;
  }
}

@media (max-width: 840px) {
  .main {
    grid-template-columns: minmax(0,1fr);
    grid-template-rows: auto auto auto;
  }
}

.panel {
  border-radius: 24px;
  background: var(--aidc-bg-surface);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow:
    0 24px 64px rgba(0,0,0,0.7),
    0 0 0 1px rgba(255,255,255,0.02);
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  scrollbar-width: none;
}
.panel::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.panel-block {
  min-height: 0;
  overflow: hidden;
  scrollbar-width: none;
}
.panel-block::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.panel-tree .panel-header {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  min-height: 0;
}

.stack > .panel-block {
  flex: 1 1 auto;
  min-height: 0;
}

.panel--center {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.panel--center .panel-block {
  flex: 1 1 auto;
  min-height: 0;
}

.panel-tree .panel-toolbar {
  width: 100%;
  justify-content: flex-start;
}


.panel-tree .panel-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 10px;
}

.panel-title {
  font-size: 14px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #d6d6e5;
}

.panel-sub {
  font-size: 12px;
  color: #9090a5;
}

.panel-toolbar {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pill-btn {
  border-radius: 999px;
  padding: 5px 10px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.03);
  font-size: 12px;
  color: #f5f5ff;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.pill-btn.primary {
  border-color: rgba(255,0,140,0.6);
  background: linear-gradient(120deg, #ff62c5, #ff008c);
  color: #07040a;
  font-weight: 550;
}

.pill-btn.icon {
  padding-inline: 8px;
  height: 32px;
  min-width: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  box-sizing: border-box;
  cursor: pointer;
}

.icon-btn {
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  color: #d6d9e5;
}
.icon-btn svg {
  width: 29px;
  height: 29px;
  stroke: #d6d9e5;
  stroke-width: 0.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn img.aidc-ui-icon {
  width: 18px;
  height: 18px;
  display: block;
  filter: brightness(2) grayscale(0.2) !important;
  opacity: 0.85;
  pointer-events: none;
}
.filter-pill.icon img.aidc-ui-icon {
  filter: brightness(1.6) grayscale(0.2);
  opacity: 0.8;
}

/* Исправление синтаксиса: удалена лишняя скобка */

.tree-node.active.favorite {
  border-color: #ffd86f;
  background: rgba(255,215,120,0.28);
  box-shadow:
    0 0 0 1px rgba(255,215,120,0.65),
    0 8px 22px rgba(255,215,120,0.3);
}

.tree-head {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.tree-name {
  display: inline-flex;
  align-items: flex-end;
  gap: 4px;
  flex-wrap: wrap;
}

.tree-icon {
  width: 26px;
  min-width: 26px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0.9;
}

.tree-icon img {
  width: 22px;
  height: 20px;
  object-fit: contain;
  display: block;
  filter: brightness(0) invert(1);
}

/* Workspace root folder icons: pink tint */
.tree-icon--workspace img {
  filter: invert(46%) sepia(96%) saturate(2000%) hue-rotate(295deg) brightness(100%) contrast(102%) !important;
}

.tree-icon svg {
  width: 20px;
  height: 20px;
  stroke: #ff62c5;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.date-range-popover {
  display: none;
  position: fixed;
  min-width: 260px;
  background: var(--aidc-bg-elevated);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(0,0,0,0.55);
  padding: 10px;
  z-index: 99999;
  left: 0;
  right: auto;
  top: 0;
  max-width: calc(100vw - 32px);
  box-sizing: border-box;
}
.date-range-popover.open { display: block; }

.tree-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tree-label-main {
  font-size: 13px;
}

.tree-label-sub {
  font-size: 11px;
  color: #8f90a5;
}

.tree-placeholder {
  padding: 12px;
  text-align: center;
  color: #8f90a5;
  font-size: 12px;
}

.tree-indent-1 { padding-left: 16px; }
.tree-indent-2 { padding-left: 32px; }
.tree-indent-3 { padding-left: 48px; }
.tree-indent-4 { padding-left: 64px; }
.tree-indent-5 { padding-left: 80px; }
.tree-indent-6 { padding-left: 96px; }

.project-fav-star-btn {
  border: none;
  background: transparent;
  color: #8b8ea3;
  font-size: 14px;
  line-height: 1;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-right: 6px;
  padding: 0;
}
.project-fav-star-btn.active {
  color: #ffd86f;
  text-shadow: 0 0 6px rgba(255,216,111,0.65);
}
.project-fav-star-btn img{
  width: 14px;
  height: 14px;
  display: block;
  /* Make black SVG in <img> look like "inactive" light gray */
  filter: invert(63%) sepia(9%) saturate(274%) hue-rotate(202deg) brightness(95%) contrast(90%);
}
.project-fav-star-btn.active img{
  /* Make black SVG in <img> look like "active" gold */
  filter: invert(88%) sepia(26%) saturate(695%) hue-rotate(347deg) brightness(104%) contrast(103%);
}
/* Розовая рамка для выделенного проекта */
.project-card.selected,
.project-card.active {
  border: 1px solid #ff3fa6 !important;
  box-shadow: 0 0 0 1px #ff3fa633;
}
* {
  box-sizing: border-box;
}

html { min-height: 100%; }

body{
  margin:0;
  padding:0;
  background: var(--aidc-bg-base);
  color:#f5f5f5;
  font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;

  min-height:100vh;
  display:flex;
  flex-direction:column;
}


.shell{
  flex:1 1 0%;
  display:flex;
  flex-direction:column;
  min-height:0;
  padding:0 0 26px;
}
#app{
  flex:1 1 0%;
  min-height:0;
}

.shell > main{
  flex:1 1 0%;
  min-height:0;
}


/* ---------- TOP BAR + NAV ---------- */

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.brand-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.98;
  display: inline-flex;
  align-items: center;
  gap: 16px;
}

.brand-title span.logo {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  background: radial-gradient(circle at 20% 0, #ffd6f1, #ff008c);
  box-shadow:
    0 0 26px rgba(255, 0, 140, 0.9),
    0 0 0 1px rgba(0, 0, 0, 0.7);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.brand-title span.logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}

.brand-title span.mark {
  color: #ff6fc9;
}

.brand-sub {
  font-size: 13px;
  color: #b6b6c7;
  letter-spacing: 0.22em;
}

.top-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.top-right-text {
  font-size: 12px;
  color: #b4b4b8;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  white-space: nowrap;
}

.lang-switch {
  display: inline-flex;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.lang-btn {
  border: none;
  background: transparent;
  padding: 5px 13px;
  font-size: 12px;
  color: #c2c2d0;
  cursor: pointer;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.lang-btn--active {
  background: linear-gradient(120deg, #ff62c5, #ff008c);
  color: #07040a;
}

.nav-bar {
  margin-top: 10px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.nav-links {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-link {
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #c6c6d5;
  background: rgba(255, 255, 255, 0.03);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-decoration: none;
}

.nav-link:hover {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  box-shadow: 0 0 0 1px rgba(255, 0, 140, 0.25);
}

.nav-link span.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 20% 0, #ffd6f1, #ff008c);
}

.nav-link--ghost span.dot {
  background: radial-gradient(circle at 20% 0, #d0f3ff, #00b4ff);
}

.nav-link--active {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  box-shadow: 0 0 0 1px rgba(255, 0, 140, 0.45);
}

.nav-secondary {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.btn-outline {
  border-radius: 999px;
  padding: 7px 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.03);
  font-size: 13px;
  color: #f5f5ff;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  white-space: nowrap;
}

.btn-outline:hover {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  box-shadow: 0 0 0 1px rgba(255, 0, 140, 0.25);
}

.btn-outline--active {
  border-color: rgba(255, 0, 140, 0.7);
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  box-shadow: 0 0 0 1px rgba(255, 0, 140, 0.45);
}

.user-pill--active {
  border-color: rgba(255, 0, 140, 0.7);
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(255, 0, 140, 0.2);
}

.btn-primary {
  border-radius: 999px;
  padding: 8px 18px;
  border: none;
  background: linear-gradient(120deg, #ff62c5, #ff008c);
  font-size: 14px;
  color: #fff;
  font-weight: 550;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow:
    0 0 20px rgba(255, 0, 140, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: box-shadow 0.15s, transform 0.12s;
}
.btn-primary:hover {
  box-shadow: 0 0 28px rgba(255, 0, 140, 0.55), 0 0 0 1px rgba(255,255,255,0.10);
  transform: translateY(-1px);
}

.btn-primary span.icon {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.accent {
  background: linear-gradient(120deg, #ff62c5, #ffcf4b);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.projects-list .project-card {
  margin-bottom: 9px;
}
.projects-list .project-card:last-child {
  margin-bottom: 0;
}

/* ---------- Tablet: horizontal-scroll nav ---------- */
@media (max-width: 1200px) {
  .nav-bar {
    gap: 6px;
    flex-wrap: nowrap;
    overflow: visible;
  }
  .nav-links {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;          /* Firefox */
    -ms-overflow-style: none;
    padding-bottom: 2px;            /* prevent cut-off focus ring */
    min-width: 0;                   /* allow shrink inside flex */
  }
  .nav-links::-webkit-scrollbar { display: none; }

  .nav-link.nav-link--compact {
    padding: 6px 8px;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .nav-secondary {
    flex-wrap: nowrap;
    flex-shrink: 0;
  }
  .nav-secondary .btn-outline.btn-compact {
    padding: 5px 8px;
    font-size: 11px;
    white-space: nowrap;
  }
}

@media (max-width: 1024px) {
  /* Further compact: hide dot decorations, shrink brand */
  .nav-link span.dot { display: none; }
  .nav-link.nav-link--compact {
    padding: 5px 7px;
    font-size: 11px;
    gap: 0;
  }
  .brand-sub { display: none; }
  .brand-title { font-size: 18px; gap: 10px; }
  .brand-title span.logo { width: 36px; height: 36px; }
  .top-right-text { display: none; }
}

@media (max-width: 840px) {
  /* Stack nav rows vertically, each row scrolls horizontally */
  .nav-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .nav-links {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .nav-secondary {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    justify-content: flex-start;
  }
  .nav-secondary::-webkit-scrollbar { display: none; }
}

@media (max-width: 640px) {
  #app {
    padding: 12px 12px 0;
  }
  .shell {
    padding: 0 0 12px;
  }

  .nav-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav-secondary {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .top-right {
    justify-content: space-between;
    width: 100%;
  }
}

/* ---------- PLACEHOLDER SECTIONS ---------- */

.placeholder {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 0;
}

.placeholder-card {
  width: min(680px, 100%);
  border-radius: 28px;
  padding: 36px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background:
    radial-gradient(circle at 0 0, rgba(255, 0, 140, 0.18), transparent 55%),
    radial-gradient(circle at 100% 100%, rgba(0, 180, 255, 0.12), transparent 60%),
    rgba(7, 6, 12, 0.9);
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.8),
    0 0 0 1px rgba(255, 255, 255, 0.04);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.placeholder-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #ffe2ff;
}

.placeholder-title {
  font-size: clamp(28px, 5vw, 40px);
  line-height: 1.2;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.placeholder-desc {
  margin: 0;
  font-size: 16px;
  color: #dcdcec;
  line-height: 1.5;
}

.placeholder-note {
  margin: 0;
  font-size: 14px;
  color: #b6b6c7;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media (max-width: 640px) {
  .placeholder-card {
    padding: 26px;
  }
}

/* === AIDC FOUC FIX: opacity reveal === */
#app {
  opacity: 0;
  transition: opacity 0.2s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.aidc-ready #app {
  opacity: 1;
}

.no-js #app {
  opacity: 1;
}

#app > main {
  flex: 1 1 0%;
  min-height: 0;
}

#app > .shell {
  flex: 1 1 0%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#app > .shell > main {
  flex: 1 1 0%;
  min-height: 0;
}

/* Account pages: body-level scroll, not main overflow */
#app > .shell > main.account-layout { overflow: visible !important; min-height: auto; }
.account-layout .panel { height: auto; overflow: visible; display: block; }

/* [v1.9.58] Bulletproof фикс пустой полосы под футером на account-страницах
   и любых других, где flex-grow цепочка #app→.shell→main растягивается
   некорректно (например main — CSS grid с min-height:auto override).
   Гарантируем минимальную высоту .shell = весь viewport за вычетом нулевой
   шапки/подвала; footer внутри .shell имеет margin-top:auto и физически
   прижимается к низу через flex column. Не зависит от flex-grow,
   не ломает скролл длинного контента, не требует position:fixed. */
body[data-page] > #app > .shell { min-height: 100vh; }

/* [v1.9.59] Окончательное решение прижатия подвала на account-страницах.
   Flex-grow цепочка ломается из-за `min-height:auto` overide на main.account-layout
   (CSS grid item внутри flex column не всегда растягивается до flex:1).
   Переключаем .shell с flex column на CSS GRID с явными строками
   `auto 1fr auto` (header / main / footer-wrapper). 1fr ГАРАНТИРОВАННО
   занимает всё свободное место → footer-wrapper приклеен к низу .shell,
   которая в свою очередь = 100vh. Применяется только к страницам
   с main.account-layout через :has() (Chrome 105+, Safari 15.4+, FF 121+). */
.shell:has(> main.account-layout) {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
}
.shell:has(> main.account-layout) > main.account-layout {
  /* Внутри grid-row=1fr main-grid сам решает свою высоту */
  align-self: stretch;
}

/* [v1.9.66] Растягиваем sidebar и content секцию до низа viewport.
   account-layout — CSS grid (240px / 1fr). По умолчанию его дочерние
   элементы получают `align-self: stretch` и занимают всю высоту row.
   Но `.account-layout .panel` имеет глобальный override `height: auto`,
   который ломает stretch → колонки коллапсируют по контенту, оставляя
   пустое тёмное пространство справа от sidebar до футера. Возвращаем
   stretch явно и подсветим background sidebar до конца. */
.shell:has(> main.account-layout) > main.account-layout {
  align-items: stretch;
}
.shell:has(> main.account-layout) > main.account-layout > .panel,
.shell:has(> main.account-layout) > main.account-layout > section.panel,
.shell:has(> main.account-layout) > main.account-layout > aside.panel {
  height: auto;
  min-height: 100%;
  align-self: stretch;
}

/* Editor page: narrower center column → fit sidebar width exactly */
.page-editor .aidc-layout { --col-center: 290px; }
.page-editor .aidc-editor-inner { display: block; }

.footer {
  margin-top: auto;
  padding: 8px 18px 12px;
  font-size: 10px;
  line-height: 1.3;
  color: #6f7084;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.footer__main {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.footer__right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-left: auto;
}
.footer__legal {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.footer__legal a {
  color: #8b9dff;
  text-decoration: underline;
  text-decoration-color: rgba(139,157,255,.35);
  text-underline-offset: 2px;
  transition: color .2s, text-decoration-color .2s;
}
.footer__legal a:hover { color: #ff62c5; text-decoration-color: #ff62c5; }
.footer__phone { white-space: nowrap; }
.footer__phone a {
  color: #8b9dff;
  text-decoration: none;
  transition: color .2s;
}
.footer__phone a:hover { color: #ff62c5; }
.footer__company { opacity: .7; white-space: nowrap; }
.footer__bottom { opacity: .7; }
@media (max-width: 600px) {
  .footer { flex-direction: column; align-items: center; text-align: center; gap: 4px; }
  .footer__right { margin-left: 0; justify-content: center; }
}
/* ===== AIDC custom select (replaces native <select>) ===== */

/* Portal root — must float above ALL overlays/modals */
#aidc-dialog-root{
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 0;
  z-index: 200000; /* above CRM modal overlay (100000) */
  pointer-events: none;
}
#aidc-dialog-root > *{
  pointer-events: auto;
}

.aidc-select{
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 100%;
}
.aidc-select__native{
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  opacity: 0 !important;
  pointer-events: none !important; /* prevent mobile system sheet */
}
.aidc-select__btn{
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(18,19,28,0.96);
  color: #e8ebff;
  cursor: pointer;
  font: inherit;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.aidc-select__btn::after{
  content: "▾";
  opacity: 0.75;
}
.aidc-select.is-open .aidc-select__btn{
  border-color: rgba(0,180,255,0.55);
  box-shadow: 0 0 0 2px rgba(0,180,255,0.15);
}
.aidc-select__menu{
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  display: none;
  max-height: 280px;
  overflow: auto;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  background: var(--aidc-bg-overlay);
  box-shadow: 0 18px 48px rgba(0,0,0,0.6);
  z-index: 200000;  /* above CRM modal overlay (100000) */
  padding: 6px;
}
.aidc-select.is-open .aidc-select__menu{ display: block; }
.aidc-select__option{
  width: 100%;
  text-align: left;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: #e8ebff;
  cursor: pointer;
  font: inherit;
  white-space: nowrap;
}
.aidc-select__option:hover{
  border-color: rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
}
.aidc-select__option.is-selected{
  border-color: rgba(255,0,140,0.30);
  background: rgba(255,0,140,0.10);
}
.aidc-select__option:disabled{
  opacity: 0.45;
  cursor: not-allowed;
}
.aidc-select__group-label{
  padding: 8px 10px 4px;
  font-size: 0.78em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(232,235,255,0.45);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}
.aidc-select__group-arrow{
  font-size: 0.85em;
  color: rgba(232,235,255,0.35);
  width: 12px;
  text-align: center;
  flex-shrink: 0;
}
.aidc-select__group-items.is-collapsed{
  display: none;
}
.aidc-select__option--grouped{
  padding-left: 24px;
}
.aidc-select__option-icon{
  display: inline-flex;
  align-items: center;
  margin-right: 6px;
  opacity: 0.65;
  flex-shrink: 0;
}

/* Number input spinners — dark theme */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button{
  -webkit-appearance: inner-spin-button;
  opacity: 1;
  filter: invert(0.85) hue-rotate(180deg);
}

/* ═══════════════════════════════════════════════════════════════════════════
   AIDC Theme Overrides — MUST be at the bottom to win cascade.
   ═══════════════════════════════════════════════════════════════════════════ */
html {
  background: var(--aidc-bg-base) !important;
}
body {
  background: var(--aidc-bg-base) !important;
  color: var(--aidc-text-primary);
}
.panel {
  background: var(--aidc-bg-surface) !important;
}
.aidc-confirm__panel {
  background: linear-gradient(180deg, var(--aidc-bg-dialog-from) 0%, var(--aidc-bg-dialog-to) 100%) !important;
}
.date-range-popover,
.cal-grid {
  background: var(--aidc-bg-elevated) !important;
}
.aidc-select__menu {
  background: var(--aidc-bg-overlay) !important;
}
.folder-card {
  background: linear-gradient(90deg, var(--aidc-bg-folder) 60%, var(--aidc-bg-folder) 100%) !important;
}
.refp-tpl-picker__card,
.rv2-detail-modal,
.aidc-modal__panel {
  background: var(--aidc-bg-card) !important;
}
.rv2-icon-btn[data-tooltip]::after,
.prompt-tpl-card__icon-btn[data-tooltip]::after {
  background: var(--aidc-bg-overlay) !important;
}
.rv2-card__doc-ext {
  background: var(--aidc-bg-surface) !important;
}
.tg-feed-card,
.tg-feed-card__skeleton,
.tg-feed-card__grid-cell {
  background: var(--aidc-bg-surface) !important;
}
