/* ==========================================================================
   Smartus Gen — дизайн-система (база взята из сервиса для Грузии)
   Navy-сайдбар, синий основной цвет, лаймовый акцент. Все цвета — токены.
   ========================================================================== */

@font-face {
  font-family: "Manrope"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(/static/fonts/manrope-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Manrope"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(/static/fonts/manrope-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #f2f4f8;
  --surface: #ffffff;
  --surface-2: #f3f5f9;
  --surface-3: #e6eaf2;
  --border: #e1e6ee;
  --border-strong: #c9d1de;
  --text: #0f1b33;
  --text-2: #3a4967;
  --muted: #5b6a85;
  --primary: #2457e6;
  --primary-hover: #1b45c0;
  --primary-soft: #e3ebfd;
  --accent: #d6f76a;
  --accent-ink: #0e1a33;
  --btn-bg: #2457e6;
  --btn-bg-hover: #1b45c0;
  --btn-text: #ffffff;
  --toggle-on: #2457e6;
  --success: #12804e;
  --success-bg: #dcf4e7;
  --danger: #c22f2f;
  --danger-bg: #fde7e7;
  --warn: #8a5a00;
  --warn-bg: #fff0c9;
  --side-bg: #0e1a33;
  --side-text: rgba(255, 255, 255, .72);
  --side-hover: rgba(255, 255, 255, .07);
  --side-border: rgba(255, 255, 255, .09);
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-color: rgba(15, 27, 51, .10);
  --shadow-sm: 0 1px 2px rgba(15, 27, 51, .05), 0 1px 1px rgba(15, 27, 51, .03);
  --shadow-md: 0 6px 20px rgba(15, 27, 51, .08), 0 2px 4px rgba(15, 27, 51, .04);
  --focus: 0 0 0 3px color-mix(in srgb, var(--primary) 32%, transparent);
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0a1020;
  --surface: #111a30;
  --surface-2: #17223d;
  --surface-3: #202d4e;
  --border: #223152;
  --border-strong: #324471;
  --text: #eaf0ff;
  --text-2: #c3cee8;
  --muted: #95a4c4;
  --primary: #8aa6ff;
  --primary-hover: #a9bdff;
  --primary-soft: #1c2b58;
  --btn-bg: #d6f76a;
  --btn-bg-hover: #e4fb8f;
  --btn-text: #0e1a33;
  --toggle-on: #d6f76a;
  --success: #3fd68f;
  --success-bg: #12362a;
  --danger: #ff8080;
  --danger-bg: #3b1f26;
  --warn: #fbc34a;
  --warn-bg: #3a3014;
  --side-bg: #070c18;
  --shadow-color: rgba(0, 0, 0, .55);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a1020;
    --surface: #111a30;
    --surface-2: #17223d;
    --surface-3: #202d4e;
    --border: #223152;
    --border-strong: #324471;
    --text: #eaf0ff;
    --text-2: #c3cee8;
    --muted: #95a4c4;
    --primary: #8aa6ff;
    --primary-hover: #a9bdff;
    --primary-soft: #1c2b58;
    --btn-bg: #d6f76a;
    --btn-bg-hover: #e4fb8f;
    --btn-text: #0e1a33;
    --toggle-on: #d6f76a;
    --success: #3fd68f;
    --success-bg: #12362a;
    --danger: #ff8080;
    --danger-bg: #3b1f26;
    --warn: #fbc34a;
    --warn-bg: #3a3014;
    --side-bg: #070c18;
    --shadow-color: rgba(0, 0, 0, .55);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Manrope", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  font-feature-settings: "tnum" 1;  /* цены, затраты и счётчики не «прыгают» по ширине */
  -webkit-font-smoothing: antialiased;
  transition: background-color .15s, color .15s;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 2000;
  background: var(--btn-bg); color: var(--btn-text); padding: 10px 16px; border-radius: var(--radius-sm); font-weight: 700;
}
.skip-link:focus { top: 12px; text-decoration: none; }

/* ---------- Каркас: сайдбар + рабочая область ---------- */
.app { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; gap: 4px;
  background: var(--side-bg); color: var(--side-text);
  padding: 20px 14px 14px; overflow-y: auto;
}

.nav-group { display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px; }
.nav-label { padding: 0 12px 6px; font-size: 12px; font-weight: 700; color: rgba(255, 255, 255, .42); letter-spacing: .02em; }

.nav-link {
  position: relative; display: flex; align-items: center; gap: 12px;
  min-height: 44px; padding: 0 12px; border-radius: 10px;
  color: var(--side-text); font-weight: 600; font-size: 14.5px; text-decoration: none;
  transition: background-color .15s, color .15s;
}
.nav-link svg { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-link:hover { background: var(--side-hover); color: #fff; text-decoration: none; }
.nav-link.active { background: rgba(255, 255, 255, .1); color: #fff; }
.nav-link.active::before {
  content: ""; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0;
  background: var(--accent);
}
.nav-link.active svg { color: var(--accent); }

.side-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--side-border); display: flex; flex-direction: column; gap: 10px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 0 4px; color: #fff; font-weight: 700; font-size: 14px; min-width: 0; }
.avatar {
  flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 14px; text-transform: uppercase;
}
.side-user span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-actions { display: flex; gap: 8px; }
.side-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 12px;
  border-radius: 10px; border: 1px solid var(--side-border); background: transparent; color: var(--side-text);
  font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; transition: background-color .15s, color .15s;
}
.side-btn:hover { background: var(--side-hover); color: #fff; }
.side-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side-btn.grow { flex: 1; }
.side-foot form { display: contents; }

.mobile-bar { display: none; }
.scrim { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.container { width: 100%; max-width: 1920px; margin: 0 auto; padding: 32px clamp(20px, 3vw, 48px) 72px; }

@media (max-width: 1023px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; z-index: 1100; inset: 0 auto 0 0; width: min(300px, 86vw);
    transform: translateX(-102%); transition: transform .22s var(--ease); box-shadow: var(--shadow-md);
  }
  body.nav-open .sidebar { transform: none; }
  .scrim { position: fixed; inset: 0; z-index: 1050; background: rgba(5, 10, 22, .55); }
  body.nav-open .scrim { display: block; }
  body.nav-open { overflow: hidden; }
  .mobile-bar {
    position: sticky; top: 0; z-index: 1000; display: flex; align-items: center; justify-content: space-between;
    height: 60px; padding: 0 16px; background: var(--side-bg); color: #fff;
  }
  .mobile-bar img { height: 26px; width: auto; display: block; }
  .mobile-bar button {
    display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 10px; cursor: pointer;
    background: rgba(255, 255, 255, .08); color: #fff;
  }
  .mobile-bar button svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
  .container { padding: 22px 16px 56px; }
}

/* ---------- Типографика ---------- */
h1 { font-size: 28px; line-height: 1.2; font-weight: 800; letter-spacing: -.02em; margin: 0 0 6px; }
h2 { font-size: 18px; line-height: 1.3; font-weight: 750; letter-spacing: -.01em; margin: 0 0 12px; }
h3 { font-size: 15px; font-weight: 700; margin: 0 0 8px; }
p { margin: 0 0 12px; }
code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .88em;
  background: var(--surface-2); border: 1px solid var(--border); padding: 1px 6px; border-radius: 6px;
}
.muted { color: var(--muted); font-size: 13.5px; }
@media (max-width: 720px) { h1 { font-size: 24px; } }

/* ---------- Карточки ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
  transition: background-color .15s, border-color .15s;
}
@media (max-width: 720px) { .card { padding: 18px 16px; } }

/* ---------- Формы ---------- */
label { display: block; font-size: 13.5px; font-weight: 600; color: var(--text-2); margin: 16px 0 6px; }
input[type=text], input[type=password], input[type=url], input[type=number], input[type=email], input[type=search], textarea, select {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
input:hover, textarea:hover, select:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--border-strong)); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
input:disabled, textarea:disabled, select:disabled { opacity: .55; cursor: not-allowed; background: var(--surface-2); }
textarea { resize: vertical; min-height: 88px; line-height: 1.5; }
input[type=file] { margin-top: 4px; font-size: 14px; max-width: 100%; }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); width: 17px; height: 17px; margin: 0; }
select { appearance: none; padding-right: 38px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2395a4c4' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 13px center; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font: inherit; font-size: 14.5px; font-weight: 700; line-height: 1.2; text-align: center;
  cursor: pointer; text-decoration: none;
  background: var(--btn-bg); color: var(--btn-text);
  box-shadow: var(--shadow-sm);
  transition: background-color .15s, border-color .15s, box-shadow .15s, transform .08s;
}
.btn:hover { background: var(--btn-bg-hover); text-decoration: none; box-shadow: var(--shadow-md); }
.btn:active { transform: scale(.985); }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: none; }
.btn.secondary:hover { background: var(--surface-2); border-color: var(--primary); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 88%, #000); }
.btn:disabled, .btn[aria-busy=true] { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 13.5px; }

.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 200px; }

