/* ============================================================================
   Парсер new.applesp.ru — стили по канону GetApple CRM
   Font: Mont — accent: cobalt #2E5BFF
   ========================================================================== */

/* ---------- Fonts: Mont ---------- */
@font-face { font-family:'Mont'; src:url('/fonts/mont/Mont-Light.woff2') format('woff2'); font-weight:300; font-style:normal; font-display:swap; }
@font-face { font-family:'Mont'; src:url('/fonts/mont/Mont-Regular.woff2') format('woff2'); font-weight:400; font-style:normal; font-display:swap; }
@font-face { font-family:'Mont'; src:url('/fonts/mont/Mont-SemiBold.woff2') format('woff2'); font-weight:600; font-style:normal; font-display:swap; }
@font-face { font-family:'Mont'; src:url('/fonts/mont/Mont-Bold.woff2') format('woff2'); font-weight:700; font-style:normal; font-display:swap; }

/* ---------- Tokens ---------- */
:root {
  --accent: #2e5bff;
  --accent-press: #1e48e6;
  --accent-ink: #2e5bff;
  --accent-soft: rgba(46, 91, 255, 0.1);
  --accent-soft-2: rgba(46, 91, 255, 0.16);
  --on-accent: #ffffff;
  --ok: #1a9a4e;
  --ok-soft: rgba(26, 154, 78, 0.14);
  --warn: #b06e00;
  --warn-soft: rgba(224, 138, 0, 0.14);

  --r-sm: 10px;
  --r: 14px;
  --r-lg: 18px;

  --sidebar-w: 250px;
  --topbar-h: 64px;
  --content-max: 1180px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --spring: cubic-bezier(0.16, 1, 0.3, 1);

  --fs: 'Mont', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

[data-theme='light'] {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --panel-2: #fbfcfe;
  --ink: #14161c;
  --ink-2: #3c4048;
  --sub: #666b76;
  --line: #e6e8ee;
  --line-strong: #d6d9e2;
  --hover: #f2f4f8;
  --shadow-sm: 0 1px 2px rgba(20, 22, 28, 0.06), 0 1px 3px rgba(20, 22, 28, 0.05);
  --shadow: 0 12px 30px -14px rgba(20, 22, 28, 0.22);
  --shadow-pop: 0 16px 40px -16px rgba(20, 22, 28, 0.28);
  --danger: #d92d20;
  --danger-soft: rgba(217, 45, 32, 0.1);
  --skeleton-a: #eceef3;
  --skeleton-b: #f6f7fa;
  --scrim: rgba(16, 18, 24, 0.42);
}

[data-theme='dark'] {
  --bg: #0e1014;
  --panel: #16191f;
  --panel-2: #1b1f26;
  --ink: #eef0f4;
  --ink-2: #c3c7d0;
  --sub: #8b909c;
  --line: #252a33;
  --line-strong: #333a46;
  --hover: #1e222a;
  --accent-ink: #82a3ff;
  --accent-soft: rgba(46, 91, 255, 0.16);
  --accent-soft-2: rgba(46, 91, 255, 0.24);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 18px 44px -18px rgba(0, 0, 0, 0.7);
  --shadow-pop: 0 20px 48px -18px rgba(0, 0, 0, 0.78);
  --danger: #ff6b5e;
  --danger-soft: rgba(255, 107, 94, 0.13);
  --skeleton-a: #1b1f26;
  --skeleton-b: #242a33;
  --scrim: rgba(2, 4, 8, 0.6);
  --ok: #2fbf68;
  --warn: #e0a53a;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--fs);
  background: var(--bg);
  color: var(--ink);
  min-height: 100dvh;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}
img { display: block; max-width: 100%; }
button { font-family: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, select { font-family: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

@media (min-width: 768px) {
  ::-webkit-scrollbar { width: 6px; height: 6px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }
  ::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
}

/* ---------- Brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; letter-spacing: -0.02em; color: var(--ink); }
.brand__mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 17px; font-weight: 700; flex: none;
  box-shadow: 0 4px 10px -3px rgba(46, 91, 255, 0.5);
}
.brand__word b { color: var(--accent-ink); font-weight: 700; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 700; font-size: 14px; line-height: 1; padding: 11px 18px;
  border-radius: var(--r-sm); border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.08s var(--ease), color 0.15s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.62; cursor: not-allowed; }
.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--primary:not(:disabled):hover { background: var(--accent-press); }
.btn--ghost { background: var(--panel); border-color: var(--line); color: var(--ink); }
.btn--ghost:not(:disabled):hover { background: var(--hover); border-color: var(--line-strong); }
.btn--danger { background: transparent; border-color: color-mix(in srgb, var(--danger) 40%, transparent); color: var(--danger); }
.btn--danger:not(:disabled):hover { background: var(--danger-soft); }
.btn--sm { padding: 7px 12px; font-size: 12.5px; }
.btn--block { width: 100%; }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px;
  color: var(--ink-2); border: 1px solid transparent;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn--sm { width: 32px; height: 32px; border-radius: 8px; }
.icon-btn--danger:hover { background: var(--danger-soft); color: var(--danger); }

/* ---------- Fields ---------- */
.field { display: flex; flex-direction: column; gap: 7px; }
.field__label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.input {
  width: 100%; height: 46px; padding: 0 14px; font-size: 15px; color: var(--ink);
  background: var(--panel-2); border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease), background-color 0.15s var(--ease);
}
.input::placeholder { color: var(--sub); opacity: 0.75; }
.input:hover { border-color: var(--sub); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background-color: var(--panel); }
.input:disabled { opacity: 0.6; cursor: not-allowed; }
.input--sm { height: 38px; font-size: 14px; padding: 0 12px; }

select.input {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  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='%23666b76' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 15px;
  padding-right: 38px;
}
[data-theme='dark'] select.input {
  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='%238b909c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}
/* Страховка: шеврон никогда не тайлится, где бы ни переопределили background */
select.input, select.input:hover, select.input:focus {
  background-repeat: no-repeat !important;
  background-position: right 12px center !important;
  background-size: 15px !important;
}

/* ---------- App shell ---------- */
.shell { min-height: 100dvh; display: grid; grid-template-columns: var(--sidebar-w) 1fr; }
.shell__main { min-width: 0; display: flex; flex-direction: column; min-height: 100dvh; }
.shell__content { flex: 1; padding: 30px clamp(18px, 4vw, 40px) 56px; }
.shell__scrim { display: none; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column;
  background: var(--panel); border-right: 1px solid var(--line); z-index: 40;
}
.sidebar__top { height: var(--topbar-h); padding: 0 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); flex: none; }
.sidebar__close { display: none; }
.sidebar__nav { flex: 1; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 3px; }
.navitem {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--ink-2); font-size: 14.5px; font-weight: 600; position: relative; width: 100%; text-align: left;
  transition: background-color 0.14s var(--ease), color 0.14s var(--ease);
}
.navitem__icon { flex: none; color: var(--sub); transition: color 0.14s var(--ease); display: grid; place-items: center; }
.navitem:hover { background: var(--hover); color: var(--ink); }
.navitem:hover .navitem__icon { color: var(--ink-2); }
.navitem--active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; }
.navitem--active .navitem__icon { color: var(--accent-ink); }
.navitem--active::before {
  content: ''; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 22px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.sidebar__foot { flex: none; padding: 14px 20px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--sub); }
