/* Панель в стиле shadcn/ui: нейтральная основа, hairline-границы, цвет несут только статусы.
   Токены — DESIGN SYSTEM/shadcn/DESIGN_shadcn_saas.md. */
:root {
  --background: #ffffff; --foreground: #18181b;
  --card: #ffffff; --popover: #ffffff;
  --primary: #18181b; --primary-foreground: #fafafa;
  --muted: #f4f4f5; --muted-foreground: #71717a;
  --accent: #f4f4f5; --border: #e4e4e7; --input: #e4e4e7; --ring: #a1a1aa;
  --destructive: #dc2626; --destructive-soft: #fef2f2; --destructive-text: #b91c1c;
  --success: #16a34a; --success-soft: #f0fdf4; --success-text: #15803d;
  --warning: #d97706; --warning-soft: #fffbeb; --warning-text: #b45309;
  --info: #2563eb;
  --sidebar: #fafafa; --sidebar-foreground: #3f3f46; --sidebar-accent: #f4f4f5; --sidebar-border: #e4e4e7;
  --badge-warn-bg: #fbbf24; --badge-warn-fg: #451a03; --badge-crit-bg: #dc2626; --badge-crit-fg: #ffffff;
  --chart-1: #2563eb; --chart-2: #0d9488; --chart-grid: #f4f4f5;
  --shadow-xs: 0 1px 2px rgb(0 0 0 / .04);
  --shadow-pop: 0 1px 2px rgb(0 0 0 / .04), 0 4px 12px rgb(0 0 0 / .06);
  --shadow-dialog: 0 18px 50px rgb(0 0 0 / .18);
  --radius-sm: 6px; --radius-md: 8px; --radius-lg: 10px; --radius-xl: 12px;
  --sidebar-width: 16rem; --sidebar-width-icon: 3rem;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --background: #09090b; --foreground: #fafafa;
    --card: #09090b; --popover: #18181b;
    --primary: #fafafa; --primary-foreground: #18181b;
    --muted: #27272a; --muted-foreground: #a1a1aa;
    --accent: #27272a; --border: rgb(255 255 255 / .10); --input: rgb(255 255 255 / .15); --ring: #71717a;
    --destructive: #ef4444; --destructive-soft: rgb(239 68 68 / .12); --destructive-text: #f87171;
    --success: #22c55e; --success-soft: rgb(34 197 94 / .12); --success-text: #4ade80;
    --warning: #f59e0b; --warning-soft: rgb(245 158 11 / .12); --warning-text: #fbbf24;
    --info: #60a5fa;
    --sidebar: #111113; --sidebar-foreground: #d4d4d8; --sidebar-accent: #27272a; --sidebar-border: rgb(255 255 255 / .08);
    --chart-1: #3987e5; --chart-2: #199e70; --chart-grid: rgb(255 255 255 / .06);
    --shadow-pop: 0 1px 2px rgb(0 0 0 / .3), 0 4px 12px rgb(0 0 0 / .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --background: #09090b; --foreground: #fafafa;
  --card: #09090b; --popover: #18181b;
  --primary: #fafafa; --primary-foreground: #18181b;
  --muted: #27272a; --muted-foreground: #a1a1aa;
  --accent: #27272a; --border: rgb(255 255 255 / .10); --input: rgb(255 255 255 / .15); --ring: #71717a;
  --destructive: #ef4444; --destructive-soft: rgb(239 68 68 / .12); --destructive-text: #f87171;
  --success: #22c55e; --success-soft: rgb(34 197 94 / .12); --success-text: #4ade80;
  --warning: #f59e0b; --warning-soft: rgb(245 158 11 / .12); --warning-text: #fbbf24;
  --info: #60a5fa;
  --sidebar: #111113; --sidebar-foreground: #d4d4d8; --sidebar-accent: #27272a; --sidebar-border: rgb(255 255 255 / .08);
  --chart-1: #3987e5; --chart-2: #199e70; --chart-grid: rgb(255 255 255 / .06);
  --shadow-pop: 0 1px 2px rgb(0 0 0 / .3), 0 4px 12px rgb(0 0 0 / .3);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--sidebar); color: var(--foreground);
  font: 400 14px/1.5 var(--font); -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
[hidden] { display: none !important; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted-foreground); }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 16px; border-radius: var(--radius-md); border: 1px solid transparent;
  font: 500 14px/1 var(--font); color: inherit; background: none; cursor: pointer; white-space: nowrap;
  text-decoration: none; transition: background-color .15s, color .15s, border-color .15s, opacity .15s;
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent); border-color: var(--ring); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn-primary { background: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover { background: color-mix(in oklab, var(--primary) 90%, transparent); }
.btn-outline { background: var(--background); border-color: var(--border); box-shadow: var(--shadow-xs); }
.btn-outline:hover { background: var(--accent); }
.btn-ghost:hover { background: var(--accent); }
.btn-destructive { background: var(--destructive); color: #fff; }
.btn-destructive:hover { background: color-mix(in oklab, var(--destructive) 90%, transparent); }
.btn-sm { height: 32px; padding: 0 12px; gap: 6px; }
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }
.btn .ic { margin: 0 -2px; }
.btn-icon .ic { margin: 0; }

/* ---------- поля ---------- */
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.label { font-size: 14px; font-weight: 500; line-height: 1.25; }
.input {
  width: 100%; height: 36px; padding: 0 12px; border: 1px solid var(--input); border-radius: var(--radius-md);
  background: transparent; color: inherit; font: 400 14px/1.4 var(--font); box-shadow: var(--shadow-xs);
  transition: border-color .15s, box-shadow .15s;
}
:root[data-theme="dark"] .input { background: color-mix(in oklab, var(--input) 30%, transparent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .input { background: color-mix(in oklab, var(--input) 30%, transparent); } }
.input:focus-visible { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent); }
select.input { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
select.input option { background: var(--popover); color: var(--foreground); }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); margin: 0; }
.hint { font-size: 13px; color: var(--muted-foreground); }
.err { font-size: 14px; color: var(--destructive-text); white-space: pre-wrap; }
.note { font-size: 14px; border-radius: var(--radius-md); padding: 8px 12px; }
.note.warn { background: var(--warning-soft); color: var(--warning-text); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.slug-in { display: flex; align-items: center; gap: 6px; }
.set-slug-base { flex: none; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: rtl; text-align: left; } /* длинный адрес — обрезается слева */
#set-slug-hint.warn { color: var(--warning-text); }
#set-slug-hint.bad { color: var(--destructive-text); }

/* ---------- бейджи ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 500; white-space: nowrap; border: 1px solid transparent; line-height: 1;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.success { background: var(--success-soft); color: var(--success-text); }
.badge.warning { background: var(--warning-soft); color: var(--warning-text); }
.badge.destructive { background: var(--destructive-soft); color: var(--destructive-text); }
.badge.muted { background: var(--muted); color: var(--muted-foreground); }
.badge.outline { border-color: var(--border); color: var(--muted-foreground); }

/* ---------- вход ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: var(--background); }
.login-card { width: min(100%, 22rem); padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.login-logo { width: 40px; height: 40px; border-radius: var(--radius-md); background: var(--primary); color: var(--primary-foreground); display: grid; place-items: center; }
.login-logo .ic { width: 20px; height: 20px; }
.login-head h1 { font-size: 20px; font-weight: 600; line-height: 1.3; letter-spacing: -.01em; }
.login-head p { margin-top: 4px; }
.login-card .btn { width: 100%; }

/* ---------- оболочка ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.shell { display: flex; min-height: 100dvh; }
.sidebar {
  width: var(--sidebar-width); flex: none; position: sticky; top: 0; height: 100dvh;
  display: flex; flex-direction: column; gap: 8px; padding: 8px; background: var(--sidebar); color: var(--sidebar-foreground);
  transition: width .2s ease;
}
.inset {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  margin: 8px 8px 8px 0; min-height: calc(100dvh - 16px);
  background: var(--background); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-xs);
}
.sb-header, .sb-footer { flex: none; }
.sb-content { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; }
.sb-device { display: flex; align-items: center; gap: 8px; height: 48px; padding: 8px; border-radius: var(--radius-md); }
.sb-logo { width: 32px; height: 32px; border-radius: var(--radius-md); background: var(--primary); color: var(--primary-foreground); display: grid; place-items: center; flex: none; }
.sb-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; overflow: hidden; }
.sb-text b { font-weight: 600; font-size: 14px; color: var(--foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-text small { font-size: 12px; color: var(--muted-foreground); white-space: nowrap; }
.sb-label { height: 32px; display: flex; align-items: center; padding: 0 8px; font-size: 12px; font-weight: 500; color: var(--muted-foreground); white-space: nowrap; }
.sb-menu, .sb-sub { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.sb-btn {
  position: relative; display: flex; align-items: center; gap: 8px; width: 100%; height: 32px; padding: 0 8px;
  border: 0; border-radius: var(--radius-md); background: none; color: inherit; font: 400 14px/1 var(--font);
  text-align: left; text-decoration: none; white-space: nowrap; cursor: pointer; overflow: hidden;
}
.sb-btn > .sb-text { flex: 1; }
.sb-btn:hover { background: var(--sidebar-accent); color: var(--foreground); }
.sb-btn[aria-current="page"] { background: var(--sidebar-accent); color: var(--foreground); font-weight: 500; }
.sb-row { position: relative; }
.sb-row .sb-btn { padding-right: 32px; }
.sb-action {
  position: absolute; right: 4px; top: 6px; width: 20px; height: 20px; display: grid; place-items: center;
  border: 0; border-radius: var(--radius-sm); background: none; color: var(--muted-foreground); cursor: pointer; padding: 0;
}
.sb-action:hover { background: var(--sidebar-accent); color: var(--foreground); }
.sb-action .ic { transition: transform .15s; }
.sb-action[aria-expanded="false"] .ic { transform: rotate(-90deg); }
.sb-sub { margin: 4px 0 0 14px; padding: 2px 0 2px 10px; border-left: 1px solid var(--sidebar-border); gap: 2px; }
.sb-sub .sb-btn { height: 28px; font-size: 13px; gap: 8px; }
.sb-sub .sb-btn .ic { width: 14px; height: 14px; color: var(--muted-foreground); }
.sb-sub .sb-btn.add { color: var(--muted-foreground); }
.sb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sb-count { margin-left: auto; font-size: 12px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.sb-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 9999px; display: inline-grid; place-items: center;
  font-size: 12px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums;
  background: var(--badge-warn-bg); color: var(--badge-warn-fg);
}
.sb-badge.critical { background: var(--badge-crit-bg); color: var(--badge-crit-fg); }
.sb-owner { height: 48px; padding: 8px; }
.sb-avatar { width: 32px; height: 32px; border-radius: var(--radius-md); background: var(--sidebar-accent); color: var(--foreground); display: grid; place-items: center; flex: none; }
.sb-owner:hover .sb-avatar { background: var(--background); }
.sb-chev { margin-left: auto; color: var(--muted-foreground); }

/* свёрнутая боковая панель: только значки */
@media (min-width: 768px) {
  :root[data-sidebar="collapsed"] .sidebar { width: var(--sidebar-width-icon); }
  :root[data-sidebar="collapsed"] .sidebar .sb-text,
  :root[data-sidebar="collapsed"] .sidebar .sb-label,
  :root[data-sidebar="collapsed"] .sidebar .sb-sub,
  :root[data-sidebar="collapsed"] .sidebar .sb-action,
  :root[data-sidebar="collapsed"] .sidebar .sb-chev { display: none; }
  :root[data-sidebar="collapsed"] .sidebar .sb-btn,
  :root[data-sidebar="collapsed"] .sidebar .sb-device { width: 32px; padding: 8px; justify-content: center; }
  :root[data-sidebar="collapsed"] .sidebar .sb-device { padding: 0; height: 48px; }
  :root[data-sidebar="collapsed"] .sidebar .sb-owner { padding: 0; height: 32px; }
  :root[data-sidebar="collapsed"] .sidebar .sb-content { overflow: visible; }
  :root[data-sidebar="collapsed"] .sidebar .sb-badge { position: absolute; top: 5px; right: 5px; min-width: 8px; width: 8px; height: 8px; padding: 0; font-size: 0; }
}

/* узкий экран: боковая панель — шторка поверх содержимого */
@media (max-width: 767px) {
  body { background: var(--background); }
  .sidebar {
    position: fixed; z-index: 50; left: 0; top: 0; bottom: 0; width: 18rem; max-width: 85vw;
    transform: translateX(-100%); transition: transform .2s ease; border-right: 1px solid var(--sidebar-border);
    visibility: hidden;
  }
  .sidebar.open { transform: none; visibility: visible; }
  .sb-overlay { position: fixed; inset: 0; z-index: 40; background: rgb(0 0 0 / .5); }
  .inset { margin: 0; border: 0; border-radius: 0; box-shadow: none; min-height: 100dvh; }
}

/* ---------- строка над содержимым ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px; height: 48px; flex: none;
  padding: 0 16px 0 12px; border-bottom: 1px solid var(--border); background: var(--background);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}
.vsep { width: 1px; height: 16px; background: var(--border); flex: none; margin: 0 4px; }
.crumbs { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted-foreground); white-space: nowrap; overflow: hidden; }
.crumbs a { text-decoration: none; transition: color .15s; }
.crumbs a:hover { color: var(--foreground); }
.crumbs .ic { width: 14px; height: 14px; }
.crumbs [aria-current] { color: var(--foreground); overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 8px; flex: none; }
@media (max-width: 767px) { .topbar { border-radius: 0; padding: 0 12px 0 8px; } }
#sb-trigger { position: relative; }
.trigger-dot { display: none; }
@media (max-width: 767px) {
  .trigger-dot {
    display: block; position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%;
    background: var(--badge-warn-bg); box-shadow: 0 0 0 2px var(--background);
  }
  .trigger-dot.critical { background: var(--badge-crit-bg); }
}
@media (max-width: 520px) { .hide-sm { display: none; } #new-group-btn { width: 32px; padding: 0; } }

.page { padding: 16px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (min-width: 1024px) { .page { padding: 24px; } }

/* ---------- таблица приложений ---------- */
.table-card { overflow: hidden; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  height: 40px; padding: 0 12px; text-align: left; font-size: 12px; font-weight: 500; color: var(--muted-foreground);
  white-space: nowrap; border-bottom: 1px solid var(--border);
}
.table td { padding: 10px 12px; border-top: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:first-child td { border-top: 0; }
.table tr.row:hover td { background: color-mix(in oklab, var(--muted) 50%, transparent); }
.table .c-act { width: 84px; text-align: right; padding-right: 8px; }
.act-cell { display: flex; justify-content: flex-end; align-items: center; gap: 2px; }
.quick .ic { width: 14px; height: 14px; fill: currentColor; }
.quick[data-quick="start"] { color: var(--success-text); }
.quick:disabled { opacity: .5; }

/* перетаскивание в группу: ручка ⋮⋮ у названия, «призрак» у пальца или курсора, подсветка цели */
.drag-handle {
  display: inline-grid; place-items: center; flex: none; width: 20px; height: 24px; margin: 0 -4px 0 -6px; padding: 0;
  border: 0; border-radius: var(--radius-sm); background: none; color: var(--muted-foreground); cursor: grab;
  touch-action: none; opacity: 0; transition: opacity .15s;
}
.drag-handle .ic { width: 16px; height: 16px; }
.table tr.row:hover .drag-handle, .drag-handle:focus-visible { opacity: 1; }
.drag-handle:hover { background: var(--accent); color: var(--foreground); }
@media (hover: none) { .drag-handle { opacity: .75; } }
:root.dragging, :root.dragging * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }
.drag-ghost {
  position: fixed; left: 0; top: 0; z-index: 100; pointer-events: none; display: flex; align-items: center; gap: 8px;
  max-width: min(340px, 80vw); padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--popover); color: var(--foreground); box-shadow: var(--shadow-pop); font-size: 13px; font-weight: 500;
}
.drag-ghost .ic { width: 14px; height: 14px; flex: none; color: var(--muted-foreground); }
.drag-ghost .dg-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drag-ghost .dg-to { color: var(--info); white-space: nowrap; }
.drag-ghost .dg-to:empty { display: none; }
.table tr.drop-on td { background: color-mix(in oklab, var(--info) 10%, transparent) !important; box-shadow: inset 0 1px 0 color-mix(in oklab, var(--info) 45%, transparent), inset 0 -1px 0 color-mix(in oklab, var(--info) 45%, transparent); }
.sb-btn.drop-on { background: color-mix(in oklab, var(--info) 14%, transparent); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--info) 45%, transparent); }
.table .c-when, .table .c-type { white-space: nowrap; color: var(--muted-foreground); }
.table .c-when { font-variant-numeric: tabular-nums; font-size: 13px; }
.app-name { font-weight: 500; overflow-wrap: anywhere; }
.name-cell { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.link { display: inline-flex; align-items: center; gap: 4px; color: var(--muted-foreground); text-decoration: none; max-width: 100%; }
.link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link:hover { color: var(--foreground); text-decoration: underline; text-underline-offset: 3px; }
.link .ic { width: 14px; height: 14px; }
tr.grp td { background: color-mix(in oklab, var(--muted) 55%, transparent); padding: 4px 8px 4px 8px; }
.grp-row { display: flex; align-items: center; gap: 4px; min-height: 32px; }
.grp-toggle {
  display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 6px; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--foreground); font: 500 14px/1 var(--font); cursor: pointer; min-width: 0;
}
.grp-toggle:hover { background: var(--accent); }
.grp-toggle .chev { color: var(--muted-foreground); transition: transform .15s; }
.grp-toggle[aria-expanded="false"] .chev { transform: rotate(-90deg); }
.grp-toggle .fold { color: var(--muted-foreground); }
.grp-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grp-count { color: var(--muted-foreground); font-weight: 400; font-variant-numeric: tabular-nums; }
.grp-row .btn { margin-left: auto; }
.grp-plain { padding: 0 6px; font-weight: 500; color: var(--muted-foreground); }
td.empty-row { color: var(--muted-foreground); font-size: 13px; padding: 14px 12px; }

