/* filters.css — report filter bar. Linked after phase-d.css (later wins). */

#rep-controls .filter-bar {
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* --- search box: the primary control, so it gets the room --- */
.flt-search {
  flex: 1 1 320px;
  min-width: 220px;
  padding: 9px 12px 9px 34px;
  border: 1px solid var(--line, #d7dde5);
  border-radius: 10px;
  font-size: 14px;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7683' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
  background-size: 16px 16px;
  transition: border-color .15s, box-shadow .15s;
}
.flt-search:focus {
  outline: none;
  border-color: var(--accent, #2f7d32);
  box-shadow: 0 0 0 3px rgba(47, 125, 50, .14);
}
.flt-search::-webkit-search-cancel-button { cursor: pointer; }

/* --- Filters disclosure --- */
.flt-toggle {
  border: 1px solid var(--line, #d7dde5);
  border-radius: 10px;
  padding: 8px 14px;
  white-space: nowrap;
}
.flt-toggle::after {
  content: " ▾";
  font-size: 11px;
  opacity: .7;
}
.flt-drawer[class*="open"] ~ * .flt-toggle::after,
.flt-toggle[aria-expanded="true"]::after { content: " ▴"; }

.flt-drawer {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line, #e6ebf1);
}
.flt-drawer.open { display: flex; }
.flt-drawer select,
.flt-drawer input[type="text"] {
  padding: 7px 10px;
  border: 1px solid var(--line, #d7dde5);
  border-radius: 8px;
  font-size: 13px;
  max-width: 230px;
}
.flt-drawer .schema-filters {
  display: contents;   /* schema selects sit in the same wrap flow */
}

/* --- active filter chips --- */
.flt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 10px;
}
.flt-chips.hidden { display: none; }
.flt-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 10px;
  border-radius: 999px;
  background: var(--chip-bg, #eef4ee);
  border: 1px solid var(--chip-line, #cfe0d0);
  color: var(--chip-fg, #24512a);
  font-size: 12.5px;
  line-height: 1.6;
  max-width: 340px;
}
.flt-chip > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.flt-x {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0 2px;
  color: inherit;
  opacity: .65;
  border-radius: 50%;
}
.flt-x:hover { opacity: 1; background: rgba(0, 0, 0, .07); }
.flt-clear-all {
  font-size: 12.5px;
  padding: 3px 8px;
  text-decoration: underline;
}

.flt-drawer select.flt-empty { opacity: .5; }

/* ============================ report tables (Clockify-ish density) ======= */
#rep-issues .rep-tools {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  margin: -4px 0 8px;
}
#rep-issues .rep-tools button { font-size: 12px; padding: 3px 8px; }

table.rep-totals { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.rep-totals th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--card, #fff);
  border-bottom: 1px solid var(--line, #e2e8ef);
  font-size: 11.5px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted, #6b7683);
  padding: 6px 10px;
  text-align: left;
}
table.rep-totals td { padding: 7px 10px; border-bottom: 1px solid #f0f3f7; }
table.rep-totals .num, table.rep-totals th.num { text-align: right; }
table.rep-totals .mono { font-variant-numeric: tabular-nums; }

tr.rep-grp { cursor: pointer; }
tr.rep-grp:hover td { background: #f6f9f6; }
tr.rep-grp:focus-visible { outline: 2px solid var(--accent, #2f7d32); outline-offset: -2px; }
td.rep-grp-key { position: relative; font-weight: 600; }
.rep-caret {
  display: inline-block;
  width: 14px;
  color: var(--muted, #7b8590);
  font-size: 11px;
}
.rep-rowbar {
  position: absolute;
  left: 0;
  bottom: 2px;
  height: 3px;
  border-radius: 2px;
  background: var(--accent, #2f7d32);
  opacity: .3;
}
.rep-pct { color: var(--muted, #6b7683); font-size: 12px; }
tr.rep-foot td {
  border-top: 2px solid var(--line, #dfe5ec);
  border-bottom: 0;
  font-weight: 700;
}

tr.rep-sub-row > td { padding: 0 0 6px 26px; background: #fbfcfd; }
tr.rep-sub-row.hidden { display: none; }
table.rep-sub { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.rep-sub th {
  text-align: left;
  font-size: 10.5px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted, #8a929c);
  font-weight: 600;
  padding: 6px 8px 4px;
  border-bottom: 1px solid #eceff3;
}
table.rep-sub td { padding: 5px 8px; border-bottom: 1px solid #f2f5f8; }
table.rep-sub tr:last-child td { border-bottom: 0; }
table.rep-sub .num, table.rep-sub th.num { text-align: right; }
table.rep-sub .rep-desc { color: var(--muted, #4d5661); }
table.rep-sub .tag { margin-left: 6px; }

#rep-entries table { font-size: 13px; }
#rep-entries th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--card, #fff);
  font-size: 11.5px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted, #6b7683);
}
#rep-entries tbody tr:nth-child(even) td,
#rep-entries table tr:nth-child(even) td { background: #fafbfc; }
#rep-entries table tr:hover td { background: #f4f8f4; }

@media (max-width: 780px) {
  .flt-search { flex-basis: 100%; }
  .flt-drawer select,
  .flt-drawer input[type="text"] { max-width: 100%; flex: 1 1 160px; }
}

@media print {
  #rep-controls .filter-bar, .flt-drawer, .flt-chips { display: none !important; }
}
