/* ==========================================================================
   OctoClone Design System — octo.css
   shadcn/ui dark + violet accent, dark default, light via [data-theme="light"]
   Self-contained: templates load ONLY this file.
   ========================================================================== */

/* ── Variables ─────────────────────────────────────────────────────── */
:root {
  --bg: #0a0a0f;
  --bg-soft: #0f0f16;
  --card: #14141d;
  --card-hover: #1a1a26;
  --border: rgba(255,255,255,.08);
  --border-strong: rgba(255,255,255,.14);
  --text: #e7e7f0;
  --muted: #8e8ea3;
  --accent: #8b5cf6;
  --accent-hover: #7c3aed;
  --accent-soft: rgba(139,92,246,.16);
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #38bdf8;
  --radius: 14px;
  --radius-sm: 9px;
}

[data-theme="light"] {
  --bg: #f7f7fa;
  --bg-soft: #ffffff;
  --card: #ffffff;
  --card-hover: #f4f4f8;
  --border: #e6e6ee;
  --border-strong: #d4d4e0;
  --text: #18181f;
  --muted: #66667a;
  --accent: #7c3aed;
  --accent-hover: #6d28d9;
  --accent-soft: rgba(124,58,237,.10);
}

/* ── Reset & base ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* Thin scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* Accessibility focus rings */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Layout ────────────────────────────────────────────────────────── */
.octo-layout {
  display: flex;
  min-height: 100vh;
}

.octo-sidebar {
  width: 240px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--bg-soft);
  padding: 16px 12px;
}

.octo-main {
  flex: 1;
  min-width: 0;
  padding: 28px 32px;
  max-width: 1200px;
}

/* ── Logo ──────────────────────────────────────────────────────────── */
.octo-logo-tile {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .5px;
  user-select: none;
}

.octo-logo-text { display: flex; flex-direction: column; min-width: 0; }
.octo-logo-text .name { font-size: 14px; font-weight: 700; white-space: nowrap; }
.octo-logo-text .sub {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

/* ── Navigation ────────────────────────────────────────────────────── */
.octo-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  transition: background-color .15s ease, color .15s ease;
}
.nav-item:hover {
  background: var(--card-hover);
  color: var(--text);
}
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent);
}
.nav-item .icon { flex-shrink: 0; width: 16px; text-align: center; }

.nav-section {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--muted);
  padding: 14px 10px 5px;
}

.octo-sidebar-bottom {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Sidebar toggles & user ────────────────────────────────────────── */
.octo-toggles {
  display: flex;
  gap: 6px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  transition: background-color .15s ease, color .15s ease;
}
.icon-btn:hover {
  background: var(--card-hover);
  color: var(--text);
}

.user-block {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color .15s ease;
}
.user-block:hover { background: var(--card-hover); }

.user-avatar {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-size: 11px;
  color: var(--muted);
}
.user-chevron {
  margin-left: auto;
  color: var(--muted);
  flex-shrink: 0;
  font-size: 11px;
}

/* ── Page header ───────────────────────────────────────────────────── */
.page-header { margin-bottom: 24px; }
.page-title { font-size: 22px; font-weight: 700; letter-spacing: -.2px; }
.page-sub { font-size: 14px; color: var(--muted); margin-top: 3px; }

/* ── Cards & grids ─────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.card-pad-sm { padding: 14px 16px; }
.card-title { font-size: 15px; font-weight: 600; }
.card-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }

.grid {
  display: grid;
  gap: 16px;
}
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.stat-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.stat-card .stat-value { font-size: 24px; font-weight: 700; line-height: 1.2; }
.stat-card .stat-label { font-size: 12px; color: var(--muted); }

/* ── Forms ─────────────────────────────────────────────────────────── */
.field { margin-bottom: 14px; }
.label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
}

.input, .select, .textarea {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
[data-theme="light"] .input,
[data-theme="light"] .select,
[data-theme="light"] .textarea {
  background: var(--bg);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: .7; }
.textarea { resize: vertical; min-height: 80px; }

.hint { font-size: 12px; color: var(--muted); margin-top: 5px; }

.range-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.range-row .slider { flex: 1; min-width: 0; }
.range-row input[type="number"] { width: 76px; flex-shrink: 0; }

/* Range slider — cross-browser accent styling */
input[type="range"].slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: var(--border-strong);
  cursor: pointer;
}
input[type="range"].slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
  transition: background-color .15s ease;
}
input[type="range"].slider::-webkit-slider-thumb:hover { background: var(--accent-hover); }
input[type="range"].slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}
input[type="range"].slider::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: var(--border-strong);
}

