/* ══════════════════════════════════════════════════════════════════
   «Все инструменты» — попап, привязанный к sidebar-ссылке (imagine.art).
   На мобилке — bottom-sheet.
   Позиция подсчитывается в JS от rect ссылки .side-tools .side-link.
   ══════════════════════════════════════════════════════════════════ */

.tm-backdrop {
  position: fixed; inset: 0; z-index: 100000;
  background: rgba(0,0,0,.35);
  opacity: 0; pointer-events: none;
  transition: opacity .18s ease;
}
.tm-backdrop.on { opacity: 1; pointer-events: auto; }

/* Десктоп — попап (JS ставит inline left/bottom) */
.tm-panel {
  position: fixed; z-index: 100001;
  width: min(560px, calc(100vw - var(--sbw, 264px) - 32px));
  max-height: 76vh;
  background: var(--panel-2, #171717);
  color: var(--ink, #fff);
  border-radius: 20px;
  box-shadow:
    0 30px 80px -20px rgba(0,0,0,.8),
    inset 0 0 0 1px var(--hairline, rgba(255,255,255,.07));
  display: flex; flex-direction: column;
  opacity: 0; pointer-events: none;
  transform: translateY(8px) scale(.985);
  transform-origin: bottom left;
  transition: opacity .18s ease, transform .22s cubic-bezier(.22,1,.36,1);
}
.tm-panel.on { opacity: 1; pointer-events: auto; transform: translateY(0) scale(1); }

/* Header */
.tm-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 18px 20px 8px;
}
.tm-title {
  font: 700 17px var(--font); color: var(--ink);
  letter-spacing: -0.015em; margin: 0;
}
.tm-showall {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px;
  background: var(--fill-3, rgba(255,255,255,.12));
  color: var(--ink);
  font: 600 12.5px var(--font); text-decoration: none;
  transition: background .14s, transform .14s;
}
.tm-showall:hover { background: rgba(255,255,255,.18); transform: translateY(-1px); }
.tm-showall svg { width: 11px; height: 11px; }
.tm-close { display: none; }

/* Список: 2 колонки, каждая строка — иконка + текст */
.tm-body {
  flex: 1; overflow-y: auto;
  padding: 6px 10px 14px;
}
.tm-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px 6px;
}
.tm-tile {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 10px;
  border-radius: 12px;
  text-decoration: none; color: var(--ink);
  transition: background .12s;
  min-width: 0;
}
.tm-tile:hover { background: var(--fill-3, rgba(255,255,255,.12)); }
.tm-tile .tm-ic {
  width: 40px; height: 40px; flex: 0 0 40px; border-radius: 10px;
  display: grid; place-items: center; color: var(--ink);
  background: rgba(255,255,255,.06);
  box-shadow: inset 0 0 0 .5px var(--hairline);
}
.tm-tile .tm-ic svg { width: 18px; height: 18px; }
.tm-tile .tm-ic img { width: 22px; height: 22px; object-fit: contain; }
.tm-tile .tm-text { display: flex; flex-direction: column; min-width: 0; }
.tm-tile .tm-name {
  font: 600 14px var(--font); letter-spacing: -0.005em; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tm-tile .tm-desc { font: 400 12px var(--font); color: var(--dim); }

.tm-empty {
  grid-column: 1 / -1;
  padding: 40px 20px; text-align: center;
  color: var(--dim); font-size: 13px;
}

/* ══════ Мобилка ══════ */
@media (max-width: 900px) {
  .tm-panel {
    left: 10px !important; right: 10px !important; bottom: 10px !important; top: auto !important;
    width: auto !important; max-height: 78vh;
    border-radius: 22px;
    transform: translateY(24px) scale(1);
    transform-origin: center bottom;
  }
  .tm-panel.on { transform: translateY(0) scale(1); }
  .tm-head { padding: 14px 16px 8px; }
  .tm-title { font-size: 16px; }
  .tm-close {
    display: grid; place-items: center;
    width: 32px; height: 32px; border: 0;
    background: var(--fill-3); color: var(--soft);
    border-radius: 10px; cursor: pointer;
  }
  .tm-close svg { width: 12px; height: 12px; }
  .tm-showall { display: none; }
  .tm-grid { grid-template-columns: 1fr; }
  .tm-body { padding: 4px 8px 6px; }
  .tm-mob-cta { display: block; padding: 10px 12px 14px; border-top: 1px solid var(--hairline); }
  .tm-mob-cta .tm-showall-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 12px 16px; border-radius: 999px;
    background: var(--ink); color: var(--bg, #0a0a0a);
    font: 600 13.5px var(--font); text-decoration: none;
  }
  .tm-mob-cta .tm-showall-btn svg { width: 12px; height: 12px; }
}
.tm-mob-cta { display: none; }
