/* What-if: moving a person to another group by drag and drop, or with the ⇄ button beside the name.
   Own file so it can change without touching the tiles. Same layers and tokens as app.css. */
@layer views {
  /* names that can move: room for the ⇄ button on the right, and no text selection or phone menu on a long press */
  /* names centred in their column, the ⇄ buttons in one straight column on the right */
  .tnames li.mv { grid-template-columns: minmax(0, 1fr) 30px; column-gap: 4px; }
  .tnames li.mv > .tname { grid-column: 1; justify-self: center; }
  .tnames li.mv > :not(.tname, .tmove) { grid-column: 1 / -1; justify-self: center; }
  .tnames li.mv .tname { cursor: grab; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
  .tmove { grid-column: 2; grid-row: 1; align-self: center; width: 30px; height: 30px; min-width: 0; min-height: 0; margin: -4px 0; /* no taller than the name, so rows keep their height at every size */ padding: 0; display: grid; place-items: center;
    border-radius: 50%; border: 1px solid var(--line); background: var(--bg); color: var(--blue); font-size: 15px; line-height: 1; cursor: pointer; }
  .tmove:hover { background: #eef5ff; }
  .tmove:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }

  /* while dragging: where the name may go (blue dashed), may not (faded), and the tile under the pointer */
  body.dragging, body.dragging * { cursor: grabbing !important; -webkit-user-select: none; user-select: none; }
  .gtile.dmok { outline: 2px dashed var(--blue); outline-offset: -2px; }
  .gtile.dmno { opacity: .55; }
  .gtile.dmhome { outline: 2px solid var(--line); outline-offset: -2px; }
  .gtile.dmok.dmover { outline: 3px solid var(--blue); background: #eef5ff; }
  .gtile.dmno.dmover { outline: 3px solid var(--red); opacity: .8; }

  /* the name that follows the pointer: above the finger, so the finger does not hide it */
  .dmghost { position: fixed; left: 0; top: 0; z-index: 60; pointer-events: none; translate: -50% calc(-100% - 22px);
    display: grid; gap: 2px; justify-items: center; max-width: 260px; padding: 8px 14px; border-radius: 12px;
    background: var(--blue); color: #fff; box-shadow: 0 8px 24px rgb(13 35 64 / .3); text-align: center; }
  .dmghost b { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .dmghost small { font-size: 13px; line-height: 1.3; }
  .dmghost small:empty { display: none; }
  .dmghost.no { background: var(--red); }

  /* in the absence box (a click on a name): move instead */
  .dmswitch { justify-self: start; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 12px;
    border: 1px solid var(--line); border-radius: 999px; background: #eef5ff; color: var(--blue); font-weight: 600; cursor: pointer; }
  .dmswitch:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }

  /* the question before a move counts */
  .dmq h2 { margin-top: 0; }
  .dmcmp { margin: 8px 0 4px; max-width: none; }
  .dmcmp tfoot th, .dmcmp tfoot td { font-weight: 650; border-bottom: 0; border-top: 2px solid var(--line); }
  .dmcmp tfoot tr.better td:last-child { color: var(--green); }
  .dmcmp tfoot tr.worse td:last-child { color: var(--red); }
  .dmbtns { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
  .dmbtns > span { flex: 1; }
  .dmbtns .linkish { background: none; border: 0; box-shadow: none; color: var(--blue); text-decoration: underline; padding: 8px 0; min-height: 44px; }
  .dmlist { list-style: none; margin: 8px 0 12px; padding: 0; display: grid; gap: 8px; }
  .dmlist button { width: 100%; min-height: 52px; display: grid; gap: 2px; justify-items: start; align-content: center; text-align: left; padding: 8px 14px; }
  .dmlist button b { font-size: 17px; }
  .dmlist button small { color: var(--muted); font-weight: 400; }
  .dmlist button.no { opacity: .6; cursor: not-allowed; }
  @media (max-width: 640px) {
    .dmbtns > span { display: none; }
    .dmbtns .linkish { flex: 1 1 100%; text-align: left; }
    .dmbtns button:not(.linkish) { flex: 1 1 0; }
  }
}