/* Switch (checkbox toggle) */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  padding: 6px 0;
}
.switch-row .switch-label { font-size: 13.5px; }

.switch {
  -webkit-appearance: none;
  appearance: none;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--border-strong);
  position: relative;
  cursor: pointer;
  transition: background-color .15s ease;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform .15s ease;
}
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(16px); }
.switch:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Buttons ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease,
    border-color .15s ease, opacity .15s ease;
  white-space: nowrap;
}
.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.btn-primary {
  background: #fff;
  color: #111;
}
.btn-primary:hover:not(:disabled) { background: #e5e5e5; }
[data-theme="light"] .btn-primary {
  background: var(--accent);
  color: #fff;
}
[data-theme="light"] .btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.btn-outline:hover:not(:disabled) { background: var(--card-hover); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
}
.btn-ghost:hover:not(:disabled) { background: var(--card-hover); color: var(--text); }

.btn-danger {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
}
.btn-danger:hover:not(:disabled) {
  background: color-mix(in srgb, var(--danger) 20%, transparent);
}

.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; }

/* ── Tables & data ─────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.table th {
  text-align: left;
  padding: 11px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr { transition: background-color .15s ease; }
.table tbody tr:hover { background: var(--card-hover); }
.table tbody tr:first-child td { border-top: none; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}
.badge.b-pending {
  background: color-mix(in srgb, var(--warning) 14%, transparent);
  color: var(--warning);
}
.badge.b-processing {
  background: color-mix(in srgb, var(--info) 14%, transparent);
  color: var(--info);
}
.badge.b-completed {
  background: color-mix(in srgb, var(--success) 14%, transparent);
  color: var(--success);
}
.badge.b-failed {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: var(--danger);
}

.progress {
  height: 6px;
  background: var(--bg-soft);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width .2s ease;
}

/* Definition list */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; }
.kv dt { font-size: 12px; color: var(--muted); }
.kv dd { font-size: 13px; }

.empty {
  color: var(--muted);
  text-align: center;
  padding: 32px 16px;
  font-size: 13.5px;
}

/* ── Tabs ──────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.tab {
  padding: 9px 14px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  font-family: inherit;
  border-radius: 8px 8px 0 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s ease, border-color .15s ease;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; padding-top: 18px; }

/* ── Specific components ───────────────────────────────────────────── */
.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
.dropzone:hover,
.dropzone.over {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.pcard {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease,
    box-shadow .15s ease, background-color .15s ease;
}
.pcard:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  background: var(--card-hover);
}
.pcard.sel {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.pcard h4 { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.pcard .cap {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 600;
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--accent-soft);
  color: var(--accent);
}
.pcard p { font-size: 13px; color: var(--muted); margin-top: 6px; }
.pcard .soon {
  display: inline-block;
  margin-top: 8px;
  font-size: 10.5px;
  font-weight: 600;
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--muted);
}

.verdict {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
}
.verdict.v-copy {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
}
.verdict.v-unique {
  background: color-mix(in srgb, var(--success) 12%, transparent);
  color: var(--success);
}

.metric {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
}
.metric .num { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-weight: 600; }

.alert {
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
}
.alert-error {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
}
.alert-success {
  background: color-mix(in srgb, var(--success) 12%, transparent);
  color: var(--success);
}

/* Mini bar chart */
.bar-chart {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 8px;
  height: 140px;
}
.bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
  min-width: 0;
}
.bar-fill {
  background: var(--accent);
  border-radius: 6px 6px 0 0;
  min-height: 2px;
  transition: height .2s ease;
}
.bar-label {
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  margin-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Auth / landing ────────────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 380px;
  max-width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
}

.brand-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto;
  border-radius: 14px;
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: .5px;
  user-select: none;
}

.brand-name { font-size: 20px; font-weight: 700; margin-top: 14px; }
.brand-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }

