/* The filter bar (public/js/filter-bar.js): one row of chips naming every filter that is on, "+ Filter" opening a picker over the
   page (never in the flow, so the board does not move), a bottom sheet on a phone. Site tokens only, so light and dark follow the
   theme: --surface, --surface-2, --border, --border-strong, --text, --muted, --brand, --focus. */
.fbar { position: relative; margin-bottom: 10px; }
.fbar-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 36px; }
.fbar button { font: inherit; cursor: pointer; }
.fbar-chip { display: inline-flex; align-items: stretch; max-width: 100%; border: 1px solid var(--border-strong); border-radius: 4px; background: var(--surface); color: var(--text); font-size: .82rem; line-height: 1.2; }
.fbar-chip-label { border: 0; background: none; color: inherit; padding: 6px 10px; min-height: 32px; text-align: left; overflow-wrap: anywhere; font-weight: 600 !important; }
.fbar-chip-pinned { background: var(--surface-2); }
.fbar-chip-x { border: 0; border-left: 1px solid var(--border); background: none; color: var(--muted); padding: 0 9px; min-width: 32px; font-size: 1rem !important; line-height: 1; }
.fbar-chip-x:hover, .fbar-chip-label:hover { background: var(--surface-2); color: var(--text); }
.fbar-chip-off { border-style: dashed; color: var(--muted); }
.fbar-chip-off .fbar-chip-label { text-decoration: line-through; text-decoration-thickness: 1px; }
.fbar-preset, .fbar-add, .fbar-clear { min-height: 32px; padding: 5px 10px; border-radius: 4px; font-size: .8rem !important; }
.fbar-preset { border: 1px dashed var(--border-strong); background: none; color: var(--muted); }
.fbar-preset:hover { color: var(--text); border-style: solid; }
.fbar-add { border: 1px solid var(--text); background: var(--text); color: var(--surface); font-weight: 700 !important; }
.fbar-add[aria-expanded="true"] { background: var(--surface); color: var(--text); }
.fbar-clear { border: 0; background: none; color: var(--link, var(--text)); text-decoration: underline; padding: 5px 4px; }
.fbar :focus-visible { outline: 2px solid var(--focus, var(--brand)); outline-offset: 1px; }

