/* ============================================================================
   01. ТОКЕНЫ
   ============================================================================ */
:root {
  --accent: #2f6fe4;
  --accent-2: #5b9dff;
  --accent-deep: #1f4fd8;
  --accent-soft: #eaf2ff;
  --accent-soft-2: #dce9ff;
  --accent-line: #cfe0fb;
  --accent-opacity: #2f6fe414;

  --bg: #eef4ff;
  --surface: #ffffff;
  --surface-soft: #f5f9ff;
  --surface-muted: #eef4fc;
  --ink: #0e1b33;
  --ink-soft: #5b6b85;
  --muted: #8a99b3;
  --line: #e6eefc;
  --line-strong: #d5e3f8;

  --danger: #e5484d;
  --danger-soft: #ffefef;
  --warning: #f59e0b;
  --success: #12b76a;

  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;

  --shadow: 0 18px 44px rgb(31 76 168 / 0.1);
  --shadow-sm: 0 8px 22px rgb(31 76 168 / 0.09);
  --shadow-xs: 0 2px 10px rgb(31 76 168 / 0.05);
  --shadow-primary: 0 10px 22px rgb(47 111 228 / 0.26);

  --grad: linear-gradient(135deg, #2f6fe4 0%, #4f8bf7 55%, #6aa2ff 100%);
  --font:
    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono:
    12px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --icon-size: 24px;
  --icon-color: #206bc4;
  --space: 1rem;
  --ease: cubic-bezier(0.22, 0.8, 0.24, 1);
}

/* ============================================================================
   02. БАЗА
   ============================================================================ */
* {
  box-sizing: border-box;
  line-height: 1lh;
}

html {
  height: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
  font: 400 14px/1.5 var(--font);
  background:
    radial-gradient(900px 520px at 6% -12%, #ffffff 0%, transparent 58%),
    radial-gradient(760px 520px at 102% -4%, #dce9ff 0%, transparent 55%),
    linear-gradient(165deg, #f8fbff 0%, #eef5ff 44%, #e3eeff 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizelegibility;
}

::selection {
  color: #fff;
  background: var(--accent);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

[hidden] {
  display: none !important;
}

:is(input, select, textarea):focus {
  outline: 0;
}

:is(button, a, input, select, textarea):focus-visible {
  outline: 3px solid rgb(47 111 228 / 0.35);
  outline-offset: 2px;
}

/* Иконки спрайта */
.icon {
  display: inline-block;
  flex: none;
  color: inherit;
  fill: currentcolor;
  vertical-align: middle;
}

.icon--sm {
  width: 0.875rem;
  height: 0.875rem;
}

.icon--md {
  width: 1rem;
  height: 1rem;
}

.icon--lg {
  width: 1.5rem;
  height: 1.5rem;
}

#sprite-host {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* ============================================================================
   03. КАРКАС
   ============================================================================ */
.body__main {
  display: grid;
  grid-template-columns: 328px minmax(0, 1fr);
  align-items: start;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
  transition: grid-template-columns 0.3s var(--ease);
}

aside {
  min-width: 0;
}

main {
  min-width: 0;
}

/* ============================================================================
   04. САЙДБАР
   ============================================================================ */
.sticky__panel--wrapper {
  position: sticky;
  top: 20px;
  padding-right: 1.5rem;
}

.sticky__panel {
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  padding: 10px;

  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  scrollbar-width: thin;
  scrollbar-color: #d7e4f8 transparent;
  align-self: start;
  &::-webkit-scrollbar {
    display: none;
  }

  scrollbar-width: none;
  -ms-overflow-style: none;
}

/* .sticky__panel::-webkit-scrollbar {
  width: 6px;
}

.sticky__panel::-webkit-scrollbar-thumb {
  background: #d7e4f8;
  border-radius: 99px;
} */

/* Бренд */
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 12px 14px;
}

.brand__mark {
  position: relative;
  flex: none;
  width: 38px;
  height: 38px;
  background: var(--grad);
  border-radius: 12px;
  box-shadow: 0 8px 18px rgb(47 111 228 / 0.3);
}

.brand__mark::before {
  content: "";
  position: absolute;
  inset: 10px;
  background: radial-gradient(circle, #ffffff 2.4px, transparent 2.6px) 0 0 /
    9px 9px;
  opacity: 0.95;
}

.brand__text {
  display: grid;
  gap: 1px;
  line-height: 1.15;
}

.brand__text strong {
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand__text small {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

/* ============================================================================
   05. ПАНЕЛИ И ЗАГОЛОВКИ
   ============================================================================ */
.panel {
  margin: 0;
  padding: 18px 16px;
  background: transparent;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}

.panel:last-child {
  border-bottom: 0;
}

.panel :is(h1, h2) {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 13px;
  padding: 0;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  border: 0;
}

.panel__hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.45;
}

.row {
  margin-bottom: 15px;
}

.row:last-child {
  margin-bottom: 0;
}

.rowlabel,
.boxlabel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 500;
}

.rowlabel output {
  min-width: 34px;
  padding: 2px 9px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 500;
  text-align: center;
  background: var(--accent-soft);
  border-radius: 7px;
}

.rowlabel code,
.colorrow code {
  padding: 2px 9px;
  color: var(--ink);
  font: 600 10.5px/1.5 var(--font-mono);
  background: var(--accent-soft);
  border-radius: 7px;
  font-weight: 500;
}

/* ============================================================================
   06. ФОРМЫ
   ============================================================================ */
input[type="text"],
select,
textarea {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  color: var(--ink);
  font: 500 12.5px/1.4 var(--font);
  background: #fbfdff;
  border: 1px solid var(--line);
  border-radius: 12px;
  transition:
    border-color 0.16s,
    box-shadow 0.16s,
    background 0.16s;
}

#pathInput,
#clsInput {
  height: 38px;
  padding: 0 11px;
  color: #3f4f6b;
  font: 500 11.5px/1.4 var(--font-mono);
  background: var(--surface-soft);
}

input[type="text"]:hover,
select:hover {
  border-color: var(--line-strong);
}

input[type="text"]:focus,
select:focus {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgb(47 111 228 / 0.14);
}

.select,
select {
  padding-right: 36px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238a99b3' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: var(--surface-soft);
}

/* Ползунок размера */
input[type="range"] {
  width: 100%;
  height: 20px;
  margin: 2px 0 0;
  background: transparent;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  background: linear-gradient(90deg, var(--accent-soft-2), #e6eefc);
  border-radius: 99px;
}

input[type="range"]::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: -6px;
  background: #fff;
  border: 4px solid var(--accent);
  border-radius: 50%;
  box-shadow: 0 3px 8px rgb(47 111 228 / 0.32);
  appearance: none;
  -webkit-appearance: none;
  transition: transform 0.15s var(--ease);
}

input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(1.12);
}

input[type="range"]::-moz-range-track {
  height: 6px;
  background: #e6eefc;
  border-radius: 99px;
}

input[type="range"]::-moz-range-progress {
  height: 6px;
  background: var(--accent-soft-2);
  border-radius: 99px;
}

input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: #fff;
  border: 4px solid var(--accent);
  border-radius: 50%;
  box-shadow: 0 3px 8px rgb(47 111 228 / 0.32);
}

/* Цвет */
#colorInput {
  width: 100%;
  height: 40px;
  padding: 4px;
  background: #fbfdff;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

#colorInput:hover {
  border-color: var(--line-strong);
}

#colorInput::-webkit-color-swatch-wrapper {
  padding: 0;
}