.feature-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  margin-top: 10px;
}

/* ── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .octo-sidebar { display: none; }
  .octo-main { padding: 18px 16px; max-width: none; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* ── Компактные карточки профилей ── */
.pcard {
  position: relative;
  padding: 10px 58px 10px 12px;
  overflow: visible;
}
.pcard h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}
.pcard p { font-size: 10px; line-height: 1.35; margin: 0; color: var(--muted); }
.pcard .soon { font-size: 9px; }

/* Квадрат ёмкости — справа, компактный, по вертикали по центру.
   Ширина квадрата 34px; padding-right плашки (58px) больше 34+8. */
.pcard .cap2 {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border-left: 1px solid var(--border);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  user-select: none;
}
.pcard.muted { border-style: dashed; opacity: .8; }
.pcard.muted h4 { color: var(--muted); }
.pcard.muted .cap2 {
  color: var(--muted);
  background: var(--bg-soft);
}

/* Плашки режимов контента */
.ccard {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.ccard:hover { border-color: var(--border-strong); background: var(--card-hover); }
.ccard.sel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ccard h4 { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.ccard p { font-size: 10px; line-height: 1.35; margin: 0; color: var(--muted); }
.ccards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }

/* ── Тултипы профилей (п.9, CSS-only, hover) ── */
.pcard-tip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  width: 260px;
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 10px;
  line-height: 1.4;
  color: var(--muted);
  text-align: left;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
  z-index: 20;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
.pcard-tip .tip-title {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 3px;
}
.pcard-tip .tip-params {
  display: block;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 10px;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--muted);
}
.pcard-tip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--border-strong);
}
.pcard:hover .pcard-tip { opacity: 1; }

/* ── Компактная панель параметров профиля (п.6) ── */
#adv-params-view td { padding: 3px 8px; font-size: 10px; }
#adv-params-view td.hint { padding: 3px 8px; }

/* ── Активные контент-профили dionis / remix (п.7) ── */
.pcard .dionis-on {
  display: block;
  margin-top: 5px;
  font-size: 9px;
  font-weight: 600;
  color: var(--accent);
}

/* ── Спиннер ожидания (уникализация, п.6) ── */
.octo-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  border: 2px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  vertical-align: -2px;
  animation: octo-spin .8s linear infinite;
}
@keyframes octo-spin { to { transform: rotate(360deg); } }

/* ── Job detail page ─────────────────────────────────────────── */
.job-link { color: var(--accent); }
.job-link:hover { text-decoration: underline; }

