/* Things that float above the page: suggestion lists, menus, the reference filter, the date
   picker, dialogs, the search palette, toasts and the touch toolbar. */

.popover {
  position: fixed;
  z-index: 40;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 9px;
  box-shadow: var(--shadow-float);
  font-family: var(--font-ui);
  font-size: var(--t-ui);
  color: var(--ink);
}

.suggestions { padding: 5px; max-height: 320px; overflow-y: auto; }
.suggestion { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 6px 9px; border-radius: 6px; cursor: pointer; }
.suggestion .label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggestion .n { color: var(--ink-3); font-size: var(--t-xs); font-variant-numeric: tabular-nums; flex: none; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggestion.sel { background: var(--thread-wash); }
.suggestion.create { color: var(--ink-2); border-top: 1px solid var(--rule); border-radius: 0 0 6px 6px; margin-top: 3px; }
.suggestion-empty { padding: 8px 10px; color: var(--ink-3); font-size: var(--t-sm); max-width: 300px; }

.popup-menu { padding: 5px; min-width: 200px; display: flex; flex-direction: column; }
.menu-item { text-align: left; padding: 6px 10px; border-radius: 6px; }
.menu-item:hover, .menu-item:focus-visible { background: var(--thread-wash); outline: none; }
.menu-item.danger { color: var(--danger); }

/* reference filter */
.filter-pop { position: absolute; right: 0; top: 46px; width: min(420px, calc(100vw - 32px)); padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.filter-sel { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--rule); }
.mini-label { font-size: var(--t-xs); font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.mini-label span { font-weight: 400; color: var(--ink-3); margin-left: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: baseline; gap: 5px; padding: 1px 8px 2px; border: 1px solid var(--rule); border-radius: 5px; font-size: var(--t-sm); color: var(--ink-2); background: var(--paper); }
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip i { font-style: normal; font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.chip.inc { border-color: var(--thread); background: var(--thread-wash); color: var(--thread); }
.chip.exc { border-color: var(--danger); color: var(--danger); text-decoration: line-through; }

/* date picker */
.date-picker { padding: 10px; width: 264px; }
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.dp-title { font-weight: 600; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.dp-weekday { font-size: 11px; color: var(--ink-3); padding: 2px 0; }
.dp-grid .day { padding: 5px 0; border-radius: 6px; font-variant-numeric: tabular-nums; font-size: var(--t-sm); }
.dp-grid .day:hover { background: var(--thread-wash); }
.dp-grid .day.other { color: var(--ink-3); }
.dp-grid .day.today { color: var(--thread); font-weight: 700; box-shadow: inset 0 0 0 1px var(--thread); }
.dp-today { margin-top: 8px; }

/* dialogs */
.dialog {
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-float);
  width: min(420px, calc(100vw - 32px));
  font-size: var(--t-ui);
}
.dialog.wide { width: min(560px, calc(100vw - 32px)); }
.dialog::backdrop { background: var(--scrim); }
.dialog-body { padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.dialog-body h2 { font-size: var(--t-lg); font-weight: 600; }
.dialog-body p { color: var(--ink-2); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.shortcut-table { border-collapse: collapse; width: 100%; }
.shortcut-table td { padding: 5px 8px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.shortcut-table td:first-child { white-space: nowrap; width: 1%; }

/* search palette */
.palette { width: min(600px, calc(100vw - 24px)); margin-top: 12vh; }
.palette-field { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--rule); color: var(--ink-3); }
.palette-input { flex: 1; border: 0; background: none; font: inherit; font-size: var(--t-lg); color: var(--ink); outline: none; min-width: 0; }
.palette-input::-webkit-search-cancel-button { display: none; }
.palette-results { max-height: 55vh; overflow-y: auto; padding: 6px; }
.palette-section { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; font-weight: 600; color: var(--ink-3); padding: 8px 9px 4px; }
.palette-hint { color: var(--ink-3); font-size: var(--t-sm); padding: 10px; }
.suggestion.block .label { font-family: var(--font-note); white-space: normal; }

/* toasts */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 70; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px 10px 14px; background: var(--ink); color: var(--paper); border-radius: 8px; box-shadow: var(--shadow-float); font-size: var(--t-sm); }
.toast.error { background: var(--danger); }
.toast span { flex: 1; }
.toast-close { font-size: 1.1rem; line-height: 1; opacity: .7; }

/* touch toolbar */
.touch-toolbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 35;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--rule);
  background: var(--shelf);
  overflow-x: auto;
}
.tool { min-width: 36px; height: 36px; display: grid; place-items: center; border-radius: 8px; color: var(--ink-2); font-family: var(--font-mono); font-size: 13px; flex: none; }
.tool:active { background: var(--rule); }
.tool.wide { padding-inline: 6px; white-space: nowrap; }
.tool.text { padding-inline: 8px; font-family: var(--font-ui); font-weight: 600; color: var(--thread); }