#colorInput::-webkit-color-swatch {
  border: 0;
  border-radius: 8px;
}

#colorInput::-moz-color-swatch {
  border: 0;
  border-radius: 8px;
}

.colorrow {
  display: flex;
  align-items: center;
  gap: 8px;
}

.colorrow #colorInput {
  flex: none;
  width: 48px;
  height: 40px;
}

.colorrow .seg {
  flex: 1;
  min-width: 0;
  margin-top: 0;
}

.colorrow .seg__btn {
  padding: 6px 6px;
}

/* ============================================================================
   07. КНОПКИ
   ============================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition:
    background 0.16s,
    border-color 0.16s,
    color 0.16s,
    box-shadow 0.16s,
    transform 0.16s;
}

.btn:hover {
  color: var(--accent-deep);
  background: #f7faff;
  border-color: var(--accent-line);
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  color: #fff;
  background: var(--grad);
  border: 0;
  box-shadow: var(--shadow-primary);
}

.btn--primary:hover {
  color: #fff;
  background: linear-gradient(135deg, #3d7bee, #67a0ff);
  border-color: transparent;
  box-shadow: 0 14px 26px rgb(47 111 228 / 0.32);
}

.btn--danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #ffd9d9;
}

.btn--danger:hover {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}

.btn--ghost {
  color: var(--ink-soft);
  background: transparent;
  border-color: var(--line);
}

.btn--ghost:hover {
  color: var(--accent-deep);
  background: #f7faff;
}

.btn--sm {
  height: 30px;
  padding: 0 11px;
  font-size: 11.5px;
  border-radius: 9px;
}

.btn--full {
  width: 100%;
}

.btn--icon {
  width: 30px;
  height: 30px;
  padding: 0;
  color: var(--ink-soft);
  background: var(--surface-muted);
  border: 0;
  border-radius: 9px;
}

.btn--icon:hover {
  color: var(--accent-deep);
  background: var(--accent-soft);
}

.btn--icon .icon {
  width: 14px;
  height: 14px;
}

.btnrow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn--basket {
  flex: 1 1 0;
  height: 42px;
  min-width: 0;
  padding: 0 12px;
  font-size: 11.5px;
}

.btn--basket .icon {
  width: 15px;
  height: 15px;
}

.btn__basket {
  height: 48px;
  padding: 0 14px;
  color: var(--ink);
  background: #fff;
  border-color: #fff;
  border-radius: 14px;
  box-shadow: var(--shadow-xs);
}

.btn__basket:hover {
  color: var(--accent-deep);
  background: #fff;
  border-color: var(--accent-line);
  box-shadow: var(--shadow-sm);
}

.bcount {
  display: inline-grid;
  height: 20px;
  min-width: 20px;
  padding: 0 6px;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  background: var(--grad);
  border-radius: 999px;
  place-items: center;
}

/* ============================================================================
   08. СЕГМЕНТИРОВАННЫЙ КОНТРОЛЬ
   ============================================================================ */