.job-popover {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 420px;
  max-width: 100vw;
  overflow: auto;
  background: var(--card);
  border-left: 1px solid var(--border-strong);
  z-index: 50;
  padding: 18px;
  box-shadow: -10px 0 32px rgba(0, 0, 0, .3);
}
.job-popover[hidden] { display: none; }
@media (max-width: 560px) {
  .job-popover { width: 100%; border-left: none; }
}
.job-pop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.job-pop-title {
  font-size: 14px;
  font-weight: 600;
  word-break: break-all;
  min-width: 0;
}
.job-kv {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 4px 12px;
  font-size: 10px;
  margin: 0;
}
.job-kv dt { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.job-kv dd { margin: 0; word-break: break-all; font-family: ui-monospace, Consolas, monospace; }

.job-compare { display: flex; gap: 12px; }
.job-compare > div { flex: 1; min-width: 0; }
.job-compare video {
  width: 100%;
  max-height: 420px;
  background: #000;
  border-radius: 8px;
  display: block;
}
.job-cap { font-size: 11px; color: var(--muted); margin-top: 4px; text-align: center; }

.job-board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.job-vcard video {
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: 360px;
  background: #000;
  object-fit: contain;
  border-radius: 8px;
  display: block;
}
.job-vname {
  font-size: 12px;
  margin-top: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.job-vmetrics { font-size: 10px; color: var(--muted); margin-top: 2px; min-height: 14px; }
.job-vactions { display: flex; gap: 8px; margin-top: 8px; }
.job-src-title { font-size: 15px; font-weight: 600; margin: 20px 0 10px; }
.job-src-title:first-child { margin-top: 0; }

/* indeterminate progress for running jobs */
@keyframes job-ind {
  0% { margin-left: -40%; }
  100% { margin-left: 100%; }
}
.job-ind { animation: job-ind 1.4s ease-in-out infinite; }

/* Job popover: вертикальное сравнение (уникализированное сверху, оригинал под ним) */
.job-compare { flex-direction: column; }
.job-compare > div { width: 100%; }
.job-compare video { max-height: 300px; }

/* ── Users v2: компактная таблица без горизонтального скролла ─────── */
.users-wrap { overflow-x: hidden; }
.u-table { table-layout: fixed; }
.u-table td { overflow: hidden; }
.u-table .th-c, .u-table .td-c { text-align: center; }
.u-table .th-r, .u-table .td-r { text-align: right; }
.u-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.u-cell.link { color: var(--accent); font-weight: 600; }
.u-row { cursor: pointer; }
.u-acts { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.btn-xs { padding: 3px 8px; font-size: 11px; line-height: 1.5; border-radius: 7px; }
.u-flag { color: var(--muted); font-size: 13px; }
.u-flag.on { color: var(--accent); }
.u-flag.ok { color: #2e9e5b; }

/* user detail: бейджи роли */
.u-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  line-height: 1.5;
}
.u-badge.admin { background: var(--accent-soft); color: var(--accent); }
.u-badge.wait { background: rgba(217, 143, 43, .15); color: #d98f2b; }

/* ── Help v2: подразделы и таблицы справки ────────────────────────── */
.help-h {
  font-size: 13px;
  font-weight: 600;
  margin: 14px 0 4px;
}
.help-h:first-child { margin-top: 0; }
.help-t {
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0 0 4px;
}
.help-list { margin: 4px 0 10px; padding-left: 18px; }
.help-list li {
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  margin-bottom: 3px;
}
.help-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin: 6px 0 12px;
}
.help-table th {
  text-align: left;
  padding: 7px 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.help-table td {
  padding: 7px 10px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  line-height: 1.5;
  vertical-align: top;
}
.help-table td:first-child { color: var(--text); font-weight: 500; white-space: nowrap; }
.help-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  background: var(--card-hover);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 6px;
  white-space: nowrap;
}

/* ellipsis для узких заголовков таблиц v2 */
.u-table th {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.u-table th { padding-left: 8px; padding-right: 8px; }
/* ── Shell v2: octopus logo / flat nav icons / segmented toggles (п.6–п.8) ── */
.octo-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 12px;
}
.octo-brand-logo {
  display: block;
  flex-shrink: 0;
  border-radius: 11px;
  box-shadow: 0 3px 12px rgba(139, 92, 246, .35);
}

/* Flat inline SVG icons in nav & buttons */
.nav-item .icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: initial;
}
.nav-item .icon svg {
  width: 18px;
  height: 18px;
  display: block;
}
.nav-item:hover .icon { color: var(--text); }
.nav-item.active .icon { color: var(--accent); }

/* Segmented controls (theme / language) */
.octo-toggles {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}
.seg {
  display: flex;
  gap: 2px;
  padding: 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.seg-item {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 26px;
  padding: 0 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .15s ease, color .15s ease;
}
.seg-item svg {
  width: 13px;
  height: 13px;
  display: block;
  flex-shrink: 0;
}
.seg-item:hover { color: var(--text); }
.seg-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Logout button */
.octo-logout {
  font-size: 12px;
  padding: 6px 10px;
  color: var(--muted);
}
.octo-logout:hover { color: var(--text); }
.octo-logout .icon {
  width: 15px;
  height: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.octo-logout .icon svg {
  width: 15px;
  height: 15px;
  display: block;
}

/* Content presets: muted "none" card */
.ccard.muted { opacity: .55; }

/* ── Visual polish (kimi/bugfix-visual-polish) ─────────────────────── */
/* Brand: raster logo + large wordmark */
.octo-brand img.octo-brand-img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: block;
  flex-shrink: 0;
  box-shadow: 0 3px 12px rgba(139, 92, 246, .35);
}
.octo-brand .octo-logo-text .name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .2px;
}

/* One-line toggles: [RU|EN] segment + round theme icon button */
.octo-toggles {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.octo-toggles .seg { flex: 1; }
.octo-theme-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
}
.octo-theme-btn svg {
  width: 15px;
  height: 15px;
  display: block;
}

/* Logout as last nav item */
.nav-item-logout { color: var(--muted); }
.nav-item-logout:hover { color: var(--text); }

/* Compact job list table: fixed layout, no h-scroll */
.job-table { table-layout: fixed; font-size: 12px; }
.job-table th,
.job-table td { padding: 6px 8px; }
.job-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.job-table .dl-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  padding: 0;
}
.job-table .dl-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}