.thumb-row { display: flex; gap: 12px; flex-wrap: wrap; }
.thumb {
  flex: none; width: 120px; height: 120px; object-fit: cover; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2);
}

/* ---------- Таблицы ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { text-align: left; padding: 12px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-weight: 700; font-size: 13px; background: var(--surface-2); }
th:first-child { border-top-left-radius: 10px; }
th:last-child { border-top-right-radius: 10px; }
tbody tr { transition: background-color .12s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
@media (max-width: 720px) { .card:has(table) { overflow-x: auto; } table { min-width: 560px; } }

.sortable-table th[data-sort] { cursor: pointer; user-select: none; white-space: nowrap; }
.sortable-table th[data-sort]:hover { color: var(--text); }
.sortable-table th[data-sort] .sort-arrow { display: inline-block; margin-left: 4px; opacity: .35; font-size: 10px; }
.sortable-table th[data-sort].sort-active { color: var(--text); }
.sortable-table th[data-sort].sort-active .sort-arrow { opacity: 1; color: var(--primary); }

/* ---------- Статусы ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px;
  border-radius: 999px; font-size: 12.5px; font-weight: 700; line-height: 1.4; white-space: nowrap;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.badge.draft, .badge.cancelled { background: var(--surface-2); color: var(--muted); }
.badge.queued, .badge.pending, .badge.needs_review, .badge.partial, .badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.generating, .badge.running, .badge.generated { background: var(--primary-soft); color: var(--primary); }
.badge.generating::before, .badge.running::before { animation: pulse 1.4s ease-in-out infinite; }
.badge.done, .badge.success, .badge.exported { background: var(--success-bg); color: var(--success); }
.badge.failed, .badge.drive_failed { background: var(--danger-bg); color: var(--danger); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 16px; }
.gallery .shot {
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface);
  box-shadow: var(--shadow-sm); transition: box-shadow .18s, border-color .18s;
}
.gallery .shot:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.gallery .shot img { width: 100%; display: block; aspect-ratio: 1/1; object-fit: cover; background: var(--surface-2); }
.gallery .shot .meta { padding: 10px 12px; font-size: 13px; }
.gallery .shot .meta .name { font-weight: 700; margin-bottom: 4px; }

.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14.5px; font-weight: 600; margin-bottom: 16px; border: 1px solid transparent; }
.alert.error { background: var(--danger-bg); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.alert.warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.alert.success { background: var(--success-bg); color: var(--success); border-color: color-mix(in srgb, var(--success) 30%, transparent); }

/* ---------- Вход ---------- */
body.auth { background: var(--side-bg); }
.login-wrap { max-width: 400px; margin: 0 auto; padding: 12vh 16px 40px; }
.login-brand { display: block; margin: 0 auto 28px; height: 42px; width: auto; }
.login-wrap .card { padding: 28px; box-shadow: var(--shadow-md); }
.login-wrap h1 { font-size: 22px; margin-bottom: 4px; }
.login-wrap .btn { width: 100%; margin-top: 8px; }

