/* ============================================================
   FOTA-MAIL · Saved searches + quick switcher (2026-10-14)
   ------------------------------------------------------------
   assets/js/quick.js. Tokens only, so dark mode follows the theme
   with no rules of its own. Loaded after responsive.css on every
   app page.
   ============================================================ */

/* ---------- the sidebar section ---------- */
.fm-saved[hidden] { display: none; }
.fm-saved__row { position: relative; display: flex; align-items: center; min-width: 0; }
.fm-saved__link { --ic: var(--icon-scheduled, #3949AB); flex: 1 1 auto; min-width: 0; padding-inline-end: 40px; }
.fm-saved__more {
  position: absolute;
  inset-inline-end: 4px;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--on-surface-variant);
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--fm-t-fast, .12s) ease, background var(--fm-t-fast, .12s) ease;
}
.fm-saved__more .ms { font-size: 18px; }
.fm-saved__row:hover .fm-saved__more,
.fm-saved__more:focus-visible,
.fm-saved__more[aria-expanded="true"] { opacity: 1; }
.fm-saved__more:hover { background: var(--surface-container-high); color: var(--on-surface); }
.fm-saved__more:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
@media (hover: none), (pointer: coarse) {
  .fm-saved__more { opacity: 1; width: 40px; height: 40px; inset-inline-end: 0; }
}

/* the ⋮ menu floats on the page, not inside the sidebar's scroll */
.fm-saved__menu { position: fixed; inset: auto; width: max-content; min-width: 190px; max-width: calc(100vw - 16px); z-index: 60; }

/* the rail (icons only) has no room for ⋮ — the drawer on a phone does */
@media (min-width: 700px) and (max-width: 1180px) {
  .fm-sidebar .fm-saved__more { display: none; }
  .fm-sidebar .fm-saved__link { padding-inline-end: 0; }
}

/* ---------- Save, inside the search box ---------- */
.fm-search__save {
  flex: none;
  display: inline-flex; align-items: center; gap: 4px;
  height: 32px;
  padding-inline: 8px 10px;
  border: 1px solid var(--outline);
  border-radius: var(--fm-r-pill, 999px);
  background: var(--surface);
  color: var(--primary);
  font: 600 13px/1 var(--fm-font, system-ui);
  cursor: pointer;
}
.fm-search__save[hidden] { display: none; }
.fm-search__save .ms { font-size: 18px; color: inherit; }
.fm-search__save:hover { background: var(--surface-variant); }
.fm-search__save:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
@media (max-width: 699px) {
  .fm-search__save { padding-inline: 6px; border: 0; }
  .fm-search__save-label { display: none; }
}

/* the phone's way into the switcher — a keyboard has Ctrl+K */
.fm-quick-btn { display: none; }
@media (max-width: 699px), (pointer: coarse) {
  .fm-quick-btn { display: grid; }
}

/* ---------- small name dialog ---------- */
.fm-qdialog {
  position: fixed; inset: 0; z-index: 70;
  display: grid; place-items: center;
  padding: 16px;
  background: rgba(10, 25, 50, .32);
  background: color-mix(in srgb, var(--on-surface) 32%, transparent);
}
.fm-qdialog__box {
  width: min(420px, 100%);
  padding: 20px 20px 16px;
  border: 1px solid var(--outline);
  border-radius: var(--fm-r-card, 24px);
  background: var(--surface);
  color: var(--on-surface);
  box-shadow: var(--elev-2);
}
.fm-qdialog__title {
  margin: 0 0 14px;
  font: 700 var(--fm-fs-15, 16px)/1.3 var(--fm-font-display, var(--fm-font, system-ui));
}
.fm-qdialog__form { display: flex; flex-direction: column; gap: 6px; }
.fm-qdialog__error { min-height: 18px; font-size: 12px; color: var(--danger); }
.fm-qdialog__hint { margin: 0; font-size: 13px; color: var(--on-surface-variant); overflow-wrap: anywhere; }
.fm-qdialog__foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* ---------- the switcher ---------- */
html.fm-pal-lock, html.fm-pal-lock body { overflow: hidden; }

