/* Dialog, drawer, popover and menu, command palette, file drop zone */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 20; }
.dialog, .drawer, .palette { position: fixed; z-index: 30; background: var(--bg-surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-overlay); }
.dialog { top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(480px, calc(100vw - 32px)); border-radius: var(--r-md); }
.dialog > header, .drawer > header { padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border-subtle); }
.dialog > .body, .drawer > .body { padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-3); }
.dialog > footer, .drawer > footer { padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--border-subtle); display: flex; justify-content: flex-end; gap: var(--sp-2); }
.drawer { top: 0; right: 0; bottom: 0; width: min(440px, 100vw); display: flex; flex-direction: column; }
.drawer > .body { flex: 1; overflow: auto; }
.popover { position: absolute; z-index: 25; min-width: 180px; background: var(--bg-surface); border: 1px solid var(--border-strong); border-radius: var(--r-md); box-shadow: var(--shadow-overlay); padding: var(--sp-1); list-style: none; margin: 0; }
.popover li > button { display: flex; width: 100%; min-height: var(--target); align-items: center; border: 0; background: none; padding: 0 var(--sp-3); border-radius: var(--r-sm); cursor: pointer; text-align: left; }
.popover li > button:hover { background: var(--bg-hover); }
.palette { top: 14vh; left: 50%; transform: translateX(-50%); width: min(560px, calc(100vw - 32px)); border-radius: var(--r-md); overflow: hidden; }
.palette input { width: 100%; border: 0; border-bottom: 1px solid var(--border-subtle); padding: 14px var(--sp-4); font-size: var(--fs-16); background: transparent; }
.palette ul { margin: 0; padding: 0 0 var(--sp-2); list-style: none; }
.palette .group { padding: var(--sp-2) var(--sp-4) 2px; font-size: 13px; color: var(--text-muted); }
.palette li[role="option"] { padding: var(--sp-2) var(--sp-4); display: flex; justify-content: space-between; min-height: var(--target); align-items: center; }
.palette li[aria-selected="true"] { background: var(--bg-selected); }
.dropzone { border: 1px dashed var(--border-strong); border-radius: var(--r-md); padding: var(--sp-6); text-align: center; color: var(--text-secondary); background: var(--bg-raised); }
.dropzone[data-over="true"] { border-color: var(--action-primary); background: var(--bg-selected); }
@media (max-width: 639px) {
  .dialog, .drawer { inset: 0; width: 100%; transform: none; border-radius: 0; }
  .dialog { display: flex; flex-direction: column; }
  .dialog > .body { flex: 1; overflow: auto; }
}

.drawer .table th, .drawer .table td { padding: 0 var(--sp-2); }
.drawer .table td { white-space: normal; }