/* ---------- Настройки ---------- */
.settings-layout { display: flex; gap: 32px; align-items: flex-start; }
.settings-nav { width: 210px; flex: none; position: sticky; top: 24px; }
.settings-nav-group { margin-bottom: 22px; }
.settings-nav-label { font-size: 12px; color: var(--muted); font-weight: 700; margin-bottom: 6px; padding: 0 12px; }
.settings-nav a {
  display: flex; align-items: center; min-height: 40px; padding: 0 12px; border-radius: 10px; font-size: 14.5px; font-weight: 600;
  color: var(--text-2); text-decoration: none; margin-bottom: 2px; transition: background-color .15s, color .15s;
}
.settings-nav a:hover { background: var(--surface-3); color: var(--text); }
.settings-nav a.active { background: var(--surface); color: var(--text); box-shadow: inset 3px 0 0 var(--primary), var(--shadow-sm); }
.settings-content { flex: 1; min-width: 0; }

.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; margin-top: 20px; }
.settings-card {
  display: block; padding: 20px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); text-decoration: none; color: var(--text); box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .2s, transform .2s var(--ease);
}
.settings-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); text-decoration: none; transform: translateY(-2px); }
.settings-card-title { font-weight: 750; font-size: 16px; margin-bottom: 6px; }
.settings-card-desc { font-size: 13.5px; color: var(--muted); line-height: 1.55; }