.fm-pal-back {
  position: fixed; inset: 0; z-index: 80;
  display: flex; justify-content: center; align-items: flex-start;
  padding: 12vh 16px 16px;
  background: rgba(10, 25, 50, .32);
  background: color-mix(in srgb, var(--on-surface) 32%, transparent);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.fm-pal {
  width: min(640px, 100%);
  max-height: min(72vh, 640px);
  display: flex; flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--outline);
  border-radius: 20px;
  background: var(--surface);
  color: var(--on-surface);
  box-shadow: var(--elev-2);
}

.fm-pal__bar {
  flex: none;
  display: flex; align-items: center; gap: 10px;
  min-height: 56px;
  padding-inline: 18px 8px;
  border-block-end: 1px solid var(--outline);
}
.fm-pal__bar > .ms { font-size: 22px; color: var(--on-surface-variant); }
.fm-pal__input {
  flex: 1 1 auto; min-width: 0;
  height: 54px;
  border: 0; outline: 0;
  background: transparent;
  color: var(--on-surface);
  font: 500 16px/1.2 var(--fm-font, system-ui);
}
.fm-pal__input::placeholder { color: var(--on-surface-variant); }
.fm-pal__x {
  flex: none;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: transparent;
  color: var(--on-surface-variant);
  cursor: pointer;
}
.fm-pal__x:hover { background: var(--surface-container-high); color: var(--on-surface); }
.fm-pal__x:focus-visible { outline: 2px solid var(--primary); }

.fm-pal__body { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 6px 8px 8px; }
.fm-pal__list[hidden] { display: none; }

.fm-pal__group + .fm-pal__group { margin-top: 4px; }
.fm-pal__group.is-stale { opacity: .55; }
.fm-pal__head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 10px 4px;
  font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--on-surface-variant);
}
.fm-pal__head .ms { font-size: 15px; }

.fm-pal__opt {
  display: flex; align-items: center; gap: 12px;
  min-height: 48px;
  padding: 6px 10px;
  border-radius: 12px;
  color: var(--on-surface);
  text-decoration: none;
  cursor: pointer;
}
.fm-pal__opt > .ms:first-child {
  flex: none;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--surface-container-high);
  color: var(--primary);
  font-size: 18px;
}
.fm-pal__opt[aria-selected="true"] { background: var(--surface-variant); }
.fm-pal__opt[aria-selected="true"] > .ms:first-child { background: var(--surface); }
.fm-pal__text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.fm-pal__title, .fm-pal__sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-pal__title { font-size: 14px; font-weight: 600; }
.fm-pal__sub { font-size: 12px; color: var(--on-surface-variant); }
.fm-pal__opt mark { background: none; color: var(--primary); font-weight: 700; }
.fm-pal__go { flex: none; font-size: 18px; color: var(--on-surface-variant); opacity: 0; }
.fm-pal__opt[aria-selected="true"] .fm-pal__go { opacity: 1; }
.fm-pal__more { padding: 2px 10px 6px 54px; font-size: 12px; color: var(--on-surface-variant); }

.fm-pal__state {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 14px 12px;
  font-size: 13px;
  color: var(--on-surface-variant);
}
.fm-pal__state[hidden] { display: none; }
.fm-pal__state .ms { font-size: 18px; }
.fm-pal__state--bad { color: var(--danger); }
.fm-pal__state--busy .ms { animation: fm-pal-spin 1s linear infinite; }
@keyframes fm-pal-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .fm-pal__state--busy .ms { animation: none; } }
.fm-pal__link {
  border: 0; background: none; padding: 4px 6px; border-radius: 8px;
  color: var(--primary); font: 600 13px/1.2 var(--fm-font, system-ui); cursor: pointer;
}
.fm-pal__link:hover { background: var(--surface-variant); }

.fm-pal__foot {
  flex: none;
  display: flex; flex-wrap: wrap; gap: 6px 16px;
  padding: 10px 18px;
  border-block-start: 1px solid var(--outline);
  font-size: 12px;
  color: var(--on-surface-variant);
}

/* a phone: the switcher is the whole screen, the keys row goes */
@media (max-width: 600px) {
  .fm-pal-back { padding: 0; background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .fm-pal {
    width: 100%;
    height: 100%; height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .fm-pal__bar { padding-inline: 14px 4px; }
  .fm-pal__foot { display: none; }
  .fm-pal__opt { min-height: 52px; }
}
