/* ── Filter side panel + chips (js/filterpanel.js) ──
   Slides in from the right under the topbar like the Help panel (assistant.css); no backdrop, so the list stays
   visible and updates live. Full screen at ≤ 640 px. Colours come from the theme tokens. */

.flt-gear { position: relative; display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.flt-gear svg { width: 15px; height: 15px; }
.flt-gear[aria-expanded="true"] { border-color: var(--blue); color: var(--blue); }
.flt-count {
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--blue); color: var(--bg); font-size: 10px; font-weight: 600; line-height: 16px; text-align: center;
}
.flt-count[hidden] { display: none; }

.flt-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 12px; }
.flt-chips[hidden] { display: none; }
.flt-chip {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 2px 4px 2px 10px; border-radius: 12px;
  background: var(--blue-bg); border: 1px solid var(--border2); color: var(--text); font-size: 11px;
}
.flt-chip-x {
  background: none; border: 0; color: var(--text2); cursor: pointer;
  font-size: 14px; line-height: 1; padding: 0 5px; border-radius: 50%;
}
.flt-chip-x:hover { color: var(--text); background: var(--bg4); }
.flt-chip-x:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

/* .modal-card (needed by UI.openDialog) is a centred modal elsewhere — reset what the side panel doesn't want. */
.flt-panel.modal-card { max-width: none; padding: 0; border-radius: 0; border-top: 0; border-bottom: 0; border-right: 0; background: var(--bg2); }
.flt-panel {
  position: fixed;
  top: var(--topbar-height);
  right: 0;
  bottom: 0;
  width: min(340px, 100vw);
  display: flex;
  flex-direction: column;
  background: var(--bg2);
  border-left: 1px solid var(--border2);
  box-shadow: -8px 0 24px var(--shadow);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform .2s ease, visibility 0s linear .2s;
  z-index: 165;
}
.flt-overlay.active .flt-panel { transform: none; visibility: visible; transition: transform .2s ease; }

.flt-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.flt-title.modal-title { margin: 0; }
.flt-title { flex: 1; font-weight: 600; font-size: 14px; color: var(--text); }
.flt-close {
  background: none; border: 0; color: var(--text2); font-size: 20px; line-height: 1;
  padding: 4px 8px; border-radius: var(--radius-sm); cursor: pointer;
}
.flt-close:hover { color: var(--text); background: var(--bg4); }

.flt-body { flex: 1; overflow-y: auto; padding: 6px 14px 14px; }
.flt-section { padding: 12px 0; border-bottom: 1px solid var(--border); }
.flt-section:last-child { border-bottom: 0; }
.flt-section h3 {
  margin: 0 0 10px; font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text3);
}
.flt-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: 11px; color: var(--text2); }
.flt-field .form-select { width: 100%; }
.flt-check { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; color: var(--text); cursor: pointer; margin-bottom: 8px; }
.flt-check input { margin-top: 2px; }
.flt-hint { display: block; font-family: var(--font); font-size: 11px; color: var(--text3); margin-top: 2px; }
.flt-foot { padding: 10px 14px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; }

/* Audit Logs "Group by contract" rows */
.al-row[hidden] { display: none; }
.al-row-child .al-row-main { background: var(--bg2); }
.al-row-child .al-col-file { padding-left: 22px; }
.al-group-toggle {
  margin-left: 6px; padding: 1px 7px; border-radius: 10px; flex-shrink: 0;
  background: var(--bg4); border: 1px solid var(--border2); color: var(--text2); font-size: 10px; cursor: pointer;
}
.al-group-toggle:hover { color: var(--text); }
.al-group-toggle:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

@media (max-width: 640px) {
  .flt-panel { top: 0; width: 100vw; z-index: 230; border-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .flt-panel, .flt-overlay.active .flt-panel { transition: none; }
}