@media (max-width: 860px) {
  .settings-layout { flex-direction: column; gap: 16px; }
  .settings-nav { width: 100%; position: static; display: flex; flex-wrap: wrap; gap: 4px 12px; }
  .settings-nav-group { margin-bottom: 4px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
  .settings-nav-label { margin-bottom: 0; padding: 0; }
}

/* ---------- Заголовок страницы и переключатель вида ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { margin: 0; }
.view-switch { display: inline-flex; padding: 4px; gap: 2px; border-radius: 12px; background: var(--surface-3); }
.view-switch a {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 18px; border-radius: 9px; font-size: 14px; font-weight: 700;
  color: var(--muted); text-decoration: none; white-space: nowrap; transition: background-color .15s, color .15s;
}
.view-switch a:hover { color: var(--text); text-decoration: none; }
.view-switch a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; min-height: 44px; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track { position: relative; width: 44px; height: 26px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border-strong); transition: background-color .18s, border-color .18s; flex: none; }
.toggle-track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .18s var(--ease);
}
.toggle input:checked + .toggle-track { background: var(--toggle-on); border-color: var(--toggle-on); }
.toggle input:checked + .toggle-track::after { transform: translateX(18px); }
.toggle input:focus-visible + .toggle-track { box-shadow: var(--focus); }
.toggle-label { font-size: 13.5px; font-weight: 600; color: var(--text-2); }

/* ---------- Блоки формы, опции-карточки, цифры ---------- */
.form-section { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--border); }
.form-section:first-of-type { margin-top: 18px; }
.form-section > h3 { font-size: 16px; font-weight: 750; margin: 0 0 2px; }
.form-section > .muted { margin: 0 0 4px; }
.opt-list { display: grid; gap: 10px; margin-top: 10px; }
.opt-list.cols-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 720px) { .opt-list.cols-2 { grid-template-columns: 1fr; } }
.opt {
  display: flex; gap: 12px; align-items: flex-start; margin: 0; padding: 14px 16px; border: 1px solid var(--border-strong);
  border-radius: 12px; background: var(--surface); cursor: pointer; font-weight: 400; color: var(--text);
  transition: border-color .15s, background-color .15s, box-shadow .15s;
}
.opt:hover { border-color: var(--primary); }
.opt:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.opt:has(input:focus-visible) { box-shadow: var(--focus); }
.opt input { margin-top: 3px; flex: none; }
.opt-title { display: block; font-weight: 700; font-size: 15px; }
.opt-desc { display: block; margin-top: 2px; color: var(--muted); font-size: 13.5px; font-weight: 500; line-height: 1.5; }
.opt-tag { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 800; vertical-align: 1px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 12px; }
.stat { padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.stat b { display: block; font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.stat span { color: var(--muted); font-size: 13px; font-weight: 600; }

.bg-swatch-picker { appearance: none; -webkit-appearance: none; width: 26px; height: 26px; padding: 0; border: 1px solid rgba(0, 0, 0, .18); border-radius: 50%; background: none; cursor: pointer; overflow: hidden; }
.bg-swatch-picker::-webkit-color-swatch-wrapper { padding: 0; }
.bg-swatch-picker::-webkit-color-swatch { border: none; border-radius: 50%; }
.bg-swatch-picker::-moz-color-swatch { border: none; border-radius: 50%; }

.card-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.card-actions form { margin: 0; }
.shop-line { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.shop-line.ok { color: var(--success); }
.shop-line.err { color: var(--danger); }

.page-sub { color: var(--muted); font-size: 15px; max-width: 760px; margin: 4px 0 22px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Уведомления ---------- */
.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 1200; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast {
  max-width: min(380px, calc(100vw - 40px)); padding: 11px 16px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; line-height: 1.4;
  color: #fff; background: var(--side-bg); box-shadow: var(--shadow-md); border: 1px solid var(--side-border);
  opacity: 0; transform: translateY(8px); transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.toast.show { opacity: 1; transform: none; }
.toast.error { background: var(--danger); border-color: transparent; }
@media (max-width: 720px) { .toast-region { left: 16px; right: 16px; bottom: 16px; align-items: stretch; } .toast { max-width: none; } }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }


/* ==========================================================================
   Smartus Gen — компоненты
   ========================================================================== */

/* Логотип-текст */
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; color: #fff; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 16px; letter-spacing: -.04em;
}
.brand-name { font-weight: 800; font-size: 17px; letter-spacing: -.02em; line-height: 1.1; }
.brand-name small { display: block; font-size: 11.5px; font-weight: 600; color: rgba(255, 255, 255, .5); letter-spacing: 0; }
.login-wrap .brand { justify-content: center; padding-bottom: 28px; }
.nav-link .soon { margin-left: auto; font-size: 11px; font-weight: 700; color: rgba(255, 255, 255, .38); }
.nav-link.disabled { opacity: .55; pointer-events: none; }

/* Статус-индикатор */
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--border-strong); flex: none; }
.dot.ok { background: var(--success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 22%, transparent); }
.dot.err { background: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 22%, transparent); }
.dot.warn { background: var(--warn); }
.status-line { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.status-line.ok { color: var(--success); }
.status-line.err { color: var(--danger); }

.badge.ok { background: var(--success-bg); color: var(--success); }
.badge.err { background: var(--danger-bg); color: var(--danger); }
.badge.off { background: var(--surface-2); color: var(--muted); }
.badge.info { background: var(--primary-soft); color: var(--primary); }
.badge.plain::before { display: none; }

/* Шапка раздела */
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.section-head h1 { margin: 0 0 4px; }
.section-head p { margin: 0; color: var(--muted); max-width: 720px; }

/* Карточка интеграции */
.integ-group { margin-bottom: 28px; }
.integ-group > h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 10px; }
.integ { padding: 0; overflow: hidden; scroll-margin-top: 24px; }
.integ-head { display: flex; align-items: center; gap: 14px; padding: 18px 22px; }
.integ-logo {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none;
  background: var(--primary-soft); color: var(--primary); font-weight: 800; font-size: 15px;
}
.integ-title { font-weight: 750; font-size: 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.integ-desc { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.integ-head .grow { flex: 1; min-width: 0; }
.integ-body { border-top: 1px solid var(--border); padding: 4px 22px 20px; background: var(--surface); }
.integ details > summary { list-style: none; cursor: pointer; }
.integ details > summary::-webkit-details-marker { display: none; }
.integ details[open] .chev { transform: rotate(180deg); }
.chev { width: 20px; height: 20px; stroke: var(--muted); fill: none; stroke-width: 2; transition: transform .18s var(--ease); flex: none; }
.integ-result { margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13.5px; }
.integ-result.ok { border-color: color-mix(in srgb, var(--success) 35%, var(--border)); }
.integ-result.err { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin-top: 8px; font-size: 13px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; font-weight: 600; }
.field-help { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.secret-row { display: flex; gap: 8px; align-items: center; }
.secret-row input { flex: 1; }
.secret-current { display: inline-flex; align-items: center; gap: 8px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; color: var(--text-2); margin-top: 6px; }
.inline-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); margin: 6px 0 0; cursor: pointer; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 18px; }
.form-actions .hint { font-size: 12.5px; color: var(--muted); }

/* Вкладки */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 0 0 20px; overflow-x: auto; }
.tabs a, .tabs span {
  padding: 10px 14px; font-weight: 700; font-size: 14px; color: var(--muted); text-decoration: none; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--text); border-bottom-color: var(--primary); }