@media (max-width: 639px) {
  .table, .table tbody { display: block; }
  .table thead { display: none; }
  .table tr.row {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; row-gap: 4px;
    padding: 12px 8px 12px 12px; border-top: 1px solid var(--border);
  }
  .table tbody tr.row:first-child { border-top: 0; }
  .table tr.row td { display: block; padding: 0; border: 0; background: none !important; min-width: 0; }
  .table tr.row .c-name { grid-column: 1; grid-row: 1; }
  .table tr.row .c-link { grid-column: 1; grid-row: 2; font-size: 13px; }
  .table tr.row .c-status { grid-column: 1; grid-row: 3; padding-top: 4px; }
  .table tr.row .c-act { grid-column: 2; grid-row: 1 / span 3; align-self: center; width: auto; padding: 0; }
  .table tr.row .c-type, .table tr.row .c-when { display: none; }
  .table tr.grp, .table tr.empty { display: block; border-top: 1px solid var(--border); }
  .table tbody tr:first-child { border-top: 0; }
  .table tr.grp td, .table tr.empty td { display: block; border: 0; }
}

.empty { padding: 40px 24px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.empty h2 { font-size: 16px; font-weight: 600; margin-top: 8px; }
.empty .btn { margin-top: 12px; }
.empty-icon { width: 40px; height: 40px; border-radius: var(--radius-md); background: var(--muted); display: grid; place-items: center; }
.empty-icon .ic { width: 20px; height: 20px; }
.page-err { padding: 0 4px; }

/* ---------- окна ---------- */
.dlg {
  width: min(32rem, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; overflow: auto;
  border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--background); color: var(--foreground);
  box-shadow: var(--shadow-dialog);
}
.dlg.wide { width: min(56rem, calc(100vw - 32px)); }
.dlg.narrow { width: min(26rem, calc(100vw - 32px)); }
.dlg::backdrop { background: rgb(0 0 0 / .5); }
.dlg-b { position: relative; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.dlg-h { display: flex; flex-direction: column; gap: 6px; padding-right: 32px; }
.dlg-h h2 { font-size: 18px; font-weight: 600; line-height: 1.3; letter-spacing: -.01em; overflow-wrap: anywhere; }
.dlg-h p { font-size: 14px; }
.dlg-x { position: absolute; top: 14px; right: 14px; color: var(--muted-foreground); }
.dlg-f { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding-top: 4px; }
@media (max-width: 520px) {
  .grid2 { grid-template-columns: 1fr; }
  .dlg-b { padding: 20px 16px; }
  .dlg-f { flex-direction: column-reverse; }
  .dlg-f .btn { width: 100%; }
}
.drop {
  border: 1px dashed var(--border); border-radius: var(--radius-lg); padding: 20px 16px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 8px; transition: border-color .15s, background .15s;
}
.drop.over { border-color: var(--ring); background: var(--muted); }
.drop-icon { width: 36px; height: 36px; border-radius: 9999px; background: var(--muted); display: grid; place-items: center; color: var(--muted-foreground); }
.drop-pick { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.picked { font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
.progress { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.progress .track { flex: 1; height: 8px; border-radius: 9999px; background: var(--muted); overflow: hidden; }
.progress .bar { height: 100%; width: 0; background: var(--primary); border-radius: inherit; transition: width .2s; }
.detect { display: flex; flex-direction: column; gap: 12px; padding: 12px; border-radius: var(--radius-md); background: var(--muted); }
.detect p { font-size: 13px; }
.env { display: flex; flex-direction: column; gap: 8px; }
.env-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) 36px; gap: 8px; }
.env-row .env-k { font-family: var(--mono); font-size: 13px; }
.logs {
  margin: 0; max-height: 60dvh; overflow: auto; padding: 12px; border-radius: var(--radius-md); background: var(--muted);
  font: 12px/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere;
}

/* ---------- выпадающее меню ---------- */
.menu {
  position: fixed; z-index: 60; min-width: 12rem; max-width: calc(100vw - 16px); padding: 4px;
  background: var(--popover); color: var(--foreground); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
}
.menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%; height: 32px; padding: 0 8px; border: 0; border-radius: var(--radius-sm);
  background: none; color: inherit; font: 400 14px/1 var(--font); text-align: left; cursor: pointer; white-space: nowrap;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--accent); outline: none; }
.menu-item .ic { color: var(--muted-foreground); }
.menu-item .tick { margin-left: auto; color: var(--foreground); }
.menu-item.danger { color: var(--destructive-text); }
.menu-item.danger .ic { color: inherit; }
.menu-item.danger:hover { background: var(--destructive-soft); }
.menu-sep { height: 1px; background: var(--border); margin: 4px -4px; }
.menu-label { padding: 6px 8px; font-size: 12px; font-weight: 500; color: var(--muted-foreground); }

/* ---------- подсказка и уведомления ---------- */
.tip {
  position: fixed; z-index: 70; padding: 6px 10px; border-radius: var(--radius-sm); pointer-events: none;
  background: var(--primary); color: var(--primary-foreground); font-size: 12px; font-weight: 500; white-space: nowrap;
}
.toaster { position: fixed; z-index: 80; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; width: min(22rem, calc(100vw - 32px)); pointer-events: none; }
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 14px 16px; border-radius: var(--radius-lg);
  background: var(--popover); color: var(--foreground); border: 1px solid var(--border); box-shadow: var(--shadow-pop);
  font-size: 14px; overflow-wrap: anywhere; pointer-events: auto; animation: toast-in .2s ease;
}
.toast .ic { margin-top: 2px; color: var(--success); }
.toast.error .ic { color: var(--destructive); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@media (max-width: 520px) { .toaster { right: 16px; left: 16px; width: auto; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---------- мониторинг ---------- */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--muted); border-radius: var(--radius-md); }
.seg button {
  height: 26px; padding: 0 10px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--muted-foreground);
  font: 500 13px/1 var(--font); cursor: pointer; white-space: nowrap;
}
.seg button:hover { color: var(--foreground); }
.seg button[aria-checked="true"] { background: var(--background); color: var(--foreground); box-shadow: var(--shadow-xs); }
.merge-wrap .seg { align-self: flex-start; }
.merge-wrap .seg button { padding: 0 12px; }
.merge-wrap .hint { margin: 2px 0 0; }
.attn { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.attn-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; }
.attn-head .badge .ic { width: 14px; height: 14px; }
.attn-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.attn-list li { display: flex; align-items: center; gap: 10px; font-size: 14px; flex-wrap: wrap; }
.attn.critical { border-color: color-mix(in oklab, var(--destructive) 35%, var(--border)); }
.attn.warning { border-color: color-mix(in oklab, var(--warning) 35%, var(--border)); }
.attn-cap { font-size: 13px; padding-top: 10px; border-top: 1px solid var(--border); }
.mrows { overflow: hidden; }
.mrow { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; align-items: center; padding: 16px 20px; }
.mrow + .mrow { border-top: 1px solid var(--border); }
.mlabel { font-size: 13px; color: var(--muted-foreground); }
.mvalue { font-size: 24px; font-weight: 600; letter-spacing: -.02em; line-height: 1.3; margin-top: 2px; }
.munit { font-size: 14px; font-weight: 500; color: var(--muted-foreground); letter-spacing: 0; }
.mbar { height: 6px; border-radius: 9999px; background: var(--muted); margin-top: 8px; overflow: hidden; }
.mbar > div { height: 100%; border-radius: inherit; background: var(--primary); }
.msub { font-size: 12px; color: var(--muted-foreground); margin-top: 6px; }
.legend { display: flex; gap: 14px; margin-top: 8px; font-size: 12px; color: var(--muted-foreground); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 12px; height: 2px; border-radius: 2px; }
.mchart { position: relative; height: 104px; min-width: 0; }
.chart svg { display: block; overflow: visible; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--muted-foreground); font: 11px var(--font); font-variant-numeric: tabular-nums; }
.chart .nodata { fill: var(--muted-foreground); font: 12px var(--font); }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { opacity: .08; }
.chart .cross { stroke: var(--muted-foreground); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .dot { stroke: var(--background); stroke-width: 2; }
.chart-tip {
  position: absolute; z-index: 5; min-width: 132px; padding: 8px 10px; pointer-events: none;
  background: var(--popover); color: var(--foreground); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop); font-size: 12px;
}
.chart-tip .tm { color: var(--muted-foreground); margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.chart-tip .row { display: flex; align-items: center; gap: 6px; }
.chart-tip .row b { margin-left: auto; padding-left: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-tip .sw { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.tscroll { overflow-x: auto; }
.mtable th.r, .mtable td.r { text-align: right; }
.mtable td { white-space: nowrap; }
.small { font-size: 12px; }
@media (max-width: 767px) {
  .mrow { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 14px 16px; }
  .seg button { padding: 0 8px; font-size: 12px; }
}
@media (max-width: 639px) {
  .mtable thead { display: none; }
  .mtable tr.mrowapp {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 12px;
    padding: 12px; border-top: 1px solid var(--border);
  }
  .mtable tbody tr.mrowapp:first-child { border-top: 0; }
  .mtable tr.mrowapp td { display: block; padding: 0; border: 0; white-space: normal; text-align: left; background: none !important; min-width: 0; }
  .mtable td.c-n { grid-column: 1 / span 2; }
  .mtable td.c-s { grid-column: 3 / span 2; justify-self: end; }
  .mtable td.r { font-size: 13px; }
  .mtable td.r::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted-foreground); }
  .mtable td.c-s .badge { white-space: nowrap; }
}

/* ---------- страница проекта и версии ---------- */
.seg a {
  display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: var(--radius-sm);
  color: var(--muted-foreground); font: 500 13px/1 var(--font); text-decoration: none; white-space: nowrap;
}
.seg a:hover { color: var(--foreground); }
.seg a[aria-selected="true"] { background: var(--background); color: var(--foreground); box-shadow: var(--shadow-xs); }
.app-link { color: inherit; text-decoration: none; }
.app-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.proj-head { padding: 16px; display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 18px; }
.proj-thumb {
  position: relative; aspect-ratio: 16 / 10; border-radius: var(--radius-md); overflow: hidden;
  background: var(--muted); border: 1px solid var(--border); display: grid; place-items: center;
}
.proj-thumb iframe { position: absolute; left: 0; top: 0; width: 1280px; height: 800px; border: 0; transform-origin: 0 0; pointer-events: none; background: #fff; }
.proj-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-icon .ic { width: 28px; height: 28px; color: var(--muted-foreground); }
.proj-info { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.proj-titlerow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.proj-title { font-size: 18px; font-weight: 600; letter-spacing: -.01em; line-height: 1.3; overflow-wrap: anywhere; }
.proj-url { font-weight: 500; color: var(--success-text); max-width: 100%; }
.proj-meta { font-size: 13px; overflow-wrap: anywhere; }
.proj-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.proj-drop { padding: 16px; }
.vcard, .page > section.card { padding: 16px; }
.sec-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.sec-h h2 { font-size: 15px; font-weight: 600; }
.vlist { display: flex; flex-direction: column; }
.vitem { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 8px; border-top: 1px solid var(--border); cursor: pointer; border-radius: var(--radius-md); }
.vitem:first-child { border-top: 0; }
.vitem:hover { background: color-mix(in oklab, var(--muted) 60%, transparent); }
.vitem.cur { background: var(--success-soft); }
.vnum { color: var(--muted-foreground); font-size: 13px; font-variant-numeric: tabular-nums; }
.vtitle { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vtitle b { font-weight: 500; }
.vmain small { display: block; margin-top: 2px; font-size: 12px; overflow-wrap: anywhere; }
.vact { display: flex; align-items: center; gap: 4px; }
.vmore { display: flex; justify-content: center; padding-top: 10px; }
.vhead { display: flex; flex-direction: column; gap: 6px; }
.vhead .link { display: inline-flex; align-items: center; gap: 6px; color: var(--success-text); font-weight: 500; text-decoration: none; }
.frow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 6px 0; border-top: 1px solid var(--border); font-size: 13px; }
.frow:first-child { border-top: 0; }
.fpath { overflow-wrap: anywhere; min-width: 0; }
.frow .link { color: var(--foreground); font-weight: 500; }
.tag { font-size: 10px; font-weight: 600; border-radius: 4px; padding: 1px 5px; letter-spacing: .02em; }
.tag.new { background: var(--success-soft); color: var(--success-text); }
.tag.chg { background: color-mix(in oklab, var(--info) 12%, transparent); color: var(--info); }
.tag.del { background: var(--destructive-soft); color: var(--destructive-text); }
.srow { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 7px 0; border-top: 1px solid var(--border); font-size: 14px; }
.vlog { margin-top: 10px; max-height: 360px; }
.ftree details > summary { list-style: none; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 0; border-top: 1px solid var(--border); cursor: pointer; font-size: 13px; }
.ftree details > summary::-webkit-details-marker { display: none; }
.ftree > details:first-child > summary, .ftree > .frow:first-child { border-top: 0; }
.fchildren { padding-left: 18px; }
.ficon .ic { width: 15px; height: 15px; color: var(--muted-foreground); }
.fsearch { max-width: 260px; height: 32px; }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.danger-zone h2 { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.proj-settings { padding: 0; }
#settings-form.inline .dlg-x, #settings-form.inline [data-close] { display: none; }
@media (max-width: 639px) {
  .proj-head { grid-template-columns: minmax(0, 1fr); }
  .vitem { grid-template-columns: 32px minmax(0, 1fr); }
  .vitem .vact { grid-column: 2; justify-content: flex-start; }
  .frow { grid-template-columns: auto minmax(0, 1fr) auto; }
  .frow .num { display: none; }
  .fsearch { max-width: none; }
  #actions-project .seg a { padding: 0 7px; font-size: 12px; }
}

/* ---------- ролики проекта ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.seg .tab-n {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; margin-left: 6px; padding: 0 5px; border-radius: 999px;
  background: color-mix(in oklab, var(--muted-foreground) 16%, transparent); font-size: 11px; font-variant-numeric: tabular-nums;
}
.sec-h h2 .muted { font-weight: 400; }
.clips-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.clips-hl h2 { font-size: 15px; font-weight: 600; }
.clips-hl p { font-size: 13px; margin-top: 2px; }
.clips-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.clips-card { container: clips / inline-size; }
.clips { display: flex; flex-direction: column; }
.clip {
  display: grid; grid-template-columns: 176px minmax(0, 1fr) auto; gap: 16px; align-items: center;
  padding: 12px 0; border-top: 1px solid var(--border); scroll-margin: 64px 0 16px; /* не под липкой верхней строкой */
}
.clip:first-child { border-top: 0; }
.clip.flash { animation: clip-flash 1.8s ease-out; }
@keyframes clip-flash {
  from { background: color-mix(in oklab, var(--info) 14%, transparent); box-shadow: 0 0 0 8px color-mix(in oklab, var(--info) 14%, transparent); }
  to { background: transparent; box-shadow: 0 0 0 8px transparent; }
}
/* Строка из частей через «·»: части переносятся целиком, точка в начале строки срезается. */
.dots { display: flex; flex-wrap: wrap; margin-left: -13px; clip-path: inset(0 0 0 13px); }
.dots > * { position: relative; min-width: 0; margin-left: 13px; } /* часть переносится внутри, только если не влезает и одна */
.dots .d { position: absolute; left: -13px; width: 13px; text-align: center; font-weight: inherit; }
.clip-thumb, .mini-thumb {
  position: relative; display: grid; place-items: center; aspect-ratio: 16 / 9; overflow: hidden;
  border-radius: var(--radius-md); background: var(--muted); border: 1px solid var(--border);
}
.clip-thumb img, .mini-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.clip-dur {
  position: absolute; right: 6px; bottom: 6px; padding: 2px 5px; border-radius: 4px;
  background: rgb(0 0 0 / .78); color: #fff; font: 500 11px/1.25 var(--font); font-variant-numeric: tabular-nums;
}
.clip-play { position: absolute; inset: 0; display: grid; place-items: center; background: rgb(0 0 0 / .3); opacity: 0; transition: opacity .15s; }
.clip-play .ic { width: 30px; height: 30px; color: #fff; fill: #fff; }
.clip-thumb:hover .clip-play, .clip-thumb:focus-visible .clip-play { opacity: 1; }
.clip-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.clip-titlerow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.clip-titlerow .badge { max-width: 100%; height: auto; min-height: 22px; padding-top: 3px; padding-bottom: 3px; white-space: normal; }
.clip-title {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; margin-left: -6px; padding: 2px 6px;
  border: 0; border-radius: var(--radius-sm); background: none; color: var(--foreground); font: 500 15px/1.35 var(--font); text-align: left; cursor: pointer;
}
.clip-title span { overflow-wrap: anywhere; }
.clip-title:hover { background: var(--muted); }
.clip-pen { width: 14px; height: 14px; flex: none; color: var(--muted-foreground); opacity: 0; transition: opacity .15s; }
.clip-title:hover .clip-pen, .clip-title:focus-visible .clip-pen { opacity: 1; }
@media (hover: none) {
  .clip-pen { opacity: .7; }
  .kbd-hint { display: none; }
  .clip-edit .input { font-size: 16px; } /* iPhone не увеличивает страницу при вводе */
}
.clip-facts, .clip-stats { font-size: 13px; }
.dots > .clip-file { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.clip-nothumbs { text-decoration: underline dotted; text-underline-offset: 3px; cursor: help; }
.clip-act { display: flex; align-items: center; gap: 4px; }
.clip .clip-copy { min-width: 128px; justify-content: center; }
.clip-copy.copied { color: var(--success-text); border-color: color-mix(in oklab, var(--success) 45%, var(--border)); }
.clip-edit { display: flex; flex-direction: column; gap: 4px; }
.clip-edit-row { display: flex; align-items: center; gap: 6px; }
.clip-edit .input { height: 34px; max-width: 560px; font-weight: 500; }
.clip-edit .hint { font-size: 12px; }
.clips-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 13px;
}
@container clips (max-width: 620px) {
  .clips-open-l { display: none; }
  #clips-open { width: 32px; padding: 0; }
  .clip { grid-template-columns: 128px minmax(0, 1fr); gap: 8px 12px; align-items: start; }
  .clip-title { font-size: 14px; }
  .clip-act { grid-column: 1 / -1; }
  .clip .clip-copy { flex: 1; }
}
@container clips (max-width: 360px) {
  .clip { grid-template-columns: 96px minmax(0, 1fr); }
}
.minis { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px 12px; }
.mini { display: flex; flex-direction: column; gap: 4px; min-width: 0; color: inherit; text-decoration: none; border-radius: var(--radius-md); }
.mini-thumb { margin-bottom: 2px; }
.mini:hover .mini-title { text-decoration: underline; text-underline-offset: 3px; }
.mini-title { font-size: 13px; font-weight: 500; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.mini-sub { font-size: 12px; }

/* превью проекта «Документы»: заголовок главного документа и следующие */
.proj-thumb.thumb-docs { place-items: stretch; background: var(--card); }
.thumb-doc { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; min-width: 0; overflow: hidden; }
.thumb-doc-ic { color: var(--muted-foreground); }
.thumb-doc b { font-size: 15px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.thumb-doc ul { margin: 2px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted-foreground); }
.thumb-doc li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb-doc li::before { content: "— "; }

/* документы проекта «Документы» */
.docs-list { display: flex; flex-direction: column; }
.doc { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--border); }
.doc:first-child { border-top: 0; }
.doc-ic { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-md); background: var(--muted); color: var(--muted-foreground); }
.doc-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.doc-title { font-size: 15px; font-weight: 500; color: inherit; text-decoration: none; overflow-wrap: anywhere; }
.doc-title:hover { text-decoration: underline; text-underline-offset: 3px; }
.doc .clip-copy { min-width: 128px; justify-content: center; }
@container clips (max-width: 620px) {
  #docs-open span { display: none; }
  #docs-open { width: 32px; padding: 0; }
  .doc { grid-template-columns: 36px minmax(0, 1fr); gap: 8px 12px; }
  .doc .clip-act { grid-column: 1 / -1; }
  .doc .clip-copy { flex: 1; }
}
.docs-mini { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px 12px; }
.doc-mini { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 6px; border-radius: var(--radius-md); color: inherit; text-decoration: none; }
.doc-mini:hover { background: color-mix(in oklab, var(--muted) 60%, transparent); }
.doc-mini-t { display: flex; flex-direction: column; min-width: 0; }
.doc-mini-t b { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-mini-t small { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* место в истории версий */
.vsize-h { align-items: flex-start; }
.vsize-sum { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 13px; text-align: right; }
.vsize-sum b { font-weight: 600; font-variant-numeric: tabular-nums; }
.vsize-sum small { font-size: 12px; }
.vsize-note { font-size: 12px; margin: -2px 0 8px; }
@media (max-width: 640px) { .vsize-sum { align-items: flex-start; text-align: left; } }
@media (max-width: 639px) {
  .topbar.has-tabs { height: auto; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; row-gap: 8px; }
  .topbar.has-tabs #actions-project { order: 5; flex: 1 0 100%; }
  .clip { scroll-margin-top: 104px; } /* верхняя строка с вкладками — в два ряда */
  #actions-project .seg { display: flex; width: 100%; }
  #actions-project .seg a { flex: 1; justify-content: center; padding: 0 4px; }
  .minis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Python и фоновые процессы ---------- */
.worker-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.worker-chip .ic { width: 14px; height: 14px; }
.proj-worker { font-weight: 500; }
.proj-thumb.thumb-term { place-items: stretch; background: #0b0b0d; border-color: #27272a; }
.thumb-log {
  margin: 0; padding: 8px 10px; overflow: hidden; color: #d4d4d8; background: transparent;
  font: 10px/1.45 var(--mono); white-space: pre-wrap; word-break: break-all;
  display: flex; flex-direction: column; justify-content: flex-end; /* свежие строки — внизу, как в терминале */
}
/* ход публикации в окне загрузки: полоса, шаги, журнал */
.up-fields { display: flex; flex-direction: column; gap: 16px; }
.up-fields[hidden] { display: none; }
.pub { display: flex; flex-direction: column; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-md); background: color-mix(in oklab, var(--muted) 50%, transparent); }
.pub[hidden] { display: none; }
.pub-h { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.pub-h b { font-weight: 600; }
.pub-h b::after { content: ""; display: inline-block; width: 8px; height: 8px; margin-left: 8px; border-radius: 50%; background: var(--warning); animation: pend 1.2s ease-in-out infinite; vertical-align: 1px; }
.pub.ok .pub-h b::after { background: var(--success); animation: none; }
.pub.bad .pub-h b::after { background: var(--destructive); animation: none; }
@keyframes pend { 50% { opacity: .25; } }
.pub-h .muted { margin-left: auto; }
/* идёт шаг без счётчика — полоса «дышит» штриховкой */
.pub .track { background: color-mix(in oklab, var(--foreground) 10%, transparent); }
.pub .bar { --stripe: color-mix(in oklab, var(--primary-foreground) 28%, transparent); }
.pub .bar.busy { background-image: linear-gradient(-45deg, var(--stripe) 25%, transparent 25% 50%, var(--stripe) 50% 75%, transparent 75%); background-size: 16px 16px; animation: pub-busy .8s linear infinite; }
@keyframes pub-busy { to { background-position: 16px 0; } }
.pub.ok .bar { background: var(--success); }
.pub.bad .progress { display: none; } /* где остановилась — видно по шагам */
.pub-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pub-step { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 5px 0; font-size: 14px; }
.pub-step .pub-ic { display: grid; place-items: center; width: 18px; height: 18px; }
.pub-step .pub-ic .ic { width: 16px; height: 16px; }
.pub-step .pub-val { font-size: 13px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; text-align: right; }
.pub-step.done .pub-ic { color: var(--success); }
.pub-step.failed .pub-ic, .pub-step.failed .pub-val { color: var(--destructive); }
.pub-step.running { font-weight: 600; }
.pub-step.pending, .pub-step.skipped { color: var(--muted-foreground); }
.pub-dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid currentColor; opacity: .7; }
.pub-skip { width: 9px; height: 1.5px; background: currentColor; opacity: .7; }
.pub-spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid color-mix(in oklab, var(--primary) 25%, transparent); border-top-color: var(--primary); animation: pub-spin .8s linear infinite; }
@keyframes pub-spin { to { transform: rotate(360deg); } }
.pub-logw summary { cursor: pointer; font-size: 13px; color: var(--muted-foreground); }
.pub-log { margin-top: 8px; max-height: 12em; font-size: 11px; word-break: break-all; }

/* ---------- редактор кода ---------- */
.ed-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px !important; }
.ed-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; min-width: 0; }
.ed-actions { display: flex; align-items: center; gap: 8px; }
.ed-result { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.ed-res-h { display: flex; align-items: center; gap: 8px; }
.ed-res-h .ic { width: 16px; height: 16px; }
.ed-res-h.ok .ic { color: var(--success); }
.ed-res-h.bad .ic { color: var(--destructive); }
.ed-res-act { display: flex; gap: 8px; flex-wrap: wrap; }
.ed-errs { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.ed-errs li { display: flex; gap: 8px; flex-wrap: wrap; }
.ed-errs .link { font: 500 13px var(--mono); color: var(--destructive-text); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; }
.ed-errs span { color: var(--muted-foreground); font-family: var(--mono); overflow-wrap: anywhere; }
.ed-log { max-height: 260px; margin: 0; }
.ed-main { display: grid; grid-template-columns: 250px minmax(0, 1fr); padding: 0 !important; overflow: hidden; height: max(420px, calc(100dvh - 230px)); }
.ed-side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--border); background: color-mix(in oklab, var(--muted) 35%, transparent); }
.ed-side-h { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 6px 6px 6px 10px; border-bottom: 1px solid var(--border); }
.ed-side-t { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--foreground); font: 600 13px var(--font); padding: 4px 2px; cursor: default; }
.ed-side-t .ic { width: 15px; height: 15px; color: var(--muted-foreground); }
.ed-side-act { display: flex; gap: 2px; }
.ed-tree { flex: 1; overflow: auto; padding: 4px 0; font-size: 13px; }
.ed-row { display: flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 6px 0 calc(var(--d, 0) * 14px + 8px); cursor: pointer; user-select: none; position: relative; }
.ed-row:hover { background: color-mix(in oklab, var(--muted) 80%, transparent); }
.ed-row:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.ed-file.active { background: color-mix(in oklab, var(--info) 14%, transparent); }
.ed-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-chev, .ed-ficon { width: 14px; height: 14px; flex: none; color: var(--muted-foreground); }
.ed-st { font: 600 11px var(--mono); width: 14px; text-align: center; flex: none; }
.st-added .ed-st, .st-added .ed-name { color: var(--success-text); }
.st-modified .ed-st, .st-modified .ed-name { color: var(--warning-text); }
.ed-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--warning); flex: none; }
.ed-rowmenu { display: inline-grid; place-items: center; width: 22px; height: 22px; border: 0; border-radius: 4px; background: none; color: var(--muted-foreground); cursor: pointer; opacity: 0; flex: none; }
.ed-rowmenu .ic { width: 14px; height: 14px; }
.ed-row:hover .ed-rowmenu, .ed-row:focus-within .ed-rowmenu, .ed-rowmenu[aria-expanded="true"] { opacity: 1; }
@media (hover: none) { .ed-rowmenu { opacity: 1; } }
.ed-deleted { border-top: 1px solid var(--border); font-size: 13px; max-height: 30%; overflow: auto; }
.ed-deleted:empty { display: none; }
.ed-del-h { margin: 0; padding: 6px 10px 2px; color: var(--muted-foreground); font-size: 12px; }
.ed-gone { cursor: default; padding-left: 10px; }
.ed-gone .ed-name { text-decoration: line-through; color: var(--muted-foreground); }
.ed-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.ed-file-h { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 4px 8px 4px 12px; border-bottom: 1px solid var(--border); }
.ed-path { font: 500 13px var(--mono); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-save { margin-left: auto; font-size: 12px; color: var(--muted-foreground); white-space: nowrap; }
.ed-save.bad { color: var(--destructive-text); white-space: normal; }
.ed-file-act { display: flex; gap: 2px; }
.ed-file-act .btn[aria-pressed="true"] { background: var(--accent); color: var(--foreground); }
.ed-body { flex: 1; min-height: 0; position: relative; }
.ed-hint { padding: 16px; font-size: 14px; }
.ed-plain {
  width: 100%; height: 100%; display: block; resize: none; border: 0; outline: none; padding: 10px 12px;
  background: var(--background); color: var(--foreground); font: 13px/1.55 var(--mono); tab-size: 2; white-space: pre; overflow: auto;
}
.ed-bin { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; height: 100%; padding: 16px; text-align: center; }
.ed-bin img { max-width: min(100%, 480px); max-height: 50%; object-fit: contain; border: 1px solid var(--border); border-radius: var(--radius-md); background: repeating-conic-gradient(var(--muted) 0 25%, transparent 0 50%) 0 0 / 16px 16px; }
.ed-bin .muted { font-size: 13px; max-width: 420px; }
.ed-bin-act { display: flex; gap: 8px; }
@media (max-width: 767px) {
  .ed-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); height: auto; }
  .ed-side { border-right: 0; border-bottom: 1px solid var(--border); }
  .ed-side .ed-tree { max-height: 40vh; }
  .ed-side-t { cursor: pointer; }
  .ed-side.collapsed .ed-tree, .ed-side.collapsed .ed-deleted { display: none; }
  .ed-body { flex: none; height: 60vh; } /* в колонке высотой «по содержимому» flex: 1 сжал бы поле до нуля */
  .ed-file-h { flex-wrap: wrap; }
  .ed-save { margin-left: 0; order: 5; flex-basis: 100%; }
  .ed-actions { width: 100%; }
  .ed-actions .btn:not(.btn-icon) { flex: 1; justify-content: center; }
}

/* мониторинг сервера: строка с именем, процессором и временем работы */
.mhost { display: flex; flex-direction: column; gap: 4px; padding: 14px 18px; }
.mhost-name { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.mhost-name b { font-weight: 600; overflow-wrap: anywhere; }
.mhost-facts { font-size: 13px; }
