/* Saved views: the "View: Standard" picker in the filter card header, its row
   menus, the save / rename / delete dialogs (guide-modal shell) and the
   contextual "Save view" / "Save changes · Save as new" text buttons.
   Global (the picker renders on every page with a configurable filter card).
   Contract: ai_reference/configurable_filters.md, section "Saved views". */

/* ── Picker trigger ───────────────────────────────────────────────────── */
.sv-picker { position: relative; display: inline-flex; }
.sv-picker__btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 8px; margin-left: -4px;
  background: none; border: 1px solid transparent; border-radius: 6px;
  font-family: var(--font-sans); font-size: 12px; font-weight: 600; color: var(--ink);
  cursor: pointer; white-space: nowrap;
}
.sv-picker__btn:hover { background: var(--bg); }
.sv-picker__btn[aria-expanded="true"] { background: var(--bg); border-color: var(--border); }
.sv-picker__btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.sv-picker__pre { color: var(--muted); font-weight: 500; }
.sv-picker__name { max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.sv-picker__edited { color: var(--muted); font-weight: 500; font-style: italic; }
.sv-picker__chev { width: 14px; height: 14px; color: var(--muted); flex: none; }

/* ── Dropdown panel ───────────────────────────────────────────────────── */
.sv-panel {
  position: absolute; top: calc(100% + 4px); left: -4px; z-index: 70;
  width: 290px; padding: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-dropdown);
}
.sv-panel[hidden] { display: none; }
.sv-panel__section {
  padding: 8px 10px 4px;
  font-size: 9px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; color: var(--light);
}
.sv-panel__item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 10px;
  background: none; border: none; border-radius: 6px;
  font-family: var(--font-sans); font-size: 12px; color: var(--ink); text-align: left; text-decoration: none;
  cursor: pointer;
}
.sv-panel__item:hover, .sv-panel__item:focus-visible { background: var(--surface-alt); outline: none; text-decoration: none; }
.sv-panel__item.is-current { background: var(--bg); font-weight: 700; }
.sv-panel__item--action { color: var(--blue); font-weight: 600; }
.sv-panel__check { display: inline-flex; width: 14px; flex: none; color: var(--ink); }
.sv-panel__check svg { width: 14px; height: 14px; }
.sv-panel__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sv-panel__empty { margin: 0; padding: 10px 10px 12px; font-size: 12px; line-height: 1.5; color: var(--muted); }
.sv-panel__foot { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--border-light); }

/* ── Rows + per-view menu ─────────────────────────────────────────────── */
.sv-row { position: relative; display: flex; align-items: center; gap: 2px; }
.sv-row > .sv-panel__item { flex: 1; min-width: 0; }
.sv-row__more {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 28px; height: 28px;
  background: none; border: none; border-radius: 6px; color: var(--muted); cursor: pointer;
}
.sv-row__more svg { width: 16px; height: 16px; }
.sv-row__more:hover, .sv-row__more[aria-expanded="true"] { background: var(--surface-alt); color: var(--ink); }
.sv-row__more:focus-visible, .sv-row__menu-item:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.sv-row__menu {
  position: absolute; right: 0; top: calc(100% - 2px); z-index: 80;
  min-width: 150px; padding: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-dropdown);
}
.sv-row__menu[hidden] { display: none; }
.sv-row__menu-item {
  display: block; width: 100%; padding: 7px 10px;
  background: none; border: none; border-radius: 6px;
  font-family: var(--font-sans); font-size: 12px; color: var(--ink); text-align: left; cursor: pointer;
}
.sv-row__menu-item:hover { background: var(--surface-alt); }
.sv-row__menu-item--danger { color: var(--red); }

/* ── Dialogs (guide-modal shell) ──────────────────────────────────────── */
.sv-dialog { max-width: 440px; }
.sv-dialog__close { display: inline-flex; align-items: center; padding: 4px; border-radius: 6px; }
.sv-dialog__close svg { width: 18px; height: 18px; }
.sv-dialog__close:focus-visible { outline: 2px solid var(--blue); }
.sv-dialog__form { display: flex; flex-direction: column; min-height: 0; }
.sv-dialog__body { line-height: 1.5; }
.sv-dialog__text { margin: 0; font-size: 13px; color: var(--ink); }
.sv-dialog__foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 24px; border-top: 1px solid var(--border);
}
.sv-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.sv-field__label {
  padding: 0;
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; color: var(--muted);
}
.sv-field__error { margin: 3px 0 0; font-size: 11px; color: var(--red); }
.sv-field__error[hidden] { display: none; }
.sv-scope { display: flex; flex-direction: column; gap: 8px; margin: 0 0 14px; padding: 0; border: none; }
.sv-scope__option { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: var(--ink); cursor: pointer; }
.sv-scope__option input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--ink); }
.sv-scope__hint { display: block; font-size: 11px; color: var(--muted); }
.sv-note {
  margin: 0; padding: 10px 12px;
  background: var(--surface-alt); border-radius: var(--radius-sm);
  font-size: 12px; color: var(--muted);
}
.sv-hidden-form { display: none; }

/* ── Contextual text buttons (right of Filter) ────────────────────────── */
.sv-actions { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; color: var(--light); }
.sv-actions__btn {
  padding: 6px 8px;
  background: none; border: none; border-radius: 6px;
  font-family: var(--font-sans); font-size: 12px; font-weight: 600; color: var(--ink);
  cursor: pointer; white-space: nowrap;
}
.sv-actions__btn:hover { background: var(--bg); }
.sv-actions__btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ── Phones: 44px touch targets ───────────────────────────────────────── */
@media (max-width: 640px) {
  .sv-picker__btn { min-height: 44px; }
  .sv-panel { left: auto; right: 0; width: min(290px, calc(100vw - 32px)); }
  .sv-panel__item, .sv-row__menu-item, .sv-actions__btn { min-height: 44px; }
  .sv-row__more { width: 44px; height: 44px; }
  .sv-scope__option { min-height: 44px; align-items: center; }
}