.seg {
  display: flex;
  gap: 3px;
  padding: 4px;
  overflow: hidden;
  background: var(--surface-muted);
  border: 0;
  border-radius: 13px;
}

.seg__btn {
  flex: 1;
  padding: 7px 8px;
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  background: transparent;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  transition:
    background 0.16s,
    color 0.16s,
    box-shadow 0.16s;
}

.seg__btn:hover {
  color: var(--accent-deep);
  background: var(--surface-soft);
}

.seg__btn.active {
  color: var(--surface);
  background: var(--accent);
  box-shadow: 0 2px 8px rgb(31 76 168 / 0.13);
}

.seg--sm {
  margin-top: 12px;
}

.seg--sm .seg__btn {
  padding: 5px 6px;
  font-size: 10.5px;
}

.seg--disabled {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
}

#projbar .seg--sm {
  margin-top: 6px;
}

/* ============================================================================
   09. ПРОЕКТЫ
   ============================================================================ */
.projhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.projhead__btns {
  display: flex;
  gap: 4px;
}

.projhead__btns .btn--icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
}

.projhead__btns .icon {
  color: var(--muted);
}

.projhead__btns .btn--icon:hover .icon {
  color: var(--accent-deep);
}

#projPanel.collapsed #projBody,
#projPanel.collapsed #projbar {
  display: none;
}

.projlist {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 10px;
}

.projrow {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 7px 0 11px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: grab;
  transition:
    background 0.15s,
    border-color 0.15s;
}

.projrow .projrow__drag {
  position: absolute;
}

.projrow:hover .projrow__drag {
  position: relative;
}

.projrow:hover {
  background: var(--surface-soft);
}

