* { margin: 0; padding: 0; box-sizing: border-box; }
/* скроллбары под тёмную тему (а не белые системные) */
* { scrollbar-width: thin; scrollbar-color: #2b2e40 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2b2e40; border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #3a3e54; background-clip: padding-box; border: 2px solid transparent; }
::-webkit-scrollbar-corner { background: transparent; }

/* ── ICONS ── */
.ic { display: inline-flex; align-items: center; justify-content: center; line-height: 0; flex-shrink: 0; vertical-align: middle; }
.ic svg { width: 1em; height: 1em; display: block; }
.sub-head .ic { color: var(--accent); width: 32px; height: 32px; border-radius: 10px; background: var(--accent-soft); border: 1px solid var(--glass-brd); }
.sub-head .ic svg { width: 16px; height: 16px; }
.page-header h1 { display: flex; align-items: center; gap: 14px; }
/* иконка заголовка в чипе (как в рефах — иконка всегда в контейнере) */
.page-header h1 .ic { color: var(--accent); width: 44px; height: 44px; border-radius: 14px;
  background: var(--accent-soft); border: 1px solid var(--glass-brd); }
.page-header h1 .ic svg { width: 22px; height: 22px; }
.card-title { display: inline-flex; align-items: center; gap: 9px; }
/* иконка в шапке карточки — мини-чип (ТОЛЬКО прямой потомок: не трогаем иконки в кнопках) */
.card-title > .ic { color: var(--accent); width: 30px; height: 30px; border-radius: 9px;
  background: var(--accent-soft); border: 1px solid var(--glass-brd); }
.card-title > .ic svg { width: 16px; height: 16px; }
/* кнопка обновления в шапке карточки — чёткая, видна издалека, с отступом */
.st-refresh-btn { margin-left: 12px; width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: 9px; background: var(--bg2); border: 1px solid var(--border); color: var(--muted); cursor: pointer; transition: color .12s, border-color .12s, background .12s; flex-shrink: 0; }
.st-refresh-btn:hover { color: var(--accent); border-color: var(--accent-glow); background: var(--accent-soft); }
.st-refresh-btn .ic svg { width: 17px; height: 17px; }
.spark-head .spark-ic { color: var(--accent); display: inline-flex; }
.spark-head .spark-ic svg { width: 16px; height: 16px; }
.toggle-label .ic { color: var(--silver-hi); width: 40px; height: 40px; min-width: 40px; border-radius: 12px; background: var(--surface2); border: 1px solid var(--border); }
.toggle-label .ic svg { width: 21px; height: 21px; }
.tl-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.btn .ic svg { width: 14px; height: 14px; }
/* кастомные ползунки (не дешёвые нативные): тонкий трек + заливка + крупный thumb */
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 999px; background: var(--surface2); cursor: pointer; outline: none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 17px; height: 17px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); box-shadow: 0 2px 6px rgba(0,0,0,.5); cursor: pointer; transition: transform .1s, box-shadow .1s; margin-top: 0; }
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.15); box-shadow: 0 2px 10px var(--accent-glow); }
input[type=range]::-webkit-slider-thumb:active { transform: scale(1.05); }
input[type=range]::-moz-range-thumb { width: 17px; height: 17px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); box-shadow: 0 2px 6px rgba(0,0,0,.5); cursor: pointer; }
input[type=range]::-moz-range-track { height: 6px; border-radius: 999px; background: transparent; }
input[type=range]::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--accent); }
input[type=color] { accent-color: var(--accent); }

/* ── THEME VARIABLES ── */
:root {
  /* ── Nord-cyberpunk: сланцевый фон, розовый primary + серебро secondary ── */
  --bg: #0b0d14;
  --bg2: #11131d;
  --surface: #161823;
  --surface2: #1c1e2b;
  --border: #242635;
  --hover: #1a1c28;
  --text: #e9ebf3;
  --muted: #69708a;
  /* пыльная роза — главный акцент: CTA, активное, выделение (менее насыщенный) */
  --accent: #d295a7;
  --accent2: #bd7d93;
  --accent-soft: rgba(210,149,167,.12);
  --accent-glow: rgba(210,149,167,.38);
  /* серебро — вторичный акцент: иконки, чипы, вторичные кнопки, info */
  --silver: #aebbd2;
  --silver-hi: #cdd7ec;
  --silver-soft: rgba(174,187,210,.12);
  --glass: #11131d;
  --glass-strong: #0c0e16;
  --glass-brd: #242635;
  --glass-hi: #181a26;
  --shadow: 0 2px 28px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.025);
  --sheen: linear-gradient(157deg, rgba(255,255,255,.05), rgba(255,255,255,.01) 42%, rgba(255,255,255,0) 66%);
  --inset-hi: inset 0 1px 0 rgba(255,255,255,.05), inset 0 0 0 1px rgba(255,255,255,.01);
  /* единая шкала скруглений */
  --r-xs: 8px; --r-sm: 10px; --r-md: 13px; --r-lg: 18px; --r-xl: 22px; --r-pill: 999px;
}
/* табличные цифры для всех числовых значений (выравнивание как в рефах) */
.metric-value, .stat-value, .spark-val, .gauge-detail, .gauge-name, .server-info b, .st-tl-time, .metric-value.text { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1, "cv01" 1; }
body.light {
  --bg: #f4f5f9;
  --bg2: #eceef4;
  --surface: #ffffff;
  --surface2: #f7f8fb;
  --border: #e5e7ee;
  --hover: #eef0f6;
  --text: #15151c;
  --muted: #6b7280;
  --accent: #d2628a;
  --accent2: #b84c73;
  --accent-soft: rgba(210,98,138,.12);
  --accent-glow: rgba(210,98,138,.35);
  --silver: #5b6b86;
  --silver-hi: #3f4d63;
  --silver-soft: rgba(91,107,134,.12);
  --glass: #ffffff;
  --glass-strong: #ffffff;
  --glass-brd: #e5e7ee;
  --glass-hi: #f0f1f6;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 16px 40px -28px rgba(120,60,90,.22);
  --sheen: linear-gradient(157deg, rgba(255,255,255,.6), rgba(255,255,255,.2) 40%, rgba(255,255,255,0) 65%);
  --inset-hi: inset 0 1px 0 rgba(255,255,255,.8);
}

body { font-family: 'Inter', system-ui, sans-serif; color: var(--text); height: 100vh; display: flex; overflow: hidden; transition: background .2s, color .2s;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; letter-spacing: -.01em;
  gap: 14px; padding: 18px;
  background:
    radial-gradient(circle at 0% 0%, rgba(214,150,170,.38), transparent 30%),
    radial-gradient(circle at 100% 0%, rgba(176,190,214,.30), transparent 32%),
    radial-gradient(circle at 100% 100%, rgba(214,150,170,.26), transparent 36%),
    radial-gradient(circle at 0% 100%, rgba(150,158,190,.24), transparent 36%),
    #08090f;
  background-attachment: fixed; }
body.light {
  background:
    radial-gradient(ellipse 800px 500px at 92% 5%, rgba(230,131,164,.07), transparent 55%),
    var(--bg);
  background-attachment: fixed; }