.sidebar__foot-name { font-weight: 700; }
.sidebar__foot .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sub); }
.sidebar__foot .dot.ok { background: var(--ok); }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h); flex: none;
  display: flex; align-items: center; gap: 12px; padding: 0 clamp(14px, 3vw, 28px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  border-bottom: 1px solid var(--line);
}
.topbar__burger { display: none; }
.topbar__title { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* ---------- Page ---------- */
.page { max-width: var(--content-max); margin: 0 auto; animation: fade 0.2s var(--ease); }
.page__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page__title { font-size: clamp(22px, 3vw, 27px); font-weight: 700; }
.page__sub { margin-top: 5px; color: var(--sub); font-size: 14.5px; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Banner ---------- */
.banner { padding: 13px 16px; border-radius: var(--r-sm); font-size: 14px; font-weight: 600; margin-bottom: 20px; border: 1px solid transparent; }
.banner--error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }

/* ---------- Placeholder ---------- */
.placeholder {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px;
  padding: clamp(40px, 8vw, 76px) 24px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
}
.placeholder__icon { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); margin-bottom: 2px; }
.placeholder__title { font-size: 19px; font-weight: 700; }
.placeholder__text { color: var(--sub); font-size: 14.5px; max-width: 46ch; line-height: 1.55; }