.tabs span { opacity: .55; cursor: default; }
.tabs span small { font-size: 11px; margin-left: 4px; }

/* Дерево категорий */
.cat-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.cat-tools input[type=search] { max-width: 360px; }
.cat-tree { max-height: 520px; overflow: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.cat-row { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
.cat-row:last-child { border-bottom: 0; }
.cat-row:hover { background: var(--surface-2); }
.cat-row .cat-id { margin-left: auto; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.cat-row.is-default { background: var(--primary-soft); }
.cat-row label { margin: 0; display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--text); cursor: pointer; flex: 1; min-width: 0; }
.cat-row[hidden] { display: none; }
.cat-indent { display: inline-block; flex: none; }

/* Главная */
.hero-card { background: linear-gradient(135deg, var(--side-bg), color-mix(in srgb, var(--primary) 55%, var(--side-bg))); color: #fff; border: 0; padding: 28px; }
.hero-card h1 { color: #fff; }
.hero-card p { color: rgba(255, 255, 255, .78); max-width: 640px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.checklist a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; color: var(--text); font-weight: 600; }
.checklist a:hover { border-color: var(--primary); text-decoration: none; }
.check-ico { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; border: 2px solid var(--border-strong); }
.check-ico.done { background: var(--success); border-color: var(--success); color: #fff; }
.check-ico svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 3; }
.checklist .done-text { color: var(--muted); text-decoration: line-through; }
.roadmap { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.roadmap li { display: flex; gap: 12px; align-items: flex-start; }
.roadmap .stage { flex: none; min-width: 64px; font-size: 12px; font-weight: 800; color: var(--primary); background: var(--primary-soft); border-radius: 999px; padding: 3px 10px; text-align: center; }
.roadmap b { display: block; font-size: 14.5px; }
.roadmap span { font-size: 13px; color: var(--muted); }

/* Одноразовая ссылка */
.link-box { margin: 0 0 18px; padding: 16px 18px; border-radius: 12px; border: 1px dashed var(--primary); background: var(--primary-soft); }
.link-box b { display: block; margin-bottom: 6px; }
.copy-row { display: flex; gap: 8px; margin-top: 8px; }
.copy-row input { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; }

/* Пустое состояние */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty b { display: block; color: var(--text); font-size: 17px; margin-bottom: 6px; }

/* Пагинация */
.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 14px; font-size: 13.5px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters > div { min-width: 200px; }
.filters label { margin-top: 0; }
.nowrap { white-space: nowrap; }
.small { font-size: 12.5px; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.danger-zone h2 { color: var(--danger); }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; }
.settings-nav .soon-link { display: flex; align-items: center; justify-content: space-between; min-height: 36px; padding: 0 12px; font-size: 13.5px; color: var(--muted); opacity: .7; }
.settings-nav .soon-link small { font-size: 11px; font-weight: 700; }

/* Редактор набора характеристик */
.ci { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; background: var(--surface); }
.ci-head { display: grid; grid-template-columns: 28px 1.6fr 1.1fr 1.2fr auto; gap: 8px; align-items: center; }
.ci-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; padding-left: 36px; align-items: center; }
.ci input, .ci select { min-height: 38px; padding: 7px 10px; font-size: 14px; }
.ci-num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-size: 12px; font-weight: 800; color: var(--muted); }
.ci-actions { display: inline-flex; gap: 4px; }
.ci-actions button { width: 32px; height: 32px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--text-2); cursor: pointer; font: inherit; }
.ci-actions button:hover { border-color: var(--primary); color: var(--primary); }
.ci-actions button[data-act=remove]:hover { border-color: var(--danger); color: var(--danger); }
.ci [hidden] { display: none; }
@media (max-width: 1100px) { .ci-head { grid-template-columns: 28px 1fr 1fr; } .ci-body { grid-template-columns: 1fr; padding-left: 0; } }

/* Форма «Новый товар» */
.job { position: relative; }
.job-head { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; flex-wrap: wrap; }
.job-num { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: #fff; font-weight: 800; font-size: 14px; flex: none; }
.job-title { font-weight: 750; font-size: 16px; flex: 1; min-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-del { width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: var(--muted); cursor: pointer; font: inherit; }
.job-del:hover { border-color: var(--danger); color: var(--danger); }
.small-toggle { min-height: 36px; }
.small-toggle .toggle-label { font-size: 13px; }
.feed-pick { margin-top: 6px; }
.feed-search { position: relative; }
.feed-results {
  position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; right: 0; max-height: 420px; overflow: auto;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow-md); padding: 6px;
}
.feed-item { display: grid; gap: 2px; width: 100%; text-align: left; padding: 10px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font: inherit; cursor: pointer; }
.feed-item:hover, .feed-item:focus { background: var(--primary-soft); outline: none; }
.fi-name { font-weight: 650; font-size: 14px; }
.fi-meta { font-size: 12.5px; color: var(--muted); }
.fi-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.fb { font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.fb.on { background: var(--success-bg); color: var(--success); }
.feed-empty { padding: 12px; color: var(--muted); font-size: 14px; }
.feed-chosen { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px; background: var(--primary-soft); font-size: 14px; }
.link-btn { border: 0; background: none; color: var(--primary); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; margin-left: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; }
.chip b { font-weight: 700; }
.chip button { width: 22px; height: 22px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; font-size: 11px; }
.chip button:hover { background: var(--danger-bg); color: var(--danger); }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; }
.thumb-pick { position: relative; width: 92px; height: 92px; margin: 0; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; display: block; }
.thumb-pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-pick input { position: absolute; top: 6px; right: 6px; }
.thumb-pick:has(input:not(:checked)) img { opacity: .3; filter: grayscale(1); }
.params-box { margin-top: 4px; }
.thumb-pick.broken { display: grid; place-items: center; cursor: not-allowed; }
.thumb-pick.broken img { display: none; }
.thumb-pick.broken::after { content: "фото\Aнедоступно"; white-space: pre; text-align: center; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.thumb-pick.broken input { display: none; }

/* Тексты карточки */
.tf { padding: 16px 0; border-top: 1px solid var(--border); }
.tf:first-of-type { border-top: 0; }
.tf-head { margin-bottom: 8px; }
.tf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .tf-grid { grid-template-columns: 1fr; } }
.tf-lang { font-size: 12px; font-weight: 800; color: var(--muted); margin-bottom: 4px; letter-spacing: .04em; }
.tf-col textarea { min-height: 0; font-size: 14px; }
.tf-meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: baseline; margin-top: 4px; font-size: 12.5px; }
.counter { color: var(--muted); font-variant-numeric: tabular-nums; }
.counter.over { color: var(--danger); font-weight: 700; }
.tf-issues { color: var(--warn); font-size: 12.5px; font-weight: 600; }
.tf-actions { display: flex; gap: 6px; margin-top: 6px; }
.tf-actions input { min-height: 36px; padding: 6px 10px; font-size: 13px; }
.tf-history summary { cursor: pointer; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.serp { max-width: 640px; font-family: Arial, sans-serif; }
.serp-url { font-size: 13px; color: #4d5156; }
.serp-title { font-size: 20px; color: #1a0dab; line-height: 1.3; margin: 2px 0; }
.serp-desc { font-size: 14px; color: #4d5156; line-height: 1.5; }
.desc-frame { width: 100%; min-height: 600px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }

/* Изображения */
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.img-card { padding: 16px; margin: 0; }
.img-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.img-shot { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); display: block; cursor: zoom-in; }
.img-empty { display: grid; place-items: center; color: var(--danger); font-size: 13px; padding: 20px; text-align: center; cursor: default; }
.hist { display: flex; flex-direction: column; gap: 4px; align-items: center; margin: 0; }
