/* mod-attach: окно «Прикрепление» и выбор цвета (вариант C) */
body.at-open .overlay { z-index: 58; } /* подтверждение «перенести» над окном */
body.at-open .fp-poss { display: none; } /* панель фильтров внутри окна — только по центру */

.at-ov { position: fixed; inset: 0; z-index: 55; display: flex; flex-direction: column; gap: 12px; padding: 16px; background: var(--bg); overflow: hidden; }
.at-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.at-title { margin: 0; font-size: 24px; font-weight: 700; line-height: 1.2; letter-spacing: -.01em; overflow-wrap: anywhere; }
.at-close { min-height: 44px; border: 1px solid var(--bd); border-radius: 12px; background: var(--paper); color: var(--ink); font-weight: 600; padding: 0 1.1rem; }
.at-close:hover { background: var(--soft); color: var(--ink); }
.at-ro { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 12px; background: var(--warn-l); color: var(--warn); font-size: 12px; font-weight: 600; }
.at-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; }
.at-slot { display: inline-flex; }
.at-qw { position: relative; display: block; margin: 0; width: min(320px, 70vw); }
.at-qw > .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--mut); pointer-events: none; }
.at-q { height: 44px; min-height: 44px; padding-left: 38px; background-color: var(--paper); border: 1px solid var(--bd); }
.at-q:focus { border: 2px solid var(--acc); outline: 0; }
.at-size { width: auto; min-width: 74px; height: 44px; min-height: 44px; background-color: var(--paper); border: 1px solid var(--bd); font-weight: 600; }
.at-ib:disabled { opacity: .4; cursor: not-allowed; }
.at-prev .ic { transform: rotate(180deg); }
.at-pg { min-width: 3.4rem; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; font-size: 14px; }

.at-card { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--paper); border-radius: 20px; overflow: hidden; }
.at-tabs { flex: none; margin: 0; padding: 12px 16px 8px; }
.at-tabs button { display: inline-flex; align-items: center; gap: 8px; }
.at-n { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--soft); color: var(--mut); font-size: 12px; font-weight: 600; }
.at-tabs button.act .at-n { background: rgba(255, 255, 255, .22); color: #fff; }
.at-chips { flex: none; padding: 0 16px; }
.at-chips .fp-chips { margin: 4px 0 8px; }
.at-chips .fp-chips[hidden] { display: none; }

.at-bar { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 8px 16px; border-top: 1px solid var(--bd); border-bottom: 1px solid var(--bd); min-height: 56px; }
.at-sel { font-size: 14px; font-weight: 600; }
.at-all { font-size: 13px; color: var(--ok); font-weight: 600; }
.at-link { min-height: 0; padding: 2px 4px; border: 0; background: none; color: var(--acc); font-size: 13px; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; border-radius: 6px; }
.at-link:hover { background: var(--acc-l); color: var(--acc-d); }
.at-act { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; border-radius: 14px; font-weight: 700; padding: 0 1.2rem; }
button.pri.at-act { background: var(--acc); border-color: var(--acc); color: #fff; }
button.pri.at-act:hover { background: var(--acc-d); border-color: var(--acc-d); }
button.pri.at-act:disabled:hover { background: var(--acc); color: #fff; }

.at-scroll { flex: 1; min-height: 0; overflow: auto; }
.at-scroll .tbwrap { overflow: visible; margin: 0; }
.at-scroll .tb { width: 100%; }
.at-scroll .tb th { position: sticky; top: 0; z-index: 2; background: var(--paper); text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 600; color: var(--mut); border-bottom: 1px solid var(--bd); padding: 12px 14px; }
.at-scroll .tb td b { font-weight: 500; }
.at-scroll .tb td { height: 46px; padding: 0 14px; border-bottom: 1px solid var(--bd); font-size: 14px; }
.at-scroll .tb tr.on td { background: var(--soft); }
.at-scroll .tb tr.on td:first-child { border-radius: 12px 0 0 12px; }
.at-scroll .tb tr.on td:last-child { border-radius: 0 12px 12px 0; }
.at-ckh, .at-ckc { width: 48px; }
.at-scroll .tb td.at-ckc { padding-right: 0; }
.at-cb { width: 20px; height: 20px; border: 1.5px solid var(--mut); border-radius: 6px; }
.at-cb:checked, .at-cb:indeterminate { background: var(--sel); border-color: var(--sel); }
.at-cb:checked::after { left: 6px; top: 2px; width: 5px; height: 10px; }
.at-cb:indeterminate::after { content: ''; position: absolute; left: 4px; top: 8px; width: 10px; height: 2px; background: #fff; border: 0; transform: none; }
.at-msg { padding: 32px 16px; text-align: center; }
.at-msg.bad { color: var(--bad); }
.at-foot { flex: none; padding: 10px 16px; border-top: 1px solid var(--bd); font-size: 13px; }

@media (max-width: 700px) {
  .at-ov { padding: 8px; gap: 8px; }
  .at-title { font-size: 18px; }
  .at-tools { margin-left: 0; width: 100%; }
  .at-qw { flex: 1 1 100%; width: auto; }
}

/* ---------- выбор цвета ---------- */
.cp { display: grid; gap: 12px; width: 100%; max-width: 320px; }
.cp-sv { position: relative; height: 180px; border-radius: 12px; touch-action: none; cursor: crosshair; background: #2f5bff; }
.cp-hue { position: relative; height: 16px; border-radius: 8px; touch-action: none; cursor: pointer; background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%); }
.cp-th { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(29, 27, 22, .35), 0 2px 6px rgba(29, 27, 22, .3); touch-action: none; }
.cp-hue-th { top: 50%; }
.cp-th:focus-visible { outline: 2px solid var(--acc); outline-offset: 3px; }
.cp-row { display: flex; align-items: center; gap: 10px; }
.cp-chip { flex: none; width: 48px; height: 48px; border-radius: 12px; border: 1px solid var(--bd); }
.cp-hex { flex: 1; font-variant-numeric: tabular-nums; text-transform: lowercase; font-weight: 600; }
.cp-hex[aria-invalid="true"] { border-color: var(--bad); background-color: var(--bad-l); }
.cp-err { font-size: 12px; color: var(--bad); margin-top: -6px; }
.cp-sws { display: flex; flex-wrap: wrap; gap: 6px; }
.cp-sw { width: 30px; height: 30px; min-height: 0; padding: 0; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--bd); }
.cp-sw:hover { background-blend-mode: normal; filter: brightness(.92); }
.cp-sw[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--sel); }
.cp-prev { display: flex; align-items: center; min-height: 36px; }