.projrow--active {
  background: linear-gradient(90deg, #edf4ff, #f8fbff);
  border-color: #dbe9ff;
}

.projrow--active::before {
  content: "";
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.projrow.dragover {
  border-color: var(--accent);
  border-style: dashed;
  background: var(--accent-soft);
}

.projrow__name {
  flex: 1;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: none;
  border: 0;
  cursor: pointer;
}

.projrow--active .projrow__name {
  color: var(--ink);
  font-weight: 600;
}

.projrow__count {
  display: grid;
  flex: none;
  width: 23px;
  height: 22px;
  color: var(--ink);
  font-size: 10.5px;
  font-weight: 500;
  background: var(--accent-soft);
  border-radius: 7px;
  place-items: center;
}

.projrow--active .projrow__count {
  background: #fff;
}

.projrow__acts {
  display: none;
  flex: none;
  gap: 2px;
}

.projrow:hover .projrow__acts {
  display: flex;
}

.projrow__acts button {
  display: grid;
  width: 24px;
  height: 24px;
  padding: 0;
  color: var(--ink-soft);
  font-size: 11px;
  background: #fff;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  place-items: center;
}

.projrow__acts button:hover {
  color: var(--accent-deep);
  background: var(--accent-soft);
}

.projrow__acts svg {
  width: 12px;
  height: 12px;
  color: currentcolor;
}

.projrow__acts button[data-act="del"] {
  color: var(--danger);
}

.projrow__acts button[data-act="del"]:hover {
  color: #fff;
  background: var(--danger);
}

.projrow__drag {
  flex: none;
  padding-left: 1px;
  color: #b9c7dd;
  font-size: 10px;
  letter-spacing: -1.5px;
  cursor: grab;
  user-select: none;
  opacity: 0;
  transition: opacity 0.15s;
}

.projrow:hover .projrow__drag {
  opacity: 1;
}

.projarchive__head {
  margin: 12px 0 2px;
  padding: 4px 10px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.projarchive__head:hover {
  color: var(--accent-deep);
}

.projlist--archive .projrow {
  opacity: 0.6;
}

#projLogin {
  margin-top: 10px;
  color: var(--ink-soft);
  font-size: 11.5px;
  line-height: 1.5;
}

/* ============================================================================
   10. ВЕРХНЯЯ ПАНЕЛЬ: ПОИСК И КОРЗИНА
   ============================================================================ */
.search {
  position: sticky;
  top: 20px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: rgb(255 255 255 / 0.72);
  border: 1px solid rgb(255 255 255 / 0.9);
  border-radius: 20px;
  box-shadow: 0 12px 30px rgb(31 76 168 / 0.08);
  backdrop-filter: blur(18px);
}

.sidebar-toggle {
  width: 46px;
  height: 48px;
  flex: none;
  padding: 0;
  color: var(--ink-soft);
  background: #fff;
  border: 1px solid transparent;
  border-radius: 14px;
  box-shadow: var(--shadow-xs);
}

.sidebar-toggle:hover {
  color: var(--accent-deep);
  background: #fff;
  border-color: var(--accent-line);
}

.sidebar-toggle .icon {
  width: 20px;
  height: 20px;
}

.searchwrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.searchwrap > svg {
  position: absolute;
  top: 50%;
  left: 16px;
  z-index: 1;
  color: var(--muted);
  pointer-events: none;
  transform: translateY(-50%);
}

#search {
  width: 100%;
  height: 48px;
  padding: 0 52px 0 43px;
  color: var(--ink);
  font: 500 13.5px/1.4 var(--font);
  background: #fff;
  border: 1px solid #e8f0fc;
  border-radius: 14px;
  transition:
    border-color 0.16s,
    box-shadow 0.16s;
}

#search::placeholder {
  color: var(--muted);
  font-weight: 400;
}

#search:hover {
  border-color: var(--line-strong);
}

#search:focus {
  background: #fff;
  border-color: var(--accent);
  outline: 0;
  box-shadow: 0 0 0 4px rgb(47 111 228 / 0.14);
}

.search-kbd {
  position: absolute;
  top: 50%;
  right: 13px;
  display: grid;
  width: 24px;
  height: 24px;
  color: var(--muted);
  font: 600 11px/1 var(--font-mono);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 7px;
  transform: translateY(-50%);
  place-items: center;
  pointer-events: none;
}

.searchwrap.has-value .search-kbd {
  display: none;
}

.searchclear {
  position: absolute;
  top: 50%;
  right: 9px;
  display: none;
  width: 30px;
  height: 30px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  transform: translateY(-50%);
  place-items: center;
}

.searchwrap.has-value .searchclear {
  display: grid;
}

.searchclear:hover {
  color: var(--ink);
  background: var(--surface-muted);
}

/* ============================================================================
   11. ЗАГОЛОВОК СЕТКИ
   ============================================================================ */
.head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 28px 4px 18px;
}