/* The picker: over the page under the row, at most 680px wide. */
.fbar-pop { position: absolute; z-index: 70; top: calc(100% + 6px); left: 0; width: min(680px, calc(100vw - 32px)); max-height: min(70vh, 560px); display: flex; flex-direction: column;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: 6px; box-shadow: 0 10px 30px rgba(0, 0, 0, .22); }
.fbar-scrim { display: none; }
.fbar-pop-head { display: flex; align-items: center; gap: 6px; padding: 8px 8px 0 10px; border-bottom: 1px solid var(--border); }
.fbar-tabs { display: flex; gap: 2px; flex: 1 1 auto; min-width: 0; flex-wrap: wrap; }
.fbar-tab { border: 0; border-bottom: 3px solid transparent; background: none; color: var(--muted); padding: 8px 10px; font-size: .84rem !important; font-weight: 700 !important; white-space: nowrap; }
.fbar-tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--brand); }
.fbar-x { border: 0; background: none; color: var(--muted); font-size: 1.3rem !important; width: 36px; height: 36px; flex: 0 0 auto; }
.fbar-panel { overflow: auto; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.fbar-field { display: grid; grid-template-columns: 150px minmax(0, 1fr); align-items: start; gap: 4px 12px; padding: 5px 0; border-bottom: 1px solid var(--border); }
.fbar-field:last-of-type { border-bottom: 0; }
.fbar-name { font-size: .78rem; font-weight: 700; color: var(--muted); padding-top: 8px; }
.fbar-note { grid-column: 2; font-size: .76rem; color: var(--muted); }
.fbar-field-off .fbar-name { text-decoration: line-through; }
.fbar-toggles { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.fbar-field > .fbar-tog { justify-self: start; }
.fbar-tog { border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); border-radius: 4px; padding: 4px 9px; min-height: 30px; font-size: .8rem !important; white-space: nowrap; }
.fbar-tog[aria-pressed="true"] { background: var(--text); color: var(--surface); border-color: var(--text); font-weight: 700 !important; }
.fbar-tog:disabled, .fbar-select:disabled, .fbar-find:disabled { opacity: .45; cursor: not-allowed; }
.fbar-tog[hidden] { display: none; }
.fbar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); }
.fbar-grid .fbar-tog { padding: 4px 2px; }
.fbar-search { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fbar-find, .fbar-select, .fbar-input { min-height: 32px; max-width: 100%; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 4px; padding: 3px 8px; font: inherit; font-size: .84rem; }
.fbar-find { width: 100%; box-sizing: border-box; }
.fbar-field > .fbar-select { justify-self: start; width: auto; min-width: 140px; }
.fbar-range { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fbar-dash { font-size: .8rem; color: var(--muted); }
.fbar-why { margin: 6px 0 2px; padding-left: 18px; font-size: .8rem; color: var(--muted); }
p.fbar-why { padding-left: 0; }
.fbar-pop-foot { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; padding: 8px 12px; border-top: 1px solid var(--border); }
.fbar-foot-note { flex: 1 1 220px; font-size: .74rem; color: var(--muted); }
.fbar-foot-btns { display: flex; gap: 6px; margin-left: auto; }
.fbar-foot-btns button { min-height: 34px; padding: 5px 12px; border-radius: 4px; font-size: .82rem !important; font-weight: 700 !important; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); }
.fbar-foot-btns .fbar-reset { border: 0; background: none; color: var(--muted); font-weight: 500 !important; text-decoration: underline; padding: 5px 4px; }
.fbar-foot-btns .fbar-done { background: var(--text); color: var(--surface); border-color: var(--text); }


/* A phone: the picker is a bottom sheet over a dimmed page; nothing scrolls sideways. */
@media (max-width: 600px) {
  .fbar-row { gap: 5px; }
  .fbar-chip { font-size: .78rem; }
  .fbar-chip-label, .fbar-chip-x, .fbar-preset, .fbar-add, .fbar-clear { min-height: 34px; }
  .fbar-chip-label { padding: 5px 8px; }
  .fbar-chip-x { min-width: 30px; padding: 0 7px; }
  .fbar-preset, .fbar-add { padding: 5px 8px; font-size: .76rem !important; }
  .fbar-scrim { display: block; position: fixed; inset: 0; z-index: 69; background: rgba(0, 0, 0, .45); }
  .fbar-pop { position: fixed; top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 82vh; max-height: 82dvh; border-radius: 12px 12px 0 0; border-bottom: 0; box-sizing: border-box; padding-bottom: env(safe-area-inset-bottom, 0); }
  .fbar-tabs { flex-wrap: wrap; }
  .fbar-tab { padding: 9px 7px; flex: 0 1 auto; }
  .fbar-field { grid-template-columns: minmax(0, 1fr); padding: 7px 0; }
  .fbar-note { grid-column: 1; }
  .fbar-name { padding-top: 0; }
  .fbar-tog { min-height: 36px; white-space: normal; }
  .fbar-grid { grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); }
  .fbar-range .fbar-select { flex: 1 1 120px; }
  .fbar-select { width: 100%; }
  .fbar-range { display: flex; }
  .fbar-foot-btns { width: 100%; }
  .fbar-foot-btns .fbar-done { flex: 1 1 auto; }
}
.fbar-say { font-size: .8rem; color: var(--muted); padding-top: 7px; }
.fbar-field > .fbar-input { justify-self: start; width: auto; min-width: 140px; max-width: 100%; }
.fbar-field > .fbar-input[type="text"] { width: min(320px, 100%); }