/* ---------- Auth (PIN) ---------- */
.auth {
  min-height: 100dvh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(120% 100% at 50% 0%, var(--accent-soft) 0%, transparent 46%), var(--bg);
}
.auth__card {
  width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow); padding: clamp(26px, 5vw, 36px);
  display: flex; flex-direction: column; gap: 14px; animation: fade 0.24s var(--ease);
}
.auth__title { font-size: 23px; font-weight: 700; }
.auth__sub { color: var(--sub); font-size: 14px; margin-top: -8px; margin-bottom: 4px; }
.auth__error { background: var(--danger-soft); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); border-radius: var(--r-sm); padding: 11px 14px; font-size: 13.5px; font-weight: 600; }

/* ---------- Spinner / Skeleton ---------- */
.spinner { display: inline-block; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--accent-soft-2); border-top-color: var(--accent); animation: spin 0.7s linear infinite; }
.btn--primary .spinner { border-color: rgba(255,255,255,0.4); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { display: inline-block; border-radius: 7px; background: linear-gradient(90deg, var(--skeleton-a) 25%, var(--skeleton-b) 37%, var(--skeleton-a) 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* ---------- Toast ---------- */
.toast-line {
  position: fixed; bottom: 18px; right: 18px; z-index: 60; background: var(--panel);
  border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 10px;
  padding: 10px 14px; font-size: 13px; font-weight: 600; box-shadow: var(--shadow-pop);
  animation: fade 0.18s var(--ease); max-width: 380px;
}
.toast-line.err { border-left-color: var(--danger); }

/* ---------- TG auth card ---------- */
.tg-card { max-width: 460px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); padding: 24px; box-shadow: var(--shadow-sm); }
.tg-card h2 { margin: 0 0 6px; font-size: 18px; }
.tg-card .sub { color: var(--sub); font-size: 13px; margin: 0 0 18px; }
.tg-card .field { margin-bottom: 12px; }
.tg-qr { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 8px 0 4px; }
.tg-qr img { width: 240px; height: 240px; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.tg-qr .hint { font-size: 12.5px; color: var(--sub); text-align: center; max-width: 320px; line-height: 1.5; }
.tg-user { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.tg-user__ava { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; font-size: 16px; }
.tg-user__name { font-weight: 700; }
.tg-user__meta { color: var(--sub); font-size: 13px; }
.tg-ok { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--ok); margin-bottom: 12px; }

/* ---------- Поставщики ---------- */
.sup-add { display: flex; gap: 10px; max-width: 480px; }
.sup-add .input { flex: 1; }
.sup-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; margin-top: 18px; }
.sup-card { border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow-sm); }
.sup-card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sup-card__name { font-weight: 700; font-size: 15.5px; }
.sup-card__actions { display: flex; align-items: center; gap: 6px; }
.sup-slot { display: flex; flex-direction: column; gap: 5px; }
.sup-slot__label { font-size: 12px; font-weight: 600; color: var(--sub); }

/* ---------- Источники (Данные) ---------- */
.data-grid { display: grid; grid-template-columns: 460px 1fr; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .data-grid { grid-template-columns: 1fr; } }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); padding: 20px; }
.panel h2 { font-size: 16px; margin-bottom: 14px; }
.src-add { display: flex; gap: 8px; margin-bottom: 6px; }
.src-add .input { flex: 1; min-width: 0; }
.src-add select.input { width: 110px; flex: none; }
.src-add .input--cmd { width: 90px; flex: none; }

.src-item {
  display: flex; align-items: center; gap: 10px; padding: 12px 12px; border: 1px solid var(--line);
  border-radius: var(--r-sm); margin-top: 8px; cursor: pointer; background: var(--panel);
  transition: border-color 0.15s var(--ease), background-color 0.15s var(--ease);
}
.src-item:hover { background: var(--hover); }
.src-item--active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.src-item__body { flex: 1; min-width: 0; }
.src-item__name { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 7px; }
.src-item__meta { font-size: 12px; color: var(--sub); margin-top: 2px; }
.src-item__err { font-size: 12px; color: var(--danger); margin-top: 3px; font-weight: 600; }
.src-item__limit { width: 54px; height: 32px; padding: 0 6px; text-align: center; font-size: 13px; background: var(--panel-2); border: 1px solid var(--line-strong); border-radius: 8px; color: var(--ink); flex: none; transition: border-color 0.15s var(--ease); }
.src-item__limit:focus { outline: none; border-color: var(--accent); }
.src-item__limit::placeholder { color: var(--sub); }