.head h3 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(26px, 2.3vw, 32px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.head__hint {
  margin: 7px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
}

#count {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-xs);
}

#count::before {
  content: "";
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ============================================================================
   12. СЕТКА ИКОНОК
   ============================================================================ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(98px, 1fr));
  gap: 12px;
}

.tile {
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 6px;
  /* aspect-ratio: 1 / 1; */
  height: 110px;
  padding: 14px 10px 11px;
  overflow: hidden;
  color: inherit;
  font: inherit;
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: 18px;
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  place-items: center;
  transition:
    transform 0.2s var(--ease),
    box-shadow 0.2s,
    border-color 0.2s,
    background 0.2s;
}

.tile:hover {
  border-color: var(--accent-line);
  /* box-shadow: var(--shadow-primary);
  transform: translateY(-1px); */
}

.tile:active {
  transform: translateY(-1px);
}

.tile:focus-visible {
  outline: 3px solid rgb(47 111 228 / 0.35);
  outline-offset: 2px;
}

.tile > svg {
  align-self: center;
  width: var(--icon-size);
  height: var(--icon-size);
  max-width: 60%;
  max-height: 60%;
  color: var(--icon-color);
  transition: transform 0.2s var(--ease);
}

.tile:hover > svg {
  transform: scale(1.07);
}

