/* Right-click / long-press / ⋯ menus (1.4.0, app/ui/contextmenu.js). The site's tokens, with fallbacks so the
   extension popup (fewer tokens) looks the same. */
.cm-root { position: fixed; inset: 0; z-index: 80; pointer-events: none; }
.cm {
  pointer-events: auto; position: fixed; left: 0; top: 0; min-width: 232px; max-width: min(340px, calc(100vw - 16px));
  max-height: calc(100vh - 16px); overflow-y: auto; overscroll-behavior: contain; padding: var(--s1, 4px);
  display: flex; flex-direction: column; gap: 1px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius, 12px);
  box-shadow: var(--shadow, 0 10px 30px rgba(0, 0, 0, .35)); outline: none;
  animation: cm-in var(--dur, 150ms) ease-out; transform-origin: top left;
}
.cm[data-side="left"] { transform-origin: top right; }
.cm[data-flip="up"] { transform-origin: bottom left; }
.cm[data-side="left"][data-flip="up"] { transform-origin: bottom right; }
@keyframes cm-in { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }

.cm-item {
  display: flex; align-items: center; gap: var(--s3, 12px); min-height: 34px; width: 100%; padding: 0 var(--s2, 8px) 0 var(--s3, 12px);
  border: 0; border-radius: var(--radius-sm, 8px); background: none; color: var(--text); cursor: pointer;
  font: inherit; font-size: .92rem; text-align: left; flex: none;
}
.cm-item:focus, .cm-item.open { background: var(--surface-2); outline: none; }
.cm-item:focus-visible { box-shadow: inset 0 0 0 2px var(--ring, var(--accent)); }
.cm-ico { width: 18px; height: 18px; flex: none; display: inline-grid; place-items: center; color: var(--muted); }
.cm-ico .ico, .cm-ico svg { width: 18px; height: 18px; }
.cm-label { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cm-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-reason { font-size: .8rem; color: var(--faint, var(--muted)); white-space: normal; }
.cm-kbd {
  flex: none; margin-left: var(--s2, 8px); padding: 2px 6px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px;
  font: 600 .7rem/1.2 var(--mono, ui-monospace, Consolas, monospace); color: var(--faint, var(--muted)); background: var(--bg);
}
.cm-chev { width: 16px; height: 16px; flex: none; color: var(--faint, var(--muted)); margin-left: auto; }
.cm-kbd + .cm-chev { margin-left: 0; }
.cm-item.danger, .cm-item.danger .cm-ico { color: var(--danger); }
.cm-item.danger:focus { background: color-mix(in srgb, var(--danger) 13%, transparent); }
.cm-item[aria-disabled="true"] { cursor: default; color: var(--faint, var(--muted)); }
.cm-item[aria-disabled="true"] .cm-ico { opacity: .55; }
.cm-item[aria-disabled="true"]:focus { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.cm-item[aria-checked="true"] .cm-ico { color: var(--accent); }
.cm-loading { cursor: default; color: var(--faint, var(--muted)); }
.cm-spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--accent); animation: cm-spin .8s linear infinite; }
@keyframes cm-spin { to { transform: rotate(360deg); } }
.cm-sep { height: 1px; flex: none; background: var(--border); margin: var(--s1, 4px) var(--s2, 8px); }
.cm-title { font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: var(--faint, var(--muted)); font-weight: 650; padding: var(--s2, 8px) var(--s3, 12px) var(--s1, 4px); flex: none; }

/* a phone: a bottom sheet, one level at a time */
.cm-root.sheet { pointer-events: auto; background: rgba(5, 7, 12, .5); display: flex; align-items: flex-end; animation: cm-fade var(--dur, 150ms) ease-out; }
.cm-panel {
  width: 100%; max-height: 82vh; overflow-y: auto; overscroll-behavior: contain; background: var(--surface);
  border-top: 1px solid var(--border); border-radius: 18px 18px 0 0;
  padding: var(--s2, 8px) var(--s3, 12px) calc(var(--s4, 16px) + env(safe-area-inset-bottom));
  animation: cm-up var(--dur, 150ms) ease-out;
}
.cm-panel .cm { position: static; max-width: none; max-height: none; min-width: 0; border: 0; box-shadow: none; padding: 0; background: none; animation: none; overflow: visible; }
.cm-panel .cm-item { min-height: 48px; font-size: 1rem; padding: 0 var(--s3, 12px); }
.cm-panel .cm-kbd { display: none; }
.cm-grip { width: 38px; height: 4px; border-radius: 2px; background: var(--border); margin: 0 auto var(--s2, 8px); }
.cm-sheet-head { display: flex; align-items: center; gap: var(--s2, 8px); min-height: 40px; padding: 0 var(--s2, 8px) var(--s2, 8px) var(--s3, 12px); margin-bottom: var(--s1, 4px); border-bottom: 1px solid var(--border); }
.cm-sheet-head .cm-back { margin-left: calc(var(--s2, 8px) * -1); }
.cm-sheet-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1rem; }
@keyframes cm-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cm-up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }

/* the ⋯ on rows */
.cm-more { flex: none; color: var(--muted); }
.row .cm-more { opacity: .5; transition: opacity var(--dur, 150ms); }
.row:hover .cm-more, .row:focus-within .cm-more, .cm-more[aria-expanded="true"] { opacity: 1; }
@media (hover: none) { .row .cm-more { opacity: .8; } }

/* long-press: no text selection, no iOS link callout, a little feedback */
.cm-zone { -webkit-touch-callout: none; }
body.cm-pressing, body.cm-pressing * { -webkit-user-select: none; user-select: none; }
.cm-pressed { background: var(--surface-2); }

@media (prefers-reduced-motion: reduce) {
  .cm, .cm-root.sheet, .cm-panel { animation: none; }
}

/* rows of the inbox and the aliases list */
.vb-row > .cm-more { align-self: center; margin-right: var(--s2, 8px); }
