/* ============================================================
   ProAudit chrome — command palette (.proaudit-palette-*)
   Mounted in ProAuditLayout beside .pa-main, so Ctrl/Cmd+K and the sidebar
   launcher reach it from every ProAudit page. It lives HERE rather than in a
   page stylesheet because this sheet is linked at area scope in ProAuditLayout
   and so loads on every ProAudit page; a palette whose styles shipped per-page
   would render unstyled everywhere else.

   Distinct selectors from .crm-palette-* / .dash-palette-* on purpose: the
   surfaces never mount together, but a shared selector invites a rule written
   for one to silently match another. Structure mirrors .crm-palette-*.

   Tokens and color-mix only, like every pa-pages sheet. The contract test scans
   these lines RAW, comments included, so a comment naming a colour function or a
   hex literal fails the build just as a declaration would. The launcher itself
   needs nothing here: .pa-sidebar-search already ships in the primitives layer.
   ============================================================ */

.proaudit-palette-backdrop {
  position: fixed;
  inset: 0;
  background: var(--pa-scrim);
  backdrop-filter: var(--pa-scrim-filter);
  z-index: var(--pa-z-dialog);
  animation: proaudit-palette-backdrop-in 120ms ease both;
}

@keyframes proaudit-palette-backdrop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Dialog surface — a width cap is allowed on a dialog by the width policy. */
.proaudit-palette-overlay {
  position: fixed;
  top: 12vh;
  left: 50%;
  transform: translateX(-50%);
  width: min(680px, 92vw);
  background: var(--pa-card);
  border: 1px solid var(--pa-hair);
  border-radius: 0.625rem;
  box-shadow: var(--pa-shadow-dialog);
  z-index: calc(var(--pa-z-dialog) + 1);
  overflow: hidden;
  animation: proaudit-palette-in 120ms ease both;
}

@keyframes proaudit-palette-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-8px) scale(0.97); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0)    scale(1);    }
}

.proaudit-palette-input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.875rem;
  border-bottom: 1px solid var(--pa-row-border);
}

.proaudit-palette-icon {
  font-size: 1rem;
  flex-shrink: 0;
  opacity: 0.55;
}

/* font: inherit, never font-family — the shorthand carries the app face without
   tripping the pa-pages contract, and a bare input would otherwise fall back to
   the user agent's own control face. */
.proaudit-palette-input {
  font: inherit;
  flex: 1 1 auto;
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.95rem;
  color: var(--pa-ink);
  min-width: 0;
  box-shadow: none;
}

.proaudit-palette-input:focus-visible {
  box-shadow: none;
}

.proaudit-palette-input::placeholder {
  color: var(--pa-faint-decor);
}

.proaudit-palette-results {
  max-height: 60vh;
  overflow-y: auto;
  padding: 0.375rem 0;
}

.proaudit-palette-loading,
.proaudit-palette-empty {
  padding: 1.25rem 1rem;
  font-size: 0.85rem;
  color: var(--pa-faint);
  text-align: center;
}

.proaudit-palette-section-title {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--pa-faint);
  padding: 0.5rem 0.875rem 0.2rem;
}

.proaudit-palette-item {
  font: inherit;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.875rem;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--pa-ink);
  transition: background 120ms ease;
}

.proaudit-palette-item:hover,
.proaudit-palette-item--active {
  background: var(--pa-row-hover);
}

.proaudit-palette-item-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Secondary context. Capped in ch rather than px because it is a short text dek,
   which is the form the width policy allows. */
.proaudit-palette-item-sub {
  font-size: 0.72rem;
  color: var(--pa-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 28ch;
  flex-shrink: 1;
  min-width: 0;
}

/* The entity tag reuses .pa-pill + .pa-pill--neutral for its colour semantics.
   The primitive is sized as a status pill and reads too heavy beside a 0.88rem
   row, so this tightens padding and type while keeping the pill shape and every
   token it resolves. */
.proaudit-palette-item .pa-pill {
  padding: 0.05rem 0.5rem;
  font-size: 0.62rem;
  border-width: 1px;
  flex-shrink: 0;
}

/* ---------- Sidebar: a page that is new ----------
   A small tag after the label (Workfiles, 2026-10-31). It lives here because the sidebar
   draws on every ProAudit route; the dark rail flips --pa-orange-text to the bright brand
   orange, so the tag reads on it. Hidden when the rail collapses (.pa-hide-collapsed). */
.pa-nav-new {
  margin-left: auto;
  padding: 1px 5px;
  border: 1px solid color-mix(in srgb, var(--pa-orange) 55%, transparent);
  border-radius: 5px;
  color: var(--pa-orange-text);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-transform: uppercase;
}