.tile__name {
  width: 100%;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1.25;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile:hover .tile__name {
  color: transparent;
}

.tile__copy,
.tile__basket {
  position: absolute;
  bottom: 8px;
  display: grid;
  width: 40%;
  height: 2.4rem;
  color: var(--accent);
  background: var(--bg);
  border-radius: 9px;
  opacity: 0;
  transform: translateY(-4px);
  transition:
    opacity 0.16s,
    transform 0.16s,
    background 0.16s,
    color 0.16s;
  place-items: center;
  pointer-events: none;
}

.tile__copy {
  left: 8px;
  flex: 1 1 60px;
}

.tile__basket {
  right: 8px;
  flex: 1 1 60px;
}

.tile:hover .tile__copy,
.tile:hover .tile__basket,
.tile:focus-within .tile__copy,
.tile:focus-within .tile__basket {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.tile__copy:hover,
.tile__basket:hover {
  color: #fff;
  background: var(--accent);
}

.tile__copy svg,
.tile__basket svg {
  width: 1rem;
  height: 1rem;
  color: currentcolor;
}

.tile.in-basket {
  background: linear-gradient(180deg, #f2f7ff, #fff);
  border-color: var(--accent-line);
}
.tile.in-basket:hover .tile__name {
  color: transparent;
}

.tile.in-basket::before {
  content: "";
  position: absolute;
  top: 12px;
  left: 12px;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.tile.in-basket .tile__name {
  color: var(--ink-soft);
}

@media (hover: none) {
  .tile {
    padding-top: 36px;
  }

  /* .tile__copy {
    display: none;
  } */

  .tile__basket {
    /* top: 8px;
    right: 8px; */
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }

  .projrow__acts {
    display: none;
  }

  .projrow--active {
    height: auto;
    min-height: 44px;
    padding-top: 4px;
    padding-bottom: 5px;
    flex-wrap: wrap;
  }

  .projrow--active .projrow__acts {
    display: flex;
    flex-basis: 100%;
    justify-content: flex-end;
    gap: 4px;
  }

  .projrow__drag {
    display: none;
  }

  .tile__basket {
    color: var(--accent-deep);
    background: var(--accent-soft);
    box-shadow: none;
  }

  .tile.in-basket .tile__basket {
    color: #fff;
    background: var(--accent);
  }

  .basket-item .bi-copy,
  .basket-item .bi-x {
    opacity: 1;
  }
}

/* ============================================================================
   13. ПАГИНАЦИЯ И ПУСТОЕ СОСТОЯНИЕ
   ============================================================================ */
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin: 20px 0 6px;
}

.pagination__label {
  margin-right: 6px;
  color: var(--ink-soft);
  font-size: 12px;
}

.pagination__btn {
  min-width: 36px;
  height: 36px;
  padding: 0 9px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s,
    border-color 0.15s,
    box-shadow 0.15s;
}

.pagination__btn:hover {
  color: var(--accent-deep);
  background: #f7faff;
  border-color: var(--accent-line);
}

.pagination__btn.active {
  color: #fff;
  background: var(--grad);
  border-color: transparent;
  box-shadow: 0 8px 18px rgb(47 111 228 / 0.26);
  cursor: default;
}

.pagination__gap {
  padding: 0 3px;
  color: var(--muted);
  font-size: 12px;
}

.empty {
  margin-top: 12px;
  padding: 70px 20px;
  color: var(--ink-soft);
  font-size: 14px;
  text-align: center;
  background: rgb(255 255 255 / 0.6);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
}

.empty::before {
  content: "";
  display: block;
  width: 46px;
  height: 46px;
  margin: 0 auto 14px;
  background: var(--accent-soft);
  border-radius: 14px;
}

/* ============================================================================
   14. МОДАЛКИ: БАЗА
   ============================================================================ */
.overlay {
  position: fixed;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgb(10 22 44 / 0.42);
  backdrop-filter: blur(6px);
  inset: 0;
}

.overlay.open {
  display: flex;
}

.modal {
  position: relative;
  width: min(960px, 96vw);
  max-height: 90vh;
  padding: 30px;
  overflow-y: auto;
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: 0 40px 90px rgb(10 22 44 / 0.3);
  scrollbar-width: thin;
  scrollbar-color: #d7e4f8 transparent;
}

.modal--sm {
  width: min(580px, 94vw);
}

.modal__x {
  position: absolute;
  top: 20px;
  right: 20px;
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  color: var(--ink-soft);
  background: var(--surface-muted);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  place-items: center;
  transition:
    background 0.15s,
    color 0.15s;
}

.modal__x:hover {
  color: var(--accent-deep);
  background: var(--accent-soft);
}

.modal h2 {
  margin: 0;
  padding-right: 48px;
  color: var(--ink);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.modal__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 24px;
  color: var(--ink-soft);
  font: 500 11px var(--font-mono);
}

.modal__meta code,
.modal__meta span {
  padding: 5px 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.modal__body {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 28px;
}

.modal__content {
  min-width: 0;
}

.modal__btns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 22px;
}

.modal__btns .btn {
  width: 100%;
  min-width: 0;
  padding: 0 10px;
}

.modal__btns.mb-0 {
  margin-bottom: 0;
}

/* ============================================================================
   15. МОДАЛКА ИКОНКИ
   ============================================================================ */
.modal__prev {
  display: grid;
  height: 320px;
  background-color: #f1f7ff;
  background-image:
    radial-gradient(#d6e4fb 1.2px, transparent 1.2px),
    linear-gradient(160deg, #f5faff, #e8f1ff);
  background-size:
    18px 18px,
    100% 100%;
  border: 1px solid #e3edfd;
  border-radius: 24px;
  place-items: center;
}

.modal__prev svg {
  width: 150px;
  height: 150px;
  color: var(--icon-color);
}

.boxlabel {
  display: block;
  margin: 18px 0 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.modal__btns + .boxlabel {
  margin-top: 0;
}

.codebox {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  max-height: 89px;
  margin-bottom: 0;
  padding: 12px 14px;
  overflow: auto;
  color: #3f4f6b;
  font: 11.5px/1.7 var(--font-mono);
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 14px;

  scrollbar-width: none;

  &::-webkit-scrollbar {
    display: none;
  }
}

.codebox code,
.codebox pre {
  flex-grow: 1;
  min-width: 0;
  padding-right: 38px;
  font: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.codebox__copy {
  position: sticky;
  top: 0;
  right: 0;
  z-index: 2;
  display: grid;
  flex: none;
  width: 30px;
  height: 30px;
  margin-top: -3px;
  margin-left: -30px;
  padding: 0;
  color: var(--ink-soft);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
  place-items: center;
  transition:
    color 0.15s,
    border-color 0.15s,
    background 0.15s;
}

.codebox__copy:hover {
  color: var(--accent-deep);
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

/* ============================================================================
   16. КОРЗИНА
   ============================================================================ */
.basket-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 10px;
  margin: 14px 0 24px;
}

.basket-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  aspect-ratio: 1 / 1;
  padding: 14px 8px 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 16px;
  transition:
    background 0.15s,
    border-color 0.15s;
}

.basket-item:hover {
  background: #fff;
  border-color: var(--accent-line);
}

.basket-item > svg {
  width: 28px;
  height: 4rem;
  color: var(--icon-color);
}

.basket-item .bi-name {
  width: 100%;
  margin-top: auto;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 500;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.basket-item .bi-x {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  width: 22px;
  height: 22px;
  padding: 0;
  color: var(--danger);
  font-size: 10px;
  font-weight: 700;
  background: #fff;
  border: 1px solid #ffe0e0;
  border-radius: 7px;
  opacity: 0;
  cursor: pointer;
  transition: opacity 0.15s;
  place-items: center;
}

.basket-item:hover .bi-x {
  opacity: 1;
}

.basket-item .bi-x:hover {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}

.basket-item .bi-copy {
  position: absolute;
  right: 8px;
  bottom: 8px;
  left: 8px;
  display: grid;
  height: 30px;
  color: var(--accent);
  border: 0;
  border-radius: 9px;
  box-shadow: 0 4px 12px rgb(31 76 168 / 0.1);
  opacity: 0;
  cursor: pointer;
  transition:
    opacity 0.15s,
    background 0.15s,
    color 0.15s;
  place-items: center;
}

.basket-item:hover .bi-copy {
  opacity: 1;
}

.basket-item:hover .bi-copy {
  color: #fff;
  background: var(--accent);
}

.basket-item .bi-copy svg {
  width: 14px;
  height: 14px;
}

.basket-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.basket-actions--wrapper {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.bzone {
  padding: 16px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 20px;
}

.bzone__head {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: center;
  margin-bottom: 11px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
}

.bzone__head code {
  padding: 2px 7px;
  color: var(--ink);
  font: 500 10.5px var(--font-mono);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow-wrap: anywhere;
}

.basket-service {
  justify-content: space-between;
  margin-top: 4px;
}

/* ============================================================================
   17. ЛОГ СБОРКИ
   ============================================================================ */
.log-body {
  max-height: 400px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  color: #42526b;
  font: 11.5px/1.7 var(--font-mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.log__title {
  padding-bottom: 1rem;
}
.log__reload {
  border: 1px dashed var(--accent-line);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
}

/* ============================================================================
   18. СТАТУС И АВТОРИЗАЦИЯ
   ============================================================================ */
.status-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.status-panel h2 {
  justify-content: space-between;
  width: 100%;
  margin-bottom: 0;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: auto;
  height: 20px;
  margin-left: auto;
  padding: 0 8px;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: none;
  background: var(--surface-muted);
  border-radius: 999px;
}

.status-dot::before {
  content: "";
  width: 6px;
  height: 6px;
  background: currentcolor;
  border-radius: 50%;
}

.status-dot::after {
  content: "—";
}

.status-dot.ok {
  color: #0e9f6e;
  background: #e7f8f0;
}

.status-dot.ok::after {
  content: "Готово";
}

.status-dot.warn {
  color: #c27803;
  background: #fff5e5;
}

.status-dot.warn::after {
  content: "Дубликаты";
}

.status-dot.bad {
  color: #d92d20;
  background: #ffeceb;
}

.status-dot.bad::after {
  content: "Ошибка";
}

.status-panel .btn {
  width: 100%;
  height: 34px;
  color: var(--ink-soft);
  font-size: 11.5px;
  background: var(--surface-soft);
  border-color: transparent;
}

.status-panel .btn:hover {
  color: var(--accent-deep);
  background: var(--accent-soft);
}

.auth-panel {
  padding-top: 10px;
  padding-bottom: 12px;
  border-bottom: 0;
}

.auth-panel h2 {
  display: none;
}

.auth-panel .btn--full {
  height: 34px;
  color: var(--ink-soft);
  font-size: 11.5px;
  background: var(--surface-soft);
  border-color: transparent;
}

.auth-panel .btn--full:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.auth-panel .btn--primary.btn--full {
  color: #fff;
  background: var(--grad);
}

/* ============================================================================
   19. TOAST
   ============================================================================ */
#toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  z-index: 90;
  max-width: 90vw;
  padding: 11px 18px;
  overflow: hidden;
  color: #fff;
  font-size: 12.5px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: #0f1b33;
  border-radius: 999px;
  box-shadow: 0 18px 40px rgb(10 22 44 / 0.3);
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
  transition:
    opacity 0.18s,
    transform 0.18s;
  pointer-events: none;
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================================================
   20. СВЕРНУТЫЙ САЙДБАР (desktop)
   ============================================================================ */
.body__main.sidebar-collapsed {
  grid-template-columns: 0 minmax(0, 1fr);
}

.body__main.sidebar-collapsed aside {
  display: block;
  overflow: hidden;
}

.body__main.sidebar-collapsed .sticky__panel {
  display: none;
}

/* ============================================================================
   21. АДАПТИВ
   ============================================================================ */
@media (max-width: 1240px) {
  .body__main {
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 20px;
    padding: 18px;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  }
}

@media (max-width: 980px) {
  .body__main,
  .body__main.sidebar-collapsed {
    /* grid-template-columns: minmax(0, 1fr); */
    gap: 0;
    padding: 16px;
  }

  /* Поиск остаётся поверх затемнения, чтобы кнопкой меню можно было закрыть панель */
  .search {
    top: 12px;
    z-index: 30;
  }

  body:not(.sidebar-collapsed) .search {
    z-index: 70;
  }

  aside {
    position: fixed;
    top: 84px;
    bottom: 12px;
    left: 12px;
    z-index: 55;
    display: block;
    width: min(78vw, 340px);
    padding: 0;
    transform: translateX(-112%);
    transition: transform 0.3s var(--ease);
  }

  body:not(.sidebar-collapsed) aside {
    transform: none;
  }

  body:not(.sidebar-collapsed) {
    overflow: hidden;
  }

  /* body:not(.sidebar-collapsed)::before {
    content: "";
    position: fixed;
    z-index: 50;
    background: rgb(10 22 44 / 0.45);
    backdrop-filter: blur(3px);
    inset: 84px 0 0;
  } */

  .sticky__panel {
    position: relative;
    top: 0;
    max-height: 100%;
    border-radius: 24px;
    box-shadow: 0 30px 60px rgb(10 22 44 / 0.25);
  }

  .body__main.sidebar-collapsed .sticky__panel {
    display: block;
  }

  .modal {
    max-height: 92vh;
  }
}

@media (max-width: 720px) {
  .search {
    gap: 6px;
    padding: 6px;
    border-radius: 18px;
  }

  .sidebar-toggle {
    width: 48px;
    height: 46px;
  }

  #search {
    height: 46px;
    padding: 0 46px 0 40px;
    font-size: 13px;
  }

  .searchwrap > svg {
    left: 14px;
  }

  .search-kbd {
    display: none;
  }

  .btn__basket {
    height: 46px;
    padding: 0 12px;
    font-size: 0;
    gap: 6px;
  }

  .btn__basket .icon {
    width: 18px;
    height: 18px;
  }

  .bcount {
    font-size: 10.5px;
  }

  .head {
    margin: 22px 4px 16px;
  }

  .head__hint {
    max-width: 34ch;
    font-size: 12px;
  }

  #count {
    height: 30px;
    margin-left: auto;
    font-size: 11px;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 10px;
  }

  .tile {
    border-radius: 16px;
    padding: 12px 8px 9px;
  }

  /* .tile__copy,
  .tile__basket {
    top: 6px;
    width: 26px;
    height: 26px;
  } */

  .tile__copy {
    right: 36px;
  }

  .tile__basket {
    right: 6px;
  }

  .modal {
    width: 100%;
    padding: 20px;
    border-radius: 22px;
  }

  .modal h2 {
    padding-right: 42px;
    font-size: 22px;
  }

  .modal__body {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }

  .modal__prev {
    height: 220px;
    border-radius: 20px;
  }

  .modal__prev svg {
    width: 110px;
    height: 110px;
  }

  .modal__meta {
    margin-bottom: 18px;
  }

  .modal__btns {
    gap: 6px;
    margin-bottom: 16px;
  }

  .modal__btns .btn {
    flex: 1 1 auto;
  }

  .codebox {
    max-height: 170px;
  }

  .basket-actions--wrapper {
    grid-template-columns: minmax(0, 1fr);
  }

  .basket-grid {
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  }

  .pagination {
    justify-content: center;
  }

  .pagination__label {
    width: 100%;
    margin: 0 0 4px;
    text-align: center;
  }

  #toast {
    bottom: 24px;
  }
}

@media (max-width: 560px) {
  .modal__btns {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
/*  */