.tag { font-size: 10.5px; font-weight: 700; border-radius: 999px; padding: 2px 8px; white-space: nowrap; flex: none; }
.tag--channel { background: var(--accent-soft); color: var(--accent-ink); }
.tag--bot { background: var(--warn-soft); color: var(--warn); }
.tag--off { background: var(--danger-soft); color: var(--danger); }
.tag--rich { background: var(--warn-soft); color: var(--warn); }
.tag--media { background: var(--hover); color: var(--sub); }

/* ---------- Авто-сбор ---------- */
.auto-fetch { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel-2); }
.auto-fetch__label { font-size: 13.5px; font-weight: 700; flex: 1; }
.muted-sm { font-size: 12.5px; color: var(--sub); }
.switch { position: relative; width: 36px; height: 20px; border-radius: 999px; border: none; cursor: pointer; background: var(--line-strong); transition: background 0.15s var(--ease); padding: 0; flex: none; }
.switch.on { background: var(--accent); }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.15s var(--ease); }
.switch.on::after { transform: translateX(16px); }

/* ---------- Прогресс забора ---------- */
.fetch-progress {
  display: flex; align-items: center; gap: 10px; margin-top: 10px;
  padding: 10px 14px; border-radius: var(--r-sm); font-size: 13px; font-weight: 600;
  background: var(--accent-soft); color: var(--accent-ink);
  animation: fade 0.18s var(--ease);
}
.src-item--busy { border-color: var(--accent); }
.src-item--busy .src-item__name::after {
  content: ''; display: inline-block; width: 11px; height: 11px; margin-left: 2px;
  border-radius: 50%; border: 2px solid var(--accent-soft-2); border-top-color: var(--accent);
  animation: spin 0.7s linear infinite; vertical-align: middle;
}

/* ---------- Сообщения ---------- */
.msg-item { padding: 12px 2px; border-bottom: 1px solid var(--line); }
.msg-item:last-child { border-bottom: none; }
.msg-item__head { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--sub); margin-bottom: 5px; font-variant-numeric: tabular-nums; }
.msg-item__id { font-family: ui-monospace, Menlo, monospace; font-weight: 700; }
.msg-item pre { white-space: pre-wrap; font-family: inherit; font-size: 13.5px; color: var(--ink-2); max-height: 220px; overflow: auto; line-height: 1.5; }

