/* Atlas Plus — advanced filter layer.
   Reuses the Atlas brand kit only: --ink / --paper / --phosphor / --copper
   plus the hsl() theme vars. No new palette, no layout rewrites. */

#ap-toggle {
  background: hsl(var(--secondary));
  border: 1px solid hsl(var(--border));
  padding: 0.5rem 0.75rem;
  min-height: 44px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  color: hsl(var(--foreground) / 0.85);
  cursor: pointer;
  white-space: nowrap;
}
#ap-toggle:hover { background: hsl(var(--muted)); }
#ap-toggle[aria-expanded="true"] {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-color: hsl(var(--primary));
}
#ap-toggle .ap-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  background: var(--copper);
  margin-right: 0.4rem;
  vertical-align: baseline;
}
#ap-toggle[data-active="1"] .ap-dot { background: currentColor; }

#ap-panel {
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--background) / 0.6);
  padding: 0.9rem 1rem 1.1rem;
}
#ap-panel[hidden] { display: none; }
.ap-kicker {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  color: var(--copper);
}
.ap-grid {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
  margin-top: 0.6rem;
}
.ap-field {
  display: block;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  color: hsl(var(--foreground) / 0.85);
}
.ap-field select,
.ap-field input[type="number"] {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
  background: hsl(var(--secondary));
  border: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
  padding: 0.5rem;
  min-height: 44px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.8rem;
}
.ap-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin-top: 0.7rem;
}
.ap-checks label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 44px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  cursor: pointer;
}
.ap-checks input { width: 1.05rem; height: 1.05rem; accent-color: hsl(var(--primary)); }
.ap-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.8rem;
}
.ap-actions button {
  border: 1px solid hsl(var(--border));
  background: hsl(var(--secondary));
  color: hsl(var(--foreground) / 0.9);
  padding: 0.55rem 0.9rem;
  min-height: 44px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  cursor: pointer;
}
.ap-actions button:hover { background: hsl(var(--muted)); }
.ap-actions button.ap-primary {
  background: hsl(var(--primary));
  border-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}
.ap-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.7rem;
}
.ap-pills:empty { display: none; }
.ap-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  padding: 0.3rem 0.3rem 0.3rem 0.6rem;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.7rem;
}
.ap-pill button {
  border: none;
  background: none;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  min-width: 32px;
  min-height: 32px;
}
.ap-pill button:hover { color: hsl(var(--foreground)); }
.ap-note {
  margin-top: 0.7rem;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.7rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.5;
}

#ap-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1rem;
  border-top: 1px solid hsl(var(--border));
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}
#ap-pager[hidden] { display: none; }
#ap-pager button {
  border: 1px solid hsl(var(--border));
  background: hsl(var(--secondary));
  color: hsl(var(--foreground));
  padding: 0.5rem 0.9rem;
  min-height: 44px;
  min-width: 44px;
  cursor: pointer;
  font: inherit;
}
#ap-pager button:disabled { opacity: 0.4; cursor: default; }
#ap-pager select {
  background: hsl(var(--secondary));
  border: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
  padding: 0.5rem;
  min-height: 44px;
  font: inherit;
}

#ap-reveal {
  margin: 0 1rem 0.8rem;
  border: 1px dashed var(--copper);
  padding: 0.7rem 0.9rem;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  color: hsl(var(--foreground) / 0.85);
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}
#ap-reveal[hidden] { display: none; }
#ap-reveal button {
  border: 1px solid hsl(var(--primary));
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  padding: 0.5rem 0.9rem;
  min-height: 44px;
  cursor: pointer;
  font: inherit;
}

.ap-fam {
  grid-column: 1 / -1;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  color: var(--copper);
  border-bottom: 1px solid hsl(var(--border));
  padding: 0.9rem 0 0.3rem;
}
.ap-fam:first-child { padding-top: 0.2rem; }

#desk-cards.ap-compact [data-model-card] { padding: 0.65rem !important; }
#desk-cards.ap-compact [data-model-card] p { display: none; }

.ap-var {
  color: var(--copper) !important;
  border-bottom: 1px dotted var(--copper);
  cursor: help;
}

@media (max-width: 767px) {
  #ap-toggle { flex: 1 1 100%; }
  .ap-grid { grid-template-columns: 1fr 1fr; }
}
