/* Карточка сделки под себя (crm-layout.js, 19.10.2026): шестерёнка в шапке, режим перестановки блоков «как на iPhone». */

/* шестерёнка и всплывающее «Настройка карточки» */
.crm-lay-gear-wrap { position: relative; margin-left: auto; display: flex; }
.modal-head .crm-lay-gear-wrap + .icon-btn { margin-left: 4px; }
.crm-lay-gear .ico { width: 19px; height: 19px; }
.crm-lay-pop { position: absolute; top: calc(100% + 6px); right: 0; z-index: 5; min-width: 230px; padding: 6px;
               background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
               display: grid; gap: 2px; }
.crm-lay-pop[hidden] { display: none; }
.crm-lay-pop::before { content: ''; position: absolute; top: -8px; left: 0; right: 0; height: 8px; }  /* мостик для мыши */
.crm-lay-pop-title { font-size: 12px; font-weight: 600; color: var(--text-2); padding: 6px 10px 4px; }
.crm-lay-pop button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px;
                      background: none; color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.crm-lay-pop button:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent-text); }
.crm-lay-pop button:disabled { opacity: .45; cursor: default; }
.crm-lay-pop button .ico { width: 17px; height: 17px; flex: none; }
.crm-lay-pop-note { font-size: 11.5px; color: var(--text-2); padding: 4px 10px 6px; }

/* скрытые блоки — вне режима настройки их нет */
.crm-deal:not(.crm-lay-edit) [data-block].crm-blk-off { display: none; }

/* режим перестановки */
.crm-lay-bar { grid-column: 1 / -1; position: sticky; top: 56px; z-index: 4; display: flex; flex-wrap: wrap; gap: 10px;
               align-items: center; justify-content: space-between; padding: 10px 12px; border-radius: 12px;
               background: var(--accent-soft); color: var(--accent-text); box-shadow: 0 6px 16px -10px rgba(40, 20, 120, .45); }
.crm-lay-bar-text { display: grid; gap: 2px; font-size: 13px; }
.crm-lay-bar-text span { opacity: .85; font-size: 12px; }
.crm-lay-bar-acts { display: flex; gap: 8px; }
.crm-lay-edit .crm-deal-main, .crm-lay-edit .crm-deal-side { min-height: 120px; align-content: start; border-radius: 14px;
                                                            outline: 1px dashed transparent; outline-offset: 6px; }
.crm-lay-dragging .crm-deal-main, .crm-lay-dragging .crm-deal-side { outline-color: var(--line); }
.crm-lay-edit [data-block] { position: relative; cursor: grab; user-select: none; -webkit-user-select: none;
                             border-radius: 12px; outline: 1.5px dashed var(--accent); outline-offset: 3px;
                             padding-top: 30px; animation: crm-wiggle .3s ease-in-out infinite alternate; }
.crm-lay-edit [data-block]:nth-child(even) { animation-delay: -.15s; }
.crm-lay-edit [data-block] > :not(.crm-blk-ctl) { pointer-events: none; }
.crm-lay-edit [data-block].crm-blk-off { opacity: .45; outline-color: var(--line); }
.crm-lay-edit .crm-status, .crm-lay-edit .crm-dates, .crm-lay-edit .crm-hint,
.crm-lay-edit .crm-deal-main > :not([data-block]):not(.crm-blk-ph) { opacity: .5; pointer-events: none; }
@keyframes crm-wiggle { from { transform: rotate(-.3deg); } to { transform: rotate(.3deg); } }
@media (prefers-reduced-motion: reduce) { .crm-lay-edit [data-block] { animation: none; } }

.crm-blk-ctl { position: absolute; top: 4px; left: 8px; right: 6px; height: 24px; display: flex; align-items: center; gap: 6px; }
.crm-blk-name { flex: 1; min-width: 0; font-size: 11.5px; font-weight: 600; color: var(--accent-text); white-space: nowrap;
                overflow: hidden; text-overflow: ellipsis; }
.crm-blk-eye, .crm-blk-grip { width: 26px; height: 24px; display: grid; place-items: center; border-radius: 7px; color: var(--text-2); flex: none; }
.crm-blk-eye { border: 0; background: none; cursor: pointer; padding: 0; }
.crm-blk-eye:hover { background: var(--accent-soft); color: var(--accent-text); }
.crm-blk-grip { cursor: grab; touch-action: none; }
.crm-blk-eye .ico, .crm-blk-grip .ico { width: 16px; height: 16px; }
.crm-blk-grip .ico { fill: currentColor; stroke: none; }

/* место, куда встанет блок, и сам блок под пальцем/мышью */
.crm-blk-ph { border: 2px dashed var(--accent); border-radius: 12px; background: var(--accent-soft); opacity: .7; min-height: 44px; }
.crm-blk-moving { display: none !important; }
.crm-blk-ghost { position: fixed; z-index: 90; pointer-events: none; margin: 0; opacity: .94; cursor: grabbing;
                 transform: rotate(1.2deg) scale(1.02); box-shadow: 0 18px 40px -12px rgba(20, 16, 40, .45);
                 background: var(--panel); border-radius: 12px; animation: none !important;
                 padding: 30px 12px 10px; outline: 1.5px solid var(--accent); }
.crm-blk-ghost > :not(.crm-blk-ctl) { pointer-events: none; }
body:has(.crm-blk-ghost) { cursor: grabbing; }

@media (max-width: 760px) {
  .crm-lay-bar-acts { width: 100%; justify-content: flex-end; }
  .crm-blk-grip { width: 34px; height: 28px; background: var(--accent-soft); color: var(--accent-text); }
  .crm-lay-edit [data-block] { padding-top: 34px; }
  .crm-blk-ctl { height: 28px; }
}