/* ── HEALTH LIGHT (светофор) ── */
.health-light { display: inline-flex; align-items: center; gap: 8px; }
.health-dot { width: 14px; height: 14px; border-radius: 50%; }
.hl-green  { background: #22c55e; box-shadow: 0 0 10px #22c55e; }
.hl-yellow { background: #f59e0b; box-shadow: 0 0 10px #f59e0b; }
.hl-red    { background: #ef4444; box-shadow: 0 0 10px #ef4444; animation: pulse-red 1.2s infinite; }
@keyframes pulse-red { 0%,100%{opacity:1} 50%{opacity:.4} }
.health-err { font-size: 11px; color: #64748b; }

/* ── CHARTS ── */
.chart-box { margin-top: 4px; }
.chart-canvas { width: 100%; height: 120px; display: block; }
.chart-legend { display: flex; gap: 14px; font-size: 11px; color: #64748b; margin-bottom: 8px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.chart-legend i { width: 10px; height: 3px; border-radius: 2px; display: inline-block; }

/* ── DEPLOY HISTORY ── */
.dh-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--hover); font-size: 12px; }
.dh-row:last-child { border-bottom: none; }
.dh-hash { font-family: monospace; color: var(--accent); background: var(--accent-soft); padding: 1px 6px; border-radius: 4px; font-size: 11px; }
.dh-msg { flex: 1; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dh-time { color: #475569; font-size: 11px; white-space: nowrap; }

/* ── TOGGLES (уведомления) ── */
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--hover); }
.toggle-row:last-child { border-bottom: none; }
.toggle-label { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 12px; }
.toggle-label small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 0; font-weight: 500; }
.switch { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: var(--surface2); border: 1px solid var(--border); border-radius: 999px; cursor: pointer; transition: background .2s, border-color .2s; }
.slider:before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #eef0f6; border-radius: 50%; transition: transform .2s; box-shadow: 0 2px 5px rgba(0,0,0,.45); }
.switch input:checked + .slider { background: linear-gradient(135deg, var(--accent), var(--accent2)); border-color: transparent; }
.switch input:checked + .slider:before { transform: translateX(18px); background: #fff; }
.threshold-input { width: 60px; background: var(--bg2); border: 1px solid var(--border); color: var(--text); border-radius: 11px; padding: 7px 11px; font-size: 12px; }

/* ── LAUNCHER CARDS ── */
.launch-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.launch-card { position: relative; container-type: inline-size; overflow: hidden;
  background: var(--sheen), rgba(24,26,38,.92);
  border: 1px solid rgba(255,255,255,.055); border-radius: 22px; padding: 22px; box-shadow: 0 4px 30px -6px rgba(0,0,0,.45), var(--inset-hi);
  display: flex; flex-direction: column; gap: 14px;
  transition: border-color .15s, box-shadow .15s, background .15s; }
.launch-card:hover { border-color: var(--accent-glow); box-shadow: 0 0 0 1px var(--accent-soft), 0 14px 36px -18px rgba(0,0,0,.6), var(--inset-hi); }
.launch-card.is-down { opacity: .82; }

.launch-top { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.launch-iconbox { width: 48px; height: 48px; min-width: 48px; display: flex; align-items: center; justify-content: center;
  border-radius: 14px; border: 1px solid var(--glass-brd); color: var(--silver-hi);
  background: linear-gradient(135deg, rgba(174,187,210,.16), rgba(174,187,210,.02)); box-shadow: var(--inset-hi); }
.launch-iconbox .ic svg { width: 24px; height: 24px; }
.launch-card.is-down .launch-iconbox { background: linear-gradient(135deg, rgba(239,68,68,.16), rgba(239,68,68,.03)); filter: grayscale(.4); }
.launch-info { flex: 1; min-width: 0; }
.launch-name { font-size: 15px; font-weight: 700; line-height: 1.2; white-space: normal; overflow-wrap: anywhere; word-break: normal; }
.svc-main { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; padding: 8px 12px; background: var(--bg2); border: 1px solid var(--border); border-radius: 11px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.launch-unit { display: none; }
.launch-sub { font-size: 11px; color: #475569; margin-top: 3px; }
.launch-statusrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 2px; }

.launch-actions { display: flex; gap: 8px; margin-top: 2px; flex-wrap: wrap; }
.launch-actions .btn { flex: 1 1 0; text-align: center; min-width: 60px; height: 36px; padding: 0 12px; font-size: 12px; white-space: nowrap; }
.launch-actions .btn .ic svg { width: 13px; height: 13px; }
.launch-actions .btn-wide { flex: 1 1 100%; }
.card-chevron { color: var(--muted); transition: transform .2s; margin-left: 4px; flex-shrink: 0; }
.card-chevron svg { width: 16px; height: 16px; }
.card-chevron.open { transform: rotate(180deg); color: var(--accent); }
.card-details { margin-top: 2px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 12px; color: #94a3b8; }
.card-details .di-row { display: flex; justify-content: space-between; padding: 4px 0; }
.card-details .di-row b { color: var(--text); font-weight: 600; }
.vpn-qr-img { width: 100%; max-width: 200px; border-radius: 8px; background: #fff; padding: 6px; display: block; margin: 10px auto 0; }
.launch-url-edit { font-size: 11px; color: #475569; cursor: pointer; text-align: center; margin-top: 2px; }
.launch-url-edit:hover { color: var(--accent); }

/* ── STATUS BADGE (точка + слово, схлопывается до точки) ── */
.status-badge { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 500; padding: 3px 10px; border-radius: 20px; white-space: nowrap; }
.status-badge .sdot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.svc-toggle { margin-left: 4px; }
.sb-green { background: #052e16; color: #22c55e; }
.sb-green .sdot { background: #22c55e; box-shadow: 0 0 6px #22c55e; }
.sb-red { background: #2d0a0a; color: #ef4444; }
.sb-red .sdot { background: #ef4444; box-shadow: 0 0 6px #ef4444; animation: pulse-red 1.4s infinite; }
@container (max-width: 280px) {
  .status-badge { padding: 5px; gap: 0; }
  .status-badge .stext { display: none; }
  .launch-unit { display: none; }
}

/* ── SUB-HEADING (для VPN внутри Сервисов и т.п.) ── */
.sub-head { font-size: 16px; font-weight: 600; margin: 12px 0 16px; display: flex; align-items: center; gap: 13px; }
.sub-head small { font-size: 12px; color: var(--muted); font-weight: 400; }

/* ── THEME TOGGLE BTN ── */
.theme-btn { display: flex; align-items: center; justify-content: center; gap: 8px; background: var(--surface); border: 1px solid var(--glass-brd); color: var(--muted); padding: 10px 12px; border-radius: 13px; font-size: 12px; font-weight: 600; cursor: pointer; width: 100%; transition: all .15s; }
.theme-btn:hover { background: var(--hover); color: var(--text); border-color: var(--accent); }
.theme-btn .ic svg { width: 15px; height: 15px; }
.logout-btn { color: #f87171; }
.logout-btn:hover { background: rgba(239,68,68,.10); color: #f87171; border-color: rgba(239,68,68,.4); }

/* ── SIDEBAR ── */
.sidebar { width: 78px; min-width: 78px; background: rgba(14,16,24,.72); backdrop-filter: blur(26px) saturate(1.2); -webkit-backdrop-filter: blur(26px) saturate(1.2); border: 1px solid rgba(255,255,255,.06); border-radius: 26px; display: flex; flex-direction: column; align-items: center; padding: 18px 0; box-shadow: 0 8px 40px -12px rgba(0,0,0,.5); position: relative; z-index: 30; }
.logo { padding: 0 0 16px; display: flex; align-items: center; justify-content: center; gap: 12px; border-bottom: 1px solid rgba(255,255,255,.06); margin-bottom: 14px; width: 46px; }
.logo-txt { display: none; }
.logo-mark { width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow: 0 6px 16px -6px rgba(230,131,164,.7), var(--inset-hi); }
.logo-mark .ic svg { width: 20px; height: 20px; }
.logo-txt { display: none; }
.logo-txt b { font-size: 16px; font-weight: 800; letter-spacing: -.2px; color: var(--text); }
.logo-txt small { font-size: 11px; color: var(--muted); font-weight: 500; }
/* рейл: круглые иконки-кнопки, подписи скрыты (тултип по title) */
.nav-item { font-size: 0; display: flex; align-items: center; justify-content: center; margin: 5px 0; padding: 0; color: var(--muted); cursor: pointer; position: relative; }
.nav-item .icon { width: 46px; height: 46px; min-width: 46px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--surface2); border: 1px solid rgba(255,255,255,.06); color: var(--muted); transition: background .15s, color .15s, border-color .15s, box-shadow .15s; }
.nav-item .icon svg { width: 19px; height: 19px; }
.nav-item:hover .icon { color: var(--text); border-color: rgba(255,255,255,.14); background: var(--hover); }
.nav-item.active .icon { background: linear-gradient(135deg, var(--accent), var(--accent2)); border-color: transparent; color: #fff; box-shadow: 0 8px 18px -6px var(--accent-glow); }
/* тултип названия по наведению */
.nav-item::after { content: attr(data-label); position: absolute; left: 60px; top: 50%; transform: translateY(-50%) translateX(-4px); background: rgba(14,16,24,.96); color: var(--text); font-size: 12px; font-weight: 500; padding: 6px 11px; border-radius: 9px; border: 1px solid rgba(255,255,255,.08); white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .14s, transform .14s; z-index: 50; box-shadow: 0 8px 22px -8px rgba(0,0,0,.7); }
.nav-item:hover::after { opacity: 1; transform: translateY(-50%) translateX(0); }
.sidebar-footer { margin-top: auto; padding: 14px 0 2px; border-top: 1px solid rgba(255,255,255,.06); display: flex; flex-direction: column; align-items: center; gap: 10px; width: 46px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; display: inline-block; margin-right: 6px; box-shadow: 0 0 6px #22c55e88; }
/* рейл: статус-сервера = круглый чип только с точкой */
.server-chip { display: flex; align-items: center; justify-content: center; width: 46px; height: 46px; border-radius: 50%;
  background: var(--surface2); border: 1px solid rgba(255,255,255,.06); position: relative; cursor: default; }
.server-dot { width: 9px; height: 9px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 8px #22c55e; flex-shrink: 0; }
.server-info { display: none; }
.sidebar-footer .theme-btn { font-size: 0; gap: 0; width: 46px; height: 46px; padding: 0; border-radius: 50%; justify-content: center; align-items: center; }
.sidebar-footer .theme-btn .ic { margin: 0; }
.sidebar-footer .theme-btn .ic svg { width: 18px; height: 18px; }
/* тултип IP/названия на круглых элементах рейла */
.server-chip[data-label]::after, .sidebar-footer .theme-btn[data-label]::after { content: attr(data-label); position: absolute; left: 58px; top: 50%; transform: translateY(-50%) translateX(-4px); background: rgba(14,16,24,.96); color: var(--text); font-size: 12px; font-weight: 500; padding: 6px 11px; border-radius: 9px; border: 1px solid rgba(255,255,255,.08); white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .14s, transform .14s; z-index: 50; box-shadow: 0 8px 22px -8px rgba(0,0,0,.7); }
.server-chip:hover::after, .sidebar-footer .theme-btn:hover::after { opacity: 1; transform: translateY(-50%) translateX(0); }
.server-info b { font-size: 12px; font-weight: 700; font-family: 'JetBrains Mono','Consolas',monospace; color: var(--text); }
.server-info small { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── MAIN (плавающая панель на градиенте) ── */
.main { flex: 1; overflow-y: auto; padding: 34px 38px; display: flex; flex-direction: column; gap: 30px; border-radius: 26px; background: rgba(11,12,20,.86); border: 1px solid rgba(255,255,255,.06); box-shadow: 0 8px 44px -14px rgba(0,0,0,.55); }
body.light .main { background: rgba(255,255,255,.7); }
.page-header h1 { font-size: 32px; font-weight: 700; letter-spacing: -1px; line-height: 1.1; }
.page-header p { font-size: 13px; color: var(--muted); margin-top: 6px; }
/* круглые иконочные кнопки в хедере (как в рефах справа сверху) */
.hdr-actions { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.icon-btn { width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--surface); border: 1px solid var(--glass-brd); color: var(--muted); cursor: pointer; transition: color .15s, border-color .15s, background .15s; flex-shrink: 0; }
.icon-btn:hover { color: var(--accent); border-color: var(--accent-glow); background: var(--accent-soft); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.spinning svg { animation: spin .7s linear; }

/* ── CARDS (тёмное + серебристый отблеск) ── */
.card { background: var(--sheen), rgba(24,26,38,.92); border: 1px solid rgba(255,255,255,.055); border-radius: 24px; padding: 26px; box-shadow: 0 4px 30px -6px rgba(0,0,0,.45), var(--inset-hi); }
body.light .card { background: var(--sheen), var(--surface); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.card-title { font-size: 15.5px; font-weight: 600; color: var(--text); letter-spacing: -.2px; }

/* ── HERO METRIC CARDS (как в референсах) ── */
.hero-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 16px; }
/* настраиваемая Главная (блоки) */
.home-edit-btn { margin-left: auto; background: var(--bg2); border: 1px solid var(--border); border-radius: 11px; color: var(--muted); padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; transition: all .12s; }
.home-edit-btn:hover, .home-edit-btn.on { border-color: var(--accent); color: var(--accent); }
.page-header { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
/* Grid: одинаковые колонки во всех рядах -> все метрики одного размера */
#home-blocks { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 16px; align-items: start; }
.home-block { position: relative; min-width: 0; }
.home-block.w-metric { grid-column: span 1; }
.home-block.w-metric .metric-card { height: 252px; justify-content: space-between; overflow: hidden; }
.home-block.w-svc { grid-column: span 2; }
.home-block.w-wide { grid-column: 1 / -1; }
/* старая «шапка-ручка» больше не используется — тянем сам блок (как иконки на айфоне) */
.home-bar { display: none !important; }
/* угловой крестик удаления (виден только в режиме настройки) */
.home-x-badge { position: absolute; top: -9px; left: -9px; width: 26px; height: 26px; border-radius: 50%;
  background: #ef4444; color: #fff; border: 2px solid var(--bg); display: none; align-items: center; justify-content: center;
  cursor: pointer; font-size: 15px; line-height: 1; z-index: 6; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.home-x-badge:hover { background: #dc2626; }
#home-blocks.editing .home-x-badge { display: flex; }
#home-blocks.editing .home-block { animation: home-jiggle .32s ease-in-out infinite alternate; cursor: grab; touch-action: none; }
#home-blocks.editing .home-block:active { cursor: grabbing; }
#home-blocks.editing .home-block:nth-child(even) { animation-delay: .12s; }
#home-blocks.editing .home-block * { pointer-events: none; }
#home-blocks.editing .home-block .home-x-badge { pointer-events: auto; }
.home-block.dragging { animation: none !important; z-index: 60; pointer-events: none; opacity: .97;
  transform: scale(1.03) rotate(-1deg); box-shadow: 0 24px 60px -14px rgba(0,0,0,.7); }
.home-block.home-ph { animation: none !important; border: 2px dashed var(--accent); border-radius: 18px;
  background: rgba(230,131,164,.08); box-sizing: border-box; }
.home-block.home-ph * { display: none; }
/* виджет логов на главной */
.home-logs { font-family: 'JetBrains Mono','Consolas',monospace; font-size: 11px; line-height: 1.5; max-height: 220px; overflow: auto; color: #94a3b8; background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; white-space: pre-wrap; word-break: break-word; }
.home-logs-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.home-logs-head select { background: var(--bg2); border: 1px solid var(--border); color: var(--text); border-radius: 9px; padding: 6px 10px; font-size: 12px; font-family: inherit; }
/* пикер «Добавить блок» с превью */
.pk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pk-tile { border: 1px solid var(--border); border-radius: 14px; background: var(--bg2); cursor: pointer; overflow: hidden; text-align: left; padding: 0; font-family: inherit; transition: border-color .12s, transform .12s; }
.pk-tile:hover { border-color: var(--accent); transform: translateY(-2px); }
.pk-prev { height: 86px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 8px 10px; }
.pk-cap { padding: 9px 11px; font-size: 12.5px; font-weight: 600; color: var(--text); display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.pk-cap .pk-plus { color: var(--accent); font-weight: 700; }
.pk-tile.pk-action { grid-column: 1 / -1; }
.pk-tile.pk-action .pk-prev { display: none; }
.pk-mini-svc { display: flex; align-items: center; gap: 8px; width: 100%; }
.pk-mini-svc .pk-ic { width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(135deg, rgba(174,187,210,.18), rgba(174,187,210,.03)); display: flex; align-items: center; justify-content: center; color: var(--silver-hi); }
.pk-mini-svc .pk-ic svg { width: 15px; height: 15px; }
.pk-mini-dot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 6px #22c55e; }
.pk-skel { width: 100%; display: flex; flex-direction: column; gap: 5px; }
.pk-skel i { height: 7px; border-radius: 4px; background: linear-gradient(90deg, var(--border), rgba(148,163,184,.25)); display: block; }
@keyframes home-jiggle { from { transform: rotate(-.35deg); } to { transform: rotate(.35deg); } }
.home-addrow { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 4px; }
.home-add { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; border: none; border-radius: 11px; padding: 10px 18px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; }
.home-edit-hint { font-size: 11px; color: var(--muted); }
.home-shortcut { display: flex; align-items: center; gap: 14px; cursor: pointer; transition: border-color .12s, transform .12s; }
.home-shortcut:hover { border-color: var(--accent); transform: translateY(-2px); }
.metric-card { display: flex; flex-direction: column; padding: 26px 28px 30px; }
.metric-top { display: flex; align-items: center; gap: 11px; margin-bottom: 4px; }
.metric-ic { width: 40px; height: 40px; min-width: 40px; display: flex; align-items: center; justify-content: center; border-radius: 12px; background: var(--surface2); border: 1px solid var(--border); color: var(--silver-hi); }
.metric-ic svg { width: 20px; height: 20px; }
.metric-label { font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: .1px; }
.metric-value { font-size: 46px; font-weight: 700; letter-spacing: -2px; line-height: 1; margin: 18px 0 10px; display: flex; align-items: center; gap: 10px; font-variant-numeric: tabular-nums; }
.metric-value.green { color: #22c55e; }
.metric-value.text { font-size: 24px; letter-spacing: -.4px; }
.metric-desc { font-size: 13px; color: var(--muted); }
.metric-link { margin-top: auto; padding-top: 18px; font-size: 13px; font-weight: 600; color: var(--silver-hi); cursor: pointer; align-self: flex-start; }
.metric-link:hover { color: var(--accent); }
.trend-up { color: #22c55e; font-size: 16px; }
.gauge-hero-wrap { display: flex; justify-content: center; margin: 4px 0 0; }
#gauge-hero-ram, #home-g-cpu, #home-g-disk { width: 100%; max-width: 178px; height: 92px; display: block; }

/* ── SPARKLINE METRIC CARDS ── */
.spark-card { padding: 20px 24px; }
.spark-head { font-size: 14px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.spark-head .spark-ic { font-size: 16px; opacity: .85; }
.spark-body { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; }
.spark-val { font-size: 34px; font-weight: 800; letter-spacing: -1px; line-height: 1; }
.spark-sub { font-size: 12px; color: var(--muted); margin-top: 7px; }
.spark-cv { flex: 1; min-width: 0; max-width: 56%; height: 50px; display: block; }

/* ── STAT ROW ── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.stat { background: var(--glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid var(--glass-brd); border-radius: 16px; padding: 18px; box-shadow: var(--shadow); transition: transform .15s, border-color .15s; }
.stat:hover { transform: translateY(-2px); border-color: rgba(230,131,164,.4); }
.stat-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; margin-bottom: 8px; }
.stat-value { font-size: 34px; font-weight: 700; margin-bottom: 8px; letter-spacing: -1.2px; font-variant-numeric: tabular-nums; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 20px; display: inline-flex; align-items: center; gap: 4px; }
.badge-green { background: #052e16; color: #22c55e; }
.badge-blue  { background: var(--silver-soft); color: var(--silver-hi); }
.badge-yellow{ background: #2d1b00; color: #f59e0b; }
.badge-red   { background: #2d0a0a; color: #ef4444; }
.badge-gray  { background: var(--border); color: #64748b; }

/* ── 2-COLUMN GRID ── */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ── SERVICES ── */
.svc-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--hover); }
.svc-row:last-child { border-bottom: none; }
.svc-name { flex: 1; font-size: 13px; font-weight: 500; }
.svc-meta { font-size: 11px; color: #475569; }
.svc-actions { display: flex; gap: 6px; }

/* ── BUTTONS ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 17px; border-radius: var(--r-pill); font-size: 12.5px; font-weight: 500; letter-spacing: .01em; cursor: pointer; border: none; transition: transform .12s, opacity .15s, box-shadow .15s, background .15s; text-decoration: none; }
.btn:hover { transform: translateY(-1px); opacity: .95; }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; box-shadow: 0 8px 18px -8px var(--accent-glow); }
.btn-ghost { background: var(--glass-hi); color: var(--text); border: 1px solid var(--glass-brd); }
.btn-ghost:hover { border-color: var(--accent); }
.btn-danger { background: rgba(239,68,68,.10); color: #f87171; border: 1px solid rgba(239,68,68,.25); }

/* ── RESOURCES ── */
.res-item { margin-bottom: 14px; }
.res-item:last-child { margin-bottom: 0; }
.res-label { display: flex; justify-content: space-between; font-size: 12px; color: #94a3b8; margin-bottom: 6px; }
.progress { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; transition: width .5s; }

/* ── GAUGES (радиальные) ── */
.gauges { display: flex; justify-content: space-around; gap: 8px; padding-top: 8px; }
.gauge-item { flex: 1; text-align: center; min-width: 0; }
.gauge-cv { width: 100%; max-width: 140px; height: 84px; display: block; margin: 0 auto; }
.gauge-name { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; margin-top: 2px; }
.gauge-detail { font-size: 11px; color: var(--muted); margin-top: 2px; white-space: nowrap; }

/* ── FILE MANAGER (визуальный диск) ── */
.fm-toolbar { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--glass-brd); flex-wrap: wrap; }
.fm-toolbar .btn { padding: 8px 12px; }
.fm-upstatus { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--accent); font-weight: 600; }
.spinner { width: 15px; height: 15px; border: 2px solid rgba(255,255,255,0.15); border-top-color: var(--accent); border-radius: 50%; display: inline-block; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.ag-chat { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.ag-hint { color: var(--muted); font-size: 13px; text-align: center; margin: auto; max-width: 420px; line-height: 1.6; }
.ag-msg { display: flex; gap: 11px; align-items: flex-start; max-width: 88%; }
.ag-msg.me { align-self: flex-end; flex-direction: row-reverse; }
.ag-av { width: 34px; height: 34px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 18px; background: var(--glass-hi); flex-shrink: 0; }
.ag-bubble { background: var(--bg2); border: 1px solid var(--border); border-radius: 14px; padding: 10px 14px; font-size: 14px; line-height: 1.55; white-space: pre-wrap; }
.ag-msg.me .ag-bubble { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; border: none; }
.ag-name { font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 3px; }
.ag-input { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--glass-brd); }
.ag-input textarea { flex: 1; background: var(--bg2); border: 1px solid var(--border); border-radius: 14px; color: var(--text); padding: 12px 14px; font-size: 14px; resize: none; font-family: inherit; max-height: 120px; }
.ag-input textarea:focus { outline: none; border-color: var(--accent); }
.ag-input .btn { padding: 0 18px; }
/* ── СТУДИЯ ── */
.studio-grid { display: grid; grid-template-columns: 1fr 1.15fr; gap: 14px; align-items: start; }
.studio-grid > * { min-width: 0; }   /* колонки держат пропорции 1.3fr/1fr независимо от контента (превью не «прыгает») */
@media (max-width: 900px) { .studio-grid { grid-template-columns: 1fr; } }
.studio-make .card-title, .studio-jobs .card-title { margin-bottom: 14px; }
.st-drop { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 90px; border: 2px dashed var(--glass-brd); border-radius: 16px; color: var(--muted); cursor: pointer; text-align: center; padding: 14px; margin-bottom: 16px; transition: all .15s; font-size: 13px; }
.st-drop:hover, .st-drop.drag { border-color: var(--accent); color: var(--text); background: var(--glass-hi); }
.st-field { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.st-lbl { width: 64px; font-size: 12px; color: var(--muted); flex-shrink: 0; }
.st-input { flex: 1; height: 40px; background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; color: var(--text); padding: 0 13px; font-size: 13px; font-family: inherit; }
.st-input:focus { outline: none; border-color: var(--accent); }
.st-seg { flex: 1; display: flex; gap: 6px; }
.st-seg button { flex: 1; height: 40px; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r-pill); color: var(--muted); padding: 0 10px; font-size: 12px; cursor: pointer; font-family: inherit; transition: all .12s; }
.st-seg button:hover { color: var(--text); }
.st-seg button.active { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent2)); border-color: transparent; }
.st-seg.seg-disabled { opacity: .4; pointer-events: none; }
.st-seg.st-seg-sm button { padding: 6px 6px; font-size: 11px; border-radius: 9px; }
.st-preset-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.st-preset-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--bg); border: 1px solid var(--border); border-radius: 9px; padding: 5px 8px; font-size: 12px; cursor: pointer; transition: border-color .12s; }
.st-preset-chip:hover { border-color: var(--accent); }
.st-preset-chip .px { color: var(--muted); cursor: pointer; font-weight: 700; padding: 0 2px; }
.st-preset-chip .px:hover { color: #ef4444; }
.st-preset-empty { color: var(--muted); font-size: 12px; }
.studio-sub { display: none; }
.studio-sub.active { display: block; }
.st-note { font-size: 11px; color: var(--muted); margin-top: 10px; text-align: center; }
.st-spin { width: 18px; height: 18px; border: 2px solid var(--glass-brd); border-top-color: var(--accent); border-radius: 50%; animation: stspin .7s linear infinite; }
@keyframes stspin { to { transform: rotate(360deg); } }
.st-applybtn { background: var(--bg2); border: 1px solid var(--border); border-radius: 11px; color: var(--text); padding: 0 14px; font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: all .12s; min-width: 92px; }
.st-applybtn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.st-applybtn:disabled { opacity: .65; cursor: default; }
.st-fmtbtn { width: 40px; height: 34px; background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; color: var(--text); font-size: 16px; cursor: pointer; font-family: inherit; display: inline-flex; align-items: center; justify-content: center; transition: all .12s; }
.st-fmtbtn:hover { border-color: var(--accent); }
.st-fmtbtn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.st-applybtn .st-spin { width: 14px; height: 14px; }
.st-jobs-list { display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow-y: auto; }
.st-job { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; font-size: 12px; }
.st-job .st-j-main { flex: 1; min-width: 0; }
.st-job .st-j-name { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-job .st-j-meta { color: var(--muted); font-size: 11px; margin-top: 2px; }
.st-job-x { width: 26px; height: 26px; border-radius: 7px; background: var(--bg2); border: 1px solid var(--border); color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; transition: border-color .12s, color .12s, background .12s; }
.st-job-x:hover { border-color: #e2607f; color: #e2607f; background: rgba(226,96,127,.1); }
.st-job-x .ic svg { width: 13px; height: 13px; }
.st-badge { font-size: 10px; padding: 3px 9px; border-radius: 20px; font-weight: 700; white-space: nowrap; }
.st-badge.queued { background: rgba(148,163,184,.18); color: #94a3b8; }
.st-badge.processing { background: rgba(245,200,66,.18); color: #f5c842; }
.st-badge.done { background: rgba(34,197,94,.18); color: #22c55e; }
.st-badge.error { background: rgba(239,68,68,.18); color: #ef4444; }
.st-empty { color: var(--muted); font-size: 12px; padding: 14px; text-align: center; }
/* чистая загрузка: спиннер + текст по центру */
.st-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 40px 20px; min-height: 160px; color: var(--muted); font-size: 13px; text-align: center; }
.st-loading .st-spin { width: 30px; height: 30px; border-width: 3px; }
.st-loading b { color: var(--text); font-weight: 600; font-size: 14px; }
.st-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.st-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; position: relative; }
/* ── мультивыбор в галерее/библиотеке ── */
.st-selbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; padding: 8px 12px; background: var(--bg2); border: 1px solid var(--accent); border-radius: 12px; font-size: 13px; flex-wrap: wrap; }
.st-selbar.hidden { display: none; }
.st-selbar b { color: var(--accent); }
.st-selchk { position: absolute; top: 8px; left: 8px; width: 24px; height: 24px; border-radius: 7px; background: rgba(10,12,16,.7); border: 2px solid rgba(255,255,255,.7); cursor: pointer; z-index: 4; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 14px; line-height: 1; transition: background .12s, border-color .12s; }
.st-selchk:hover { border-color: #fff; }
.st-selchk.on { background: var(--accent); border-color: var(--accent); }
.st-card.sel-multi, .st-lib-card.sel-multi { outline: 2px solid var(--accent); outline-offset: 1px; }
.st-card video { width: 100%; height: 150px; object-fit: contain; background: repeating-conic-gradient(#2a2f3a 0% 25%, #1f242e 0% 50%) 50% / 18px 18px; display: block; }
.st-card .st-c-body { padding: 9px 11px; }
.st-card .st-c-name { font-size: 11px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-card .st-c-row { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; gap: 6px; }
.st-card .st-c-meta { font-size: 10px; color: var(--muted); }
.btn-sm { padding: 4px 9px !important; font-size: 11px !important; }
.st-prevcap { font-size: 11px; color: var(--muted); font-weight: 500; }
.st-prevbox { width: min(100%, 520px, calc((100vh - 250px) * 0.5625)); margin: 6px auto 0; position: relative; border-radius: 14px; overflow: hidden; background: #000; }
.st-stylegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; max-height: 440px; overflow-y: auto; padding: 2px; }
.st-style-tile { cursor: pointer; border: 2px solid transparent; border-radius: 12px; overflow: hidden; background: #0b0e13; transition: border-color .12s, transform .12s; }
.st-style-tile:hover { transform: translateY(-2px); }
.st-style-tile.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.st-tile-prev { width: 100%; position: relative; overflow: hidden; background: #000; }
.st-tile-name { font-size: 11px; text-align: center; padding: 5px 4px; color: var(--text); background: var(--bg2); font-weight: 600; }
.st-stylebtn { display: flex; align-items: center; justify-content: space-between; cursor: pointer; text-align: left; }
.st-stylebtn-h { color: var(--muted); font-size: 11px; }
.st-sizebox { flex: 1; display: flex; align-items: center; gap: 10px; }
.st-sizebox input[type=range] { flex: 1; accent-color: var(--accent2); }
.st-size-num { width: 64px !important; flex: none !important; height: 40px; padding: 0 8px !important; text-align: center; }
.st-px { color: var(--muted); font-size: 11px; }
.st-modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.62); z-index: 200; align-items: center; justify-content: center; padding: 20px; }
.st-modal.open { display: flex; }
.st-toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(12px); background: var(--glass-strong); border: 1px solid var(--glass-brd); color: var(--text); padding: 11px 18px; border-radius: 12px; font-size: 13px; font-weight: 600; z-index: 300; opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: 0 12px 30px -10px rgba(0,0,0,.6); }
.st-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.st-modal-box { background: var(--glass-strong); border: 1px solid var(--glass-brd); border-radius: 18px; padding: 18px; max-width: 780px; width: 100%; max-height: 86vh; overflow-y: auto; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.st-modal-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 16px; margin-bottom: 14px; }
.st-modal .st-stylegrid { max-height: none; }
.st-prevtabs { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: nowrap; min-width: 0; }   /* НЕ переносить кнопки на 2-ю строку — при тесноте ужимаются паддинги */
.st-ptab { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r-pill); color: var(--muted); padding: 8px 16px; font-size: 12px; cursor: pointer; font-family: inherit; font-weight: 500; flex-shrink: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1500px) { .st-ptab { padding: 8px 10px; font-size: 11px; } .st-prevtabs { gap: 5px; } }
.st-ptab.active { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent2)); border-color: transparent; }
.st-q-badge { margin-left: 6px; font-size: 10px; opacity: .8; }
/* единый ряд иконочных кнопок (reset-pos / lock / undo / redo) — одинаковый размер и стиль */
.st-pos-reset, .st-pos-lock, .st-hist-btn { width: 34px; height: 34px; flex-shrink: 0; padding: 0; background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; color: var(--muted); cursor: pointer; font-family: inherit; transition: border-color .12s, color .12s, background .12s; display: inline-flex; align-items: center; justify-content: center; }
.st-pos-reset:hover, .st-pos-lock:hover, .st-hist-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.st-pos-lock.on { border-color: var(--accent); color: var(--accent); }
.st-hist-btn:disabled { opacity: 0.32; cursor: default; }
.st-pos-reset .ic svg, .st-pos-lock .ic svg, .st-hist-btn .ic svg { width: 16px; height: 16px; }
.st-reset-btn .ic svg { width: 14px; height: 14px; }
.st-reset-btn { margin-left: auto; flex-shrink: 0; background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; color: var(--muted); padding: 0 13px; height: 34px; font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit; transition: all .12s; display: inline-flex; align-items: center; gap: 6px; }
.st-reset-btn:hover { border-color: #e2607f; color: #e2607f; background: rgba(226,96,127,.1); }
@media (max-width: 1500px) { .st-reset-txt { display: none; } }   /* тесно (зум) → прячем надпись, кнопки не переносятся на 2-ю строку */
/* тумблер + группа настроек (VEED-стиль) */
.st-toggle { position: relative; width: 40px; height: 22px; border-radius: 999px; background: var(--surface2); border: 1px solid var(--border); cursor: pointer; transition: background .15s, border-color .15s; flex: 0 0 auto; }
.st-toggle.on { background: linear-gradient(135deg, var(--accent), var(--accent2)); border-color: transparent; }
.st-toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #eef0f6; box-shadow: 0 2px 5px rgba(0,0,0,.45); transition: left .15s; }
.st-toggle.on::after { background: #fff; left: 20px; }
.st-grp { background: var(--bg2); border: 1px solid var(--border); border-radius: 14px; padding: 11px 12px; margin-bottom: 8px; }
.st-grp-head { display: flex; align-items: center; justify-content: space-between; }
.st-grp-head span { font-size: 13px; color: var(--text); font-weight: 600; }
.st-grp-body { margin-top: 11px; display: none; }
.st-grp.on .st-grp-body { display: block; }
.st-row { display: flex; align-items: center; gap: 9px; margin-top: 9px; }
.st-row:first-child { margin-top: 0; }
.st-row label { font-size: 11px; color: var(--muted); flex: 0 0 auto; min-width: 56px; }
.st-row input[type=range] { flex: 1; min-width: 40px; }
.st-row input[type=color] { width: 34px; height: 26px; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: var(--bg2); cursor: pointer; flex: 0 0 auto; }
.st-colorbig { width: 42px; height: 28px; padding: 0; border: 1px solid var(--border); border-radius: 7px; background: var(--bg2); cursor: pointer; flex: 0 0 auto; }
.st-row .st-rv { font-size: 11px; color: var(--muted); min-width: 22px; text-align: right; font-family: 'JetBrains Mono', monospace; }
.st-ovnum { width: 46px; flex: 0 0 auto; background: var(--bg); border: 1px solid var(--border); border-radius: 9px; color: var(--text); font-size: 12px; padding: 4px 6px; text-align: center; font-family: 'JetBrains Mono', monospace; outline: none; }
.st-grp-head .ic { width: 14px; height: 14px; opacity: .7; margin-right: 2px; }
/* фазы: до «Создать субтитры» прячем пост-поля сразу (без мелькания), после — прячем пре-поля */
#st-left-style:not(.created) .st-postfield { display: none !important; }
#st-left-style.created .st-prefield { display: none !important; }
/* VEED-карточки настроек */
.st-sect { font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); margin: 16px 0 10px; padding-bottom: 7px; border-bottom: 1px solid var(--border); }
.st-sect:first-child { margin-top: 2px; }
.st-ecard { background: var(--bg2); border: 1px solid var(--border); border-radius: 14px; padding: 13px 14px; margin-bottom: 9px; }
.st-ecard-head { display: flex; align-items: center; gap: 10px; }
.st-ecard-title { font-size: 13.5px; color: var(--text); font-weight: 650; letter-spacing: .1px; flex: 1; min-width: 0; }
.st-ecard-body { margin-top: 12px; }
.st-ecard.off .st-ecard-body { display: none; }
.st-ecard.collapsed .st-ecard-body { display: none; }
.st-ecard-chev { background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; color: var(--muted); cursor: pointer; font-size: 16px; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; line-height: 1; transition: transform .15s, color .12s; flex-shrink: 0; }
.st-ecard-chev:hover { color: var(--accent); border-color: var(--accent); }
.st-ecard.collapsed .st-ecard-chev { transform: rotate(-90deg); }
/* smart: карточки 3 категорий (Хук/Ключевое/CTA) */
.st-cat-hint { font-size: 11px; color: var(--muted); margin: 2px 0 9px; }
.st-catcard .st-ecard-head { gap: 8px; }
.st-catdot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 7px; vertical-align: middle; box-shadow: 0 0 0 1px rgba(255,255,255,.15); }
.st-catdesc { font-size: 10px; color: var(--muted); font-weight: 400; }
.st-catsel { flex: 1; background: var(--surface); border: 1px solid var(--border); color: var(--text); border-radius: 9px; padding: 6px 9px; font-size: 12px; font-family: inherit; cursor: pointer; }
.st-catsz { font-size: 11px; color: var(--muted); min-width: 44px; text-align: right; }
.st-catcard .st-row label { min-width: 64px; font-size: 12px; color: var(--muted); }
.st-tpl-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.st-set { position: relative; background: var(--bg2); border: 1px solid var(--border); border-radius: 11px; padding: 7px; cursor: pointer; transition: all .12s; overflow: hidden; }
.st-set:hover { border-color: var(--accent); transform: translateY(-1px); }
.st-set.sel { border-color: var(--accent); box-shadow: 0 0 0 1.5px var(--accent); }
.st-set-recent { border-color: var(--accent); }
.st-set-prev { font-size: 13px; font-weight: 900; text-transform: uppercase; line-height: 1.05; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 9px 4px; background: repeating-conic-gradient(#2a2f3a 0% 25%,#1f242e 0% 50%) 50% / 16px 16px; border-radius: 7px; }
.st-set-name { font-size: 11px; font-weight: 600; color: var(--muted); margin-top: 5px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-set-x { position: absolute; top: 4px; right: 4px; z-index: 2; width: 16px; height: 16px; line-height: 15px; text-align: center; border: none; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; font-size: 9px; cursor: pointer; opacity: 0; transition: opacity .12s; }
.st-set:hover .st-set-x { opacity: 1; }
.st-set-x:hover { background: #e5484d; }
.st-tpl-b { background: var(--bg2); border: 1px solid var(--border); color: var(--text); border-radius: 11px; padding: 8px 13px; font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: inherit; transition: all .12s; }
.st-tpl-b:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.st-tpl-save { display: inline-flex; align-items: center; gap: 6px; border-color: var(--accent); color: var(--accent); }
.st-tpl-save .ic svg { width: 14px; height: 14px; }
.st-tpl-set { position: relative; padding-right: 26px; }
.st-tpl-x { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 10px; opacity: .55; width: 15px; height: 15px; line-height: 15px; text-align: center; border-radius: 50%; }
.st-tpl-x:hover { opacity: 1; background: var(--accent); color: #fff; }
.st-proj-new { display: flex; gap: 8px; margin-bottom: 12px; }
.st-proj-list { display: flex; flex-direction: column; gap: 7px; max-height: 360px; overflow-y: auto; }
.st-proj-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; cursor: pointer; transition: all .12s; }
.st-proj-row:hover { border-color: var(--accent); transform: translateY(-1px); }
.st-proj-row.cur { border-color: var(--accent); background: var(--accent-soft); }
.st-proj-main { flex: 1; min-width: 0; }
.st-proj-t { font-size: 13.5px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-proj-m { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.st-proj-x { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--border); background: transparent; color: var(--muted); cursor: pointer; transition: all .12s; }
.st-proj-x:hover { border-color: #e5484d; color: #e5484d; }
.st-selchk-sm { flex: 0 0 auto; width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--border); background: var(--bg); color: #fff; font-size: 12px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: all .12s; }
.st-selchk-sm:hover { border-color: var(--accent); }
.st-selchk-sm.on { background: var(--accent); border-color: var(--accent); }
.st-proj-row.sel-multi { border-color: var(--accent); background: var(--accent-soft); }
.n8n-wrap { height: calc(100vh - 168px); min-height: 460px; border-radius: 18px; overflow: hidden; border: 1px solid var(--border); background: #fff; box-shadow: 0 10px 30px -12px rgba(0,0,0,.5); }
#n8n-frame { width: 100%; height: 100%; border: 0; display: block; }
/* smart-разметка во вкладке «Редактировать»: чипы-слова + ПКМ */
#st-smart-markup { margin-bottom: 12px; padding: 12px 13px; background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; }
.st-mk-hint { font-size: 11px; color: var(--muted); margin-bottom: 9px; }
.st-mk-flow { display: flex; flex-wrap: wrap; gap: 4px 5px; line-height: 1.7; }
.mk-break { flex-basis: 100%; height: 0; }
.st-mk-w { padding: 1px 5px; border-radius: 6px; cursor: pointer; font-size: 14px; font-weight: 700; user-select: none; border: 1.5px solid transparent; color: #cbd5e1; transition: background .1s; text-transform: uppercase; }
.st-mk-w:hover { background: rgba(255,255,255,.07); }
.st-mk-w.mk-sel { border-color: var(--accent); background: rgba(230,131,164,.22); }
.st-mk-w.mk-edit { background: var(--surface); border-color: var(--accent); color: var(--text) !important; cursor: text; outline: none; text-transform: none; }
.st-ctx-h { font-size: 10.5px; color: var(--muted); padding: 3px 11px 6px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.st-mk-legend { display: flex; gap: 13px; font-size: 10.5px; color: var(--muted); margin-top: 10px; flex-wrap: wrap; }
.st-mk-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.st-ctxmenu { position: fixed; z-index: 400; background: var(--glass-strong); border: 1px solid var(--glass-brd); border-radius: 10px; padding: 5px; box-shadow: 0 12px 30px -8px rgba(0,0,0,.6); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); min-width: 168px; }
.st-ctxmenu button { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; background: none; border: none; color: var(--text); padding: 8px 11px; border-radius: 7px; cursor: pointer; font-size: 13px; font-family: inherit; }
.st-ctxmenu button:hover { background: var(--hover); }
.st-ctxmenu i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
/* попап докрутки одного слова */
.st-wordpop { position: fixed; z-index: 420; width: 260px; max-width: calc(100vw - 16px); box-sizing: border-box; background: var(--glass-strong); border: 1px solid var(--glass-brd); border-radius: 12px; padding: 12px; box-shadow: 0 14px 36px -10px rgba(0,0,0,.7); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.st-wordpop * { box-sizing: border-box; }
.st-wp-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; margin-bottom: 6px; color: var(--text); }
.st-wp-head b { text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.st-wp-x { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; flex-shrink: 0; }
.st-wp-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.st-wp-row label { min-width: 62px; flex-shrink: 0; font-size: 12px; color: var(--muted); }
.st-wp-row input[type=range] { flex: 1; min-width: 0; }
.st-wp-row input[type=color] { flex-shrink: 0; }
.st-wp-row select { flex: 1; min-width: 0; max-width: 100%; background: var(--surface); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 5px 7px; font-size: 12px; font-family: inherit; }
.st-wp-sz { font-size: 11px; color: var(--muted); min-width: 42px; text-align: right; }
.st-wp-b { background: var(--bg2); border: 1px solid var(--border); color: var(--muted); border-radius: 8px; padding: 4px 9px; font-size: 11px; cursor: pointer; }
.st-wp-fontbtn { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 6px 9px; font-size: 12px; font-family: inherit; cursor: pointer; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-wp-fontbtn:hover { border-color: var(--accent); }
.st-wp-reset { width: 100%; margin-top: 11px; background: rgba(239,68,68,.14); color: #ef4444; border: none; border-radius: 9px; padding: 8px; font-size: 12px; cursor: pointer; font-family: inherit; }
/* кнопка-пикер анимации (как у VEED: иконка + название + шеврон) */
.st-animpick { width: 100%; display: flex; align-items: center; gap: 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 11px; padding: 10px 12px; cursor: pointer; color: var(--text); font-family: inherit; font-size: 13px; font-weight: 600; transition: border-color .12s, background .12s; }
.st-animpick:hover { border-color: var(--accent); }
.st-animpick-ic { width: 26px; height: 26px; border-radius: 7px; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; flex: 0 0 auto; }
.st-animpick-chev { margin-left: auto; color: var(--muted); font-size: 18px; }
/* сетка анимаций (живые превью) */
.st-animgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 11px; }
.st-anim-tile { cursor: pointer; border: 2px solid var(--border); border-radius: 13px; overflow: hidden; background: var(--bg); transition: border-color .12s, transform .12s; }
.st-anim-tile:hover { transform: translateY(-2px); border-color: var(--muted); }
.st-anim-tile.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.st-anim-prev { height: 76px; display: flex; align-items: center; justify-content: center; background: #0b0e13; overflow: hidden; }
.st-anim-prev span { font-family: Poppins, sans-serif; font-weight: 900; font-size: 21px; color: #fff; display: inline-block; }
.st-anim-nm { font-size: 12px; text-align: center; padding: 7px 4px; color: var(--text); font-weight: 600; }
.st-anim-tile.sel .st-anim-nm { color: var(--accent); }
/* кнопка сохранить пресет рядом со стилем */
.st-savep { flex: 0 0 auto; width: 40px; display: flex; align-items: center; justify-content: center; background: var(--bg2); border: 1px solid var(--border); border-radius: 11px; color: var(--muted); cursor: pointer; transition: all .12s; }
.st-savep:hover { border-color: var(--accent); color: var(--accent); }
.st-savep .ic svg { width: 16px; height: 16px; }
/* пользовательский пресет в модалке стилей */
.st-style-tile.userp { position: relative; }
.st-style-tile .st-del-p { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 6px; background: rgba(0,0,0,.6); color: #fff; border: none; cursor: pointer; font-size: 13px; line-height: 1; display: none; z-index: 2; }
.st-style-tile.userp:hover .st-del-p { display: block; }
.st-prevbox { cursor: grab; touch-action: none; }
.st-prevbox.dragging { cursor: grabbing; }
.st-prevwrap { position: relative; }
.st-play-btn { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); width: 52px; height: 52px; border-radius: 50%; background: rgba(18,18,24,.5); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); color: #fff; border: 1.5px solid rgba(255,255,255,.85); cursor: pointer; z-index: 6; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 18px rgba(0,0,0,.45); transition: transform .12s, background .12s; }
.st-play-btn:hover { background: rgba(0,0,0,.7); transform: translateX(-50%) scale(1.06); }
#st-timeline { margin-top: 10px; }
.st-tl-time { font-size: 11px; color: var(--muted); margin-bottom: 5px; font-family: 'JetBrains Mono', monospace; display: flex; align-items: center; gap: 8px; }
.st-tl-zoomwrap { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.st-tl-zoom { width: 20px; height: 20px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg2); color: var(--text); cursor: pointer; font-size: 14px; line-height: 1; display: flex; align-items: center; justify-content: center; padding: 0; }
.st-tl-zoom:hover { background: var(--glass-brd); }
#st-tl-zlbl { min-width: 26px; text-align: center; }
.st-tl-scroll { overflow-x: auto; overflow-y: hidden; border-radius: 9px; }
.st-tl-scroll::-webkit-scrollbar { height: 7px; } .st-tl-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.st-tl-bar { position: relative; height: 64px; min-width: 100%; background: var(--bg2); border: 1px solid var(--border); border-radius: 9px; cursor: pointer; overflow: hidden; }
.st-tl-fill { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(230,131,164,.22); width: 0; pointer-events: none; }
.st-tl-tick { position: absolute; top: 0; height: 22px; width: 1px; background: rgba(255,255,255,.12); pointer-events: none; z-index: 1; }   /* шкала в СВОЕЙ зоне сверху — не поверх сегментов */
.st-tl-tick span { position: absolute; top: 1px; left: 3px; font-size: 9px; color: var(--muted); font-family: 'JetBrains Mono', monospace; white-space: nowrap; }
.st-tl-tick.minor { top: 12px; height: 10px; bottom: auto; background: rgba(255,255,255,.10); }
.st-tl-head { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); left: 0; box-shadow: 0 0 6px var(--accent); pointer-events: auto; cursor: ew-resize; z-index: 6; }
.st-tl-head::after { content: ''; position: absolute; left: -4px; right: -4px; top: 0; bottom: 0; }   /* узкий хват линии — чтоб не перекрывала ползунки сегментов */
.st-tl-seg { position: absolute; top: 24px; height: 34px; background: rgba(43,255,106,.55); border-radius: 4px; pointer-events: auto; cursor: grab; transition: box-shadow .1s; }   /* сегменты ниже зоны шкалы (0-22px = тики/цифры) */
.st-tl-seg:active { cursor: grabbing; }
.st-tl-seg.sel { box-shadow: 0 0 0 2px var(--accent), 0 0 12px rgba(230,131,164,.7); z-index: 7; }   /* выделенный — ВЫШЕ линии времени (z-index 6), чтоб его ползунки всегда ловили клик */
.st-tl-h { position: absolute; top: 0; bottom: 0; width: 12px; pointer-events: auto; cursor: ew-resize; z-index: 3; opacity: .55; }
.st-tl-seg.sel .st-tl-h { opacity: 1; width: 16px; }
.st-tl-seg.sel .st-tl-h-l { left: -8px; } .st-tl-seg.sel .st-tl-h-r { right: -8px; }
.st-tl-h-l { left: -6px; } .st-tl-h-r { right: -6px; }
.st-tl-h::after { content: ''; position: absolute; top: 26%; bottom: 26%; left: 50%; width: 2px; transform: translateX(-50%); background: rgba(255,255,255,.65); border-radius: 2px; opacity: .45; transition: opacity .1s; }
.st-tl-h:hover::after { opacity: 1; background: #fff; }
.st-tl-seg.hero { background: rgba(255,224,0,.75); }
.st-play-btn svg { margin-left: 2px; }
.st-font-star { cursor: pointer; font-size: 14px; }
.st-lang-list { display: flex; flex-direction: column; gap: 2px; max-height: 56vh; overflow-y: auto; }
.st-lang-item { padding: 9px 12px; border-radius: 10px; cursor: pointer; font-size: 13px; color: var(--text); }
.st-lang-item:hover { background: var(--glass-hi); }
.st-lang-item.sel { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; }
.st-vid-box { max-width: 460px; width: 100%; }
.st-vid-box video { width: 100%; border-radius: 14px; background: #000; max-height: 80vh; }
.st-card { cursor: pointer; }
.st-edit-head { display: flex; gap: 8px; margin-bottom: 10px; align-items: center; }
.st-edit-hint { font-size: 10.5px; color: var(--muted); margin-left: auto; }
.st-editor { display: flex; flex-direction: column; gap: 6px; max-height: 62vh; overflow-y: auto; }
/* ОДНО поле: цветной слой под прозрачным текстом textarea (подсветка прямо в редакторе) */
.st-eseg-edit { position: relative; flex: 1; }
.st-eseg-edit textarea { width: 100%; font-weight: 600; padding: 0; border: 0; box-sizing: border-box; }
.st-eseg-edit.smart textarea { color: transparent; caret-color: var(--text); position: relative; z-index: 1; }
.st-eseg-hl { position: absolute; top: 0; left: 0; right: 0; bottom: 0; font-size: 13px; line-height: 1.4; font-family: inherit; font-weight: 600; letter-spacing: normal; white-space: pre-wrap; overflow-wrap: break-word; word-break: normal; pointer-events: none; color: #cbd5e1; overflow: hidden; }
.st-eseg textarea:focus { color: var(--accent); }
.st-eseg { display: flex; align-items: flex-start; gap: 8px; background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; }
.st-eseg .st-etime { font-size: 10px; color: var(--muted); min-width: 64px; padding-top: 6px; border-radius: 5px; transition: background .12s; }
.st-eseg .st-etime:hover { background: var(--glass-brd); color: var(--text); }
.st-eseg .st-etime.tmlock { color: var(--accent); font-weight: 600; }   /* ручной тайминг */
.st-etime-in { width: 46px; background: var(--bg); border: 1px solid var(--accent); border-radius: 5px; color: var(--text); font-size: 11px; padding: 2px 4px; text-align: center; font-family: 'JetBrains Mono', monospace; outline: none; }
.st-eseg textarea { flex: 1; background: transparent; border: none; color: var(--text); font-size: 13px; font-family: inherit; resize: none; outline: none; line-height: 1.4; overflow: hidden; min-height: 20px; }
.st-eseg .st-eact { display: flex; flex-direction: column; gap: 4px; }
.st-ebtn { background: var(--bg2); border: 1px solid var(--border); border-radius: 7px; color: var(--muted); cursor: pointer; font-size: 11px; padding: 3px 7px; line-height: 1; }
.st-ebtn:hover { color: var(--text); }
.st-lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; max-height: 64vh; overflow-y: auto; }
.st-lib-card { border: 2px solid transparent; border-radius: 12px; overflow: hidden; background: #0b0e13; cursor: pointer; position: relative; }
.st-lib-card.sel { border-color: var(--accent); }
.st-lib-card img { width: 100%; height: 110px; object-fit: cover; display: block; background: #000; }
.st-lib-card .st-lib-cap { font-size: 11px; padding: 6px 8px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-lib-card .st-lib-del { position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,.65); border: none; color: #fff; border-radius: 7px; cursor: pointer; padding: 3px 8px; font-size: 12px; }
.st-lib-card .st-lib-badge { position: absolute; top: 6px; left: 6px; background: rgba(230,131,164,.85); color: #fff; border-radius: 7px; padding: 3px 8px; font-size: 10px; font-weight: 600; z-index: 1; }
.st-magnet { position: absolute; background: var(--accent); opacity: .5; z-index: 5; pointer-events: none; }
.st-selbox { position: absolute; border: 1.5px dashed rgba(255,255,255,.7); border-radius: 6px; pointer-events: none; z-index: 4; }
.fm-crumbs { flex: 1; min-width: 120px; display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.fm-crumbs .crumb { cursor: pointer; padding: 2px 6px; border-radius: 7px; transition: all .12s; }
.fm-crumbs .crumb:hover { background: var(--hover); color: var(--text); }
.fm-crumbs .crumb.cur { color: var(--text); font-weight: 600; }
.fm-crumbs .sep { color: var(--border); }
.fm-actions { display: flex; gap: 8px; }
.fm-list { max-height: 60vh; overflow-y: auto; }
.fm-row { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--glass-brd); transition: background .1s; }
.fm-row:last-child { border-bottom: none; }
.fm-row:hover { background: var(--hover); }
.fm-row:hover .fm-row-actions { opacity: 1; }
.fm-ic { width: 22px; height: 22px; flex-shrink: 0; color: var(--muted); }
.fm-ic.dir { color: var(--accent); }
.fm-ic svg { width: 22px; height: 22px; }
.fm-name { flex: 1; min-width: 0; font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fm-name.dir { font-weight: 600; }
.fm-meta { font-size: 11px; color: var(--muted); white-space: nowrap; }
.fm-row-actions { display: flex; gap: 4px; opacity: 0; transition: opacity .12s; }
.fm-row-actions .ib { background: transparent; border: none; color: var(--muted); cursor: pointer; padding: 5px; border-radius: 8px; display: inline-flex; }
.fm-row-actions .ib:hover { background: var(--surface); color: var(--text); }
.fm-row-actions .ib.danger:hover { color: #f87171; }
.fm-row-actions .ib svg { width: 15px; height: 15px; }
.fm-empty { padding: 30px; text-align: center; color: var(--muted); font-size: 13px; }
.fm-drop { display: none; padding: 14px; text-align: center; font-size: 12px; color: var(--accent); border-top: 1px dashed var(--accent); }
.fm-list.dragover + .fm-drop { display: block; }
@media (max-width: 600px) { .fm-meta { display: none; } .fm-row-actions { opacity: 1; } }

/* Редактор файла */
.editor-dialog { max-width: 820px; width: 92vw; display: flex; flex-direction: column; }
.editor-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.editor-name { font-size: 14px; font-weight: 700; font-family: 'JetBrains Mono', monospace; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor-area { width: 100%; height: 56vh; background: var(--bg2); border: 1px solid var(--border); border-radius: 14px; color: var(--text); padding: 14px; font-family: 'JetBrains Mono', monospace; font-size: 13px; line-height: 1.6; resize: none; }
.editor-area:focus { outline: none; border-color: var(--accent); }
.editor-status { font-size: 12px; color: var(--muted); margin-top: 8px; min-height: 16px; }

/* ── MODAL (кастомные prompt/confirm/alert) ── */
.modal { position: fixed; inset: 0; z-index: 300; background: rgba(0,0,0,.6); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); display: none; align-items: center; justify-content: center; padding: 20px; }
.modal.open { display: flex; animation: modal-fade .15s ease-out; }
.modal-dialog { background: var(--sheen), var(--surface); border: 1px solid var(--glass-brd); border-radius: 22px; padding: 24px 26px; width: 100%; max-width: 440px; box-shadow: 0 30px 70px -20px rgba(0,0,0,.9), var(--inset-hi); animation: modal-pop .18s ease-out; }
.modal-title { font-size: 17px; font-weight: 800; margin-bottom: 8px; letter-spacing: -.2px; }
.modal-body { font-size: 13px; color: var(--muted); line-height: 1.65; margin-bottom: 14px; white-space: pre-wrap; }
.modal-input { width: 100%; background: var(--bg2); border: 1px solid var(--border); color: var(--text); border-radius: 13px; padding: 12px 14px; font-size: 13px; margin-bottom: 14px; transition: border-color .15s; }
.modal-input:focus { outline: none; border-color: var(--accent); }
.modal-input.hidden { display: none; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.modal-actions .btn { padding: 10px 18px; font-size: 13px; }
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-pop { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }

/* ── SETTINGS SUB-TABS ── */
.settings-tabs { display: flex; gap: 4px; padding: 5px; border-radius: 14px;
  background: var(--sheen), var(--surface); border: 1px solid var(--glass-brd); box-shadow: var(--inset-hi);
  width: fit-content; max-width: 100%; overflow-x: auto; flex-wrap: nowrap; }
.st-tab { display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px; border-radius: var(--r-pill);
  border: none; background: transparent; color: var(--muted); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all .15s; white-space: nowrap; }
.st-tab:hover { color: var(--text); }
.st-tab.active { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; box-shadow: 0 6px 14px -6px rgba(230,131,164,.55); }
.st-tab .ic svg { width: 14px; height: 14px; }

/* ── HIDDEN SERVICES ── */
.hidden-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--glass-brd); }
.hidden-row:last-child { border-bottom: none; }
.hidden-row .ic svg { width: 18px; height: 18px; }
.hidden-name { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.hidden-name b { font-size: 13px; font-weight: 600; color: var(--text); }
.hidden-name small { font-size: 11px; color: var(--muted); font-family: 'JetBrains Mono', monospace; }

/* ── LOGS ── */
.log-area { background: var(--bg2); border-radius: 16px; padding: 14px; font-family: 'JetBrains Mono', 'Consolas', monospace; font-size: 11px; line-height: 1.7; height: 200px; overflow-y: auto; border: 1px solid var(--glass-brd); }
.log-ok   { color: #22c55e; }
.log-err  { color: #ef4444; }
.log-warn { color: #f59e0b; }
.log-info { color: var(--silver-hi); }
.log-dim  { color: #334155; }

/* ── DEPLOY ── */
.deploy-ok { display: flex; align-items: center; gap: 8px; padding: 10px; background: #052e16; border: 1px solid #14532d; border-radius: 6px; margin-bottom: 12px; font-size: 12px; color: #22c55e; }
.deploy-warn { display: flex; align-items: center; gap: 8px; padding: 10px; background: #2d1b00; border: 1px solid #78350f; border-radius: 6px; margin-bottom: 12px; font-size: 12px; color: #f59e0b; }
.commit-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.commit-hash { font-family: monospace; font-size: 11px; color: var(--accent); background: var(--accent-soft); padding: 2px 7px; border-radius: 4px; }
.commit-msg { font-size: 12px; color: #94a3b8; flex: 1; }
.commit-time { font-size: 11px; color: #334155; white-space: nowrap; }

/* ── REPOS ── */
.repo-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--hover); }
.repo-row:last-child { border-bottom: none; }
.repo-name { font-size: 13px; font-weight: 500; flex: 1; }
.repo-branch { font-size: 11px; color: var(--accent); background: var(--accent-soft); padding: 1px 7px; border-radius: 4px; }
.repo-status-ok   { font-size: 11px; color: #22c55e; }
.repo-status-warn { font-size: 11px; color: #f59e0b; }

/* ── TERMINAL ── */
.term-output { background: var(--bg2); border-radius: 16px; padding: 14px; font-family: monospace; font-size: 12px; min-height: 80px; max-height: 200px; overflow-y: auto; color: #94a3b8; white-space: pre-wrap; margin-bottom: 10px; border: 1px solid var(--glass-brd); }
.term-input-row { display: flex; align-items: center; gap: 8px; background: var(--bg2); border: 1px solid var(--border); border-radius: 14px; padding: 9px 14px; }
.term-prompt { color: var(--accent); font-family: monospace; font-size: 13px; font-weight: 700; }
.term-input { flex: 1; background: transparent; border: none; outline: none; color: var(--text); font-family: monospace; font-size: 13px; }

/* ── SECTION VISIBILITY ── */
.section { display: none; }
.section.active { display: flex; flex-direction: column; gap: 16px; }

/* ── MOBILE HAMBURGER ── */
.hamburger { display: none; position: fixed; top: 12px; left: 12px; z-index: 200;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; cursor: pointer; font-size: 18px; color: var(--accent); }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 99; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  body { overflow: auto; }

  /* Hamburger visible */
  .hamburger { display: block; }

  /* Sidebar becomes slide-in drawer */
  .sidebar {
    position: fixed; left: -240px; top: 0; height: 100vh;
    z-index: 100; transition: left .25s ease; width: 220px;
  }
  .sidebar.open { left: 0; }
  .sidebar-overlay.open { display: block; }

  /* Main takes full width, add top padding for hamburger */
  .main { padding: 60px 16px 16px; border-radius: 0; }

  /* мобильный drawer — возвращаем подписи (рейл только для десктопа) */
  .sidebar { border-radius: 0; align-items: stretch; padding: 22px 0; }
  .logo { width: auto; justify-content: flex-start; padding: 0 20px 18px; }
  .logo-txt { display: flex; flex-direction: column; line-height: 1.2; }
  .nav-item { font-size: 13.5px; font-weight: 600; justify-content: flex-start; gap: 13px; margin: 3px 14px; padding: 8px 10px; border-radius: 15px; }
  .nav-item .icon { width: 34px; height: 34px; min-width: 34px; border-radius: 11px; }
  .nav-item::after { display: none; }
  .sidebar-footer { width: auto; align-items: stretch; padding: 14px; }
  .server-chip { width: auto; height: auto; border-radius: 14px; justify-content: flex-start; gap: 10px; padding: 11px 13px; }
  .server-info { display: flex; flex-direction: column; min-width: 0; }
  .sidebar-footer .theme-btn { font-size: 13px; width: 100%; height: auto; border-radius: 13px; padding: 10px 12px; }

  /* Stats: 2 columns */
  .stats { grid-template-columns: repeat(2, 1fr); }

  /* 2-col grid becomes 1-col */
  .grid2 { grid-template-columns: 1fr; }

  /* Shrink stat values */
  .stat-value { font-size: 18px; }
  .page-header h1 { font-size: 17px; }

  /* Service row — wrap actions to next line */
  .svc-row { flex-wrap: wrap; gap: 8px; }
  .svc-actions { width: 100%; justify-content: flex-end; }

  /* Terminal input smaller */
  .term-input { font-size: 12px; }
  .term-prompt { font-size: 12px; }
}

@media (max-width: 480px) {
  /* Stats: 1 column on very small screens */
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 12px; }
  .stat-value { font-size: 16px; }
  .badge { font-size: 10px; }
  .card { padding: 14px; }
  .btn { padding: 4px 10px; font-size: 11px; }
}