/* ---------- Конфигуратор ---------- */
.page--wide { max-width: none; }
.cfg-grid { display: grid; grid-template-columns: repeat(5, minmax(185px, 1fr)); gap: 12px; align-items: start; }
@media (max-width: 1200px) { .cfg-grid { grid-template-columns: repeat(2, 1fr); } }
.cfg-val-dot { display: inline-flex; align-items: center; }
.cfg-item__check { width: 16px; height: 16px; border-radius: 5px; border: 1.5px solid var(--line-strong); flex: none; display: grid; place-items: center; color: #fff; font-size: 10px; transition: all 0.12s var(--ease); }
.cfg-item.on .cfg-item__check { background: var(--accent); border-color: var(--accent); }
.cfg-col { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; max-height: calc(100dvh - 220px); }
.cfg-col__head { padding: 12px 14px; font-size: 13px; font-weight: 700; color: var(--sub); border-bottom: 1px solid var(--line); }
.cfg-col__list { flex: 1; overflow-y: auto; padding: 6px; }
.cfg-col__add { padding: 8px; border-top: 1px solid var(--line); }
.cfg-item { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 8px 10px; border-radius: 9px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; transition: background-color 0.13s var(--ease), color 0.13s var(--ease); }
.cfg-item:hover { background: var(--hover); color: var(--ink); }
.cfg-item.on { background: var(--accent-soft); color: var(--accent-ink); }
.cfg-item__name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cfg-item__count { font-size: 11px; font-weight: 700; color: var(--sub); background: var(--card2); border-radius: 999px; padding: 1px 7px; flex: none; }
.cfg-item .icon-btn { width: 24px; height: 24px; border-radius: 6px; opacity: 0; flex: none; }
.cfg-item:hover .icon-btn { opacity: 1; }
.cfg-detail { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.cfg-attr { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); padding: 12px 16px; }
.cfg-attr__head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.cfg-attr__name { font-size: 13.5px; font-weight: 700; }
.cfg-attr__tr { font-size: 12px; color: var(--sub); }
.cfg-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.fpill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); background: transparent; color: var(--sub); font: inherit; font-size: 12.5px; font-weight: 700; padding: 5px 11px; border-radius: 999px; cursor: pointer; transition: all 0.13s var(--ease); }
.fpill:hover { border-color: var(--accent); color: var(--accent-ink); }
.fpill.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.color-dot { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0,0,0,0.15); flex: none; cursor: pointer; }
.fpill.on .color-dot { border-color: rgba(255,255,255,0.5); }
.cfg-configs { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); overflow: hidden; }
.cfg-configs__head { padding: 12px 16px; font-size: 13.5px; font-weight: 700; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11.5px; font-weight: 700; color: var(--sub); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; background: var(--panel); }
.tbl td { padding: 7px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: var(--hover); }
.cfg-id { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--sub); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: 11.5px; font-weight: 700; white-space: nowrap; font-family: ui-monospace, Menlo, monospace; }
.chip button { border: none; background: none; color: inherit; cursor: pointer; font-size: 13px; line-height: 1; padding: 0; opacity: 0.6; }
.chip button:hover { opacity: 1; }
.chip-add input { width: 110px; padding: 2px 8px; border: 1px dashed var(--line-strong); border-radius: 999px; background: transparent; font: inherit; font-size: 11.5px; color: var(--ink); outline: none; font-family: ui-monospace, Menlo, monospace; }
.chip-add input:focus { border-color: var(--accent); }
/* Кастомный дропдаун значений (с кружками цветов) */
.val-dd-btn { text-align: left; color: var(--sub); cursor: pointer; }
.val-dd-btn:not(:disabled):hover { border-color: var(--accent); color: var(--accent-ink); }
.val-dd { position: absolute; bottom: calc(100% + 6px); left: 0; right: 0; max-height: 280px; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-pop); padding: 5px; z-index: 50; animation: pop 0.14s var(--spring); }
.val-dd__item { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 7px 10px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.val-dd__item:hover { background: var(--accent-soft); color: var(--accent-ink); }
.val-dd__empty { padding: 10px; font-size: 12.5px; color: var(--sub); text-align: center; }

/* Поповер цвета */
.color-pop { position: fixed; z-index: 70; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-pop); padding: 14px; width: 240px; animation: fade 0.14s var(--spring); }
.color-pop__title { font-size: 12.5px; font-weight: 700; margin-bottom: 10px; }
.color-pop__row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.color-pop__row input[type="color"] { width: 44px; height: 32px; border: 1px solid var(--line); border-radius: 8px; background: none; padding: 2px; cursor: pointer; }
.color-pop__actions { display: flex; flex-direction: column; gap: 6px; }

/* ---------- Модалка ---------- */
.modal-scrim { position: fixed; inset: 0; z-index: 60; background: var(--scrim); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade 0.16s var(--ease); }
.modal { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 22px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow-pop); animation: pop 0.16s var(--spring); }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.modal__head h2 { font-size: 17px; }
.modal__actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.warr-pills { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Drag-and-drop ---------- */
.cfg-item { user-select: none; }
.cfg-item.dragging { opacity: 0.45; }
.cfg-item.drag-over { box-shadow: 0 -2px 0 0 var(--accent); border-radius: 0 0 9px 9px; }

/* ---------- Empty state ---------- */
.empty { padding: 34px 20px; text-align: center; color: var(--sub); font-size: 14px; }
.empty b { color: var(--ink-2); }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(84vw, var(--sidebar-w)); transform: translateX(-100%); transition: transform 0.26s var(--spring); box-shadow: var(--shadow-pop); }
  .sidebar--open { transform: translateX(0); }
  .sidebar__close { display: inline-grid; }
  .shell__scrim { display: block; position: fixed; inset: 0; z-index: 35; background: var(--scrim); backdrop-filter: blur(2px); animation: fade 0.2s var(--ease); }
  .topbar__burger { display: inline-grid; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