/* ZIP-all button: icon + text in one line */
.job-zip-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.job-zip-btn svg {
  width: 14px;
  height: 14px;
  display: block;
  flex-shrink: 0;
}

/* Metadata dropdowns: one line, wrap on narrow screens */
.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-top: 12px;
}
.meta-row .field {
  flex: 1 1 180px;
  min-width: 180px;
  margin-bottom: 0;
}


/* ── UI polish v2 (kimi/bugfix-ui-polish-2) ─────────────────────────── */

/* 1. Brand logo: clean, no border/outline/shadow */
.octo-brand img.octo-brand-img {
  border: none;
  outline: none;
  box-shadow: none;
  border-radius: 0;
  background: transparent;
}

/* 7. Credits block in sidebar */
.octo-credits {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
}
.octo-credits-info { min-width: 0; flex: 1; }
.octo-credits-num {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.octo-credits-label {
  font-size: 11px;
  color: var(--muted);
}
.octo-credits-add {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  transition: background-color .15s ease, color .15s ease;
}
.octo-credits-add:hover {
  background: var(--accent);
  color: #fff;
}

/* 9. Language/theme toggles: compact, pinned to the left */
.octo-toggles {
  justify-content: flex-start;
}
.octo-toggles .seg {
  flex: 0 0 auto;
}
.seg-item {
  padding: 0 6px;
  font-size: 10.5px;
}

/* 3. Stat cards: flat monochrome SVG icons */
.stat-icon {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}
.stat-icon svg {
  width: 20px;
  height: 20px;
  display: block;
}
.stat-card .stat-value { font-size: 24px; }

/* Dashboard welcome header */
.dash-welcome {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.2px;
}
.dash-welcome-sub {
  font-size: 14px;
  color: var(--muted);
  margin-top: 3px;
}

/* 4. Count segmented control */
.count-seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.count-seg .seg-item {
  flex: 0 0 auto;
  min-width: 34px;
  height: 28px;
  padding: 0 8px;
  font-size: 12px;
}

/* 5. Batch cost next to run button */
.run-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.batch-cost {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
}
.batch-cost-num {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.batch-cost-note {
  font-size: 11px;
  color: var(--muted);
}

/* 6. Metadata dropdowns: natural width, in a row */
.meta-row {
  gap: 10px;
}
.meta-row .field {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
}
.meta-row .select {
  width: auto;
}

/* 8. Job popover: two-column key-value blocks */
.job-kv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 22px;
}
.job-block-title {
  font-size: 13px;
  font-weight: 600;
  margin: 16px 0 8px;
  color: var(--text);
}
.job-block-title:first-child { margin-top: 0; }
@media (max-width: 640px) {
  .job-kv-grid { grid-template-columns: 1fr; }
}

/* ── Полоса стоимости всегда видна + protect в одну строку ─────────── */
.protect-row { display: flex; align-items: center; gap: 12px; }
.protect-row .range-row { flex: 1; max-width: 260px; }
.protect-slider { margin-top: 0 !important; }
#panel-simple [data-i18n="unical.protect_hint"],
#panel-advanced [data-i18n="unical.protect_hint"] {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
  max-width: 100%;
}

/* ── Confirm modal (job delete) ─────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}
.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}
.modal-card {
  width: min(420px, calc(100vw - 32px));
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius, 14px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  padding: 20px 22px;
  transform: translateY(6px) scale(0.98);
  transition: transform 0.15s ease;
}
.modal-overlay.open .modal-card { transform: none; }
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.modal-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 8px;
}
.modal-close:hover { background: var(--card-hover); color: var(--text); }
.modal-body {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 18px;
  word-break: break-word;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.btn-del-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 6px;
}
