/* ===== audit_tab_html (HTML form, scoped) =====
   The form's rules (Anvil strips <style> from an HTML template). Loaded eagerly
   from anvil.yaml native_deps.head_html, which is also what styles the
   designer canvas.

   `.au-shell` is the form root, so its rule stays a bare class: it is the one
   selector that must outrank the scoped rules beneath it. Everything else is
   `:where(.au-shell)`-scoped, which adds zero specificity and so cannot change
   which rule wins. The root takes `position: relative` (guide: an HTML form
   root takes it), and no min-height, height or overflow.

   No `.au-*` class is declared anywhere else in the app and the form applies
   no `.px-*` class in static markup, so this sheet has no tie to audit against
   a sibling form or against the dependency's runtime theme injection.

   `.au-row.origin-pcs` and `.au-row.origin-carehome` are the rendered half of
   the server's actor_source answer. */

.au-shell {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  color: #1e293b;
  background: #f8fafc;
  padding: 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
}
:where(.au-shell) .au-h2 { font-size: 1.4rem; font-weight: 700; margin: 0 0 4px; }
:where(.au-shell) .au-h2 .au-subnote { font-size: 0.85rem; color: #64748b; font-weight: 400; margin-left: 8px; }

/* filter chips */
:where(.au-shell) .au-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 0 14px; border-bottom: 1px solid #e2e8f0; }
:where(.au-shell) .au-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 999px; cursor: pointer; user-select: none;
  font-size: 0.75rem; font-weight: 600; letter-spacing: .02em;
  font-family: inherit; line-height: normal;
  background: #f1f5f9; color: #94a3b8; border: 1px solid #e2e8f0;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}
:where(.au-shell) .au-chip.active { background: #1d4ed8; color: #ffffff; border-color: #1d4ed8; }
:where(.au-shell) .au-chip:hover { border-color: #94a3b8; }
:where(.au-shell) .au-chip.active:hover { border-color: #1e40af; }
:where(.au-shell) .au-chip:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
:where(.au-shell) .au-chips-actions { display: flex; gap: 8px; margin-left: auto; align-self: center; }
:where(.au-shell) .au-chip-action {
  padding: 4px 10px; border-radius: 6px; cursor: pointer; user-select: none;
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  font-family: inherit; line-height: normal;
  background: transparent; color: #475569; border: 1px solid #cbd5e1;
}
:where(.au-shell) .au-chip-action:hover { background: #f1f5f9; border-color: #94a3b8; }
:where(.au-shell) .au-chip-action:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }

/* timeline */
:where(.au-shell) .au-row {
  display: grid; grid-template-columns: 160px 200px 1fr; gap: 16px;
  padding: 14px 16px; border-bottom: 1px solid #f1f5f9;
  background: #ffffff; border-left: 3px solid transparent;
  align-items: flex-start;
}
:where(.au-shell) .au-row.origin-pcs { border-left-color: #2563eb; }
:where(.au-shell) .au-row.origin-carehome { border-left-color: #16a34a; }

:where(.au-shell) .au-when { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem; color: #64748b; }
:where(.au-shell) .au-what {
  display: flex; flex-direction: column; gap: 4px;
  font-weight: 600; color: #0f172a; font-size: 0.95rem;
}
:where(.au-shell) .au-via {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.65rem; color: #94a3b8; text-transform: uppercase;
  letter-spacing: .12em; font-weight: 600;
}
:where(.au-shell) .au-who { display: flex; flex-direction: column; gap: 4px; color: #334155; }
:where(.au-shell) .au-actor { font-weight: 600; color: #0f172a; }
:where(.au-shell) .au-target { color: #475569; font-style: italic; font-size: 0.9rem; }
:where(.au-shell) .au-target::before { content: "→ "; color: #94a3b8; font-style: normal; }
:where(.au-shell) .au-meta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 0.85rem; color: #475569; }
:where(.au-shell) .au-meta-pill {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem; padding: 1px 8px; border-radius: 4px;
  background: #f1f5f9; color: #475569;
}
:where(.au-shell) .au-meta-score { font-weight: 700; color: #0f172a; }
:where(.au-shell) .au-meta-cert {
  color: #1d4ed8; text-decoration: underline; cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
:where(.au-shell) .au-meta-cert:hover { color: #1e40af; }
/* Cert deep-link is out-of-scope at MVP — render cert id as plain
   text and a disabled-looking "View cert" affordance with tooltip,
   rather than a clickable-looking link that does nothing. */
:where(.au-shell) .au-meta-cert-text {
  color: #475569;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
:where(.au-shell) .au-meta-cert-disabled {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  margin-left: 6px;
  background: #f1f5f9;
  color: #94a3b8;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 12px;
  font-style: italic;
  cursor: not-allowed;
}
:where(.au-shell) .au-meta-home { font-style: italic; }
:where(.au-shell) .au-meta-reason {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.75rem; padding: 1px 8px; border-radius: 4px;
  background: #fef3c7; color: #92400e;
}
:where(.au-shell) .au-system { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: #94a3b8; }

/* states */
:where(.au-shell) .au-empty {
  padding: 40px 20px; text-align: center;
  background: #ffffff; border-radius: 10px; border: 1px solid #e2e8f0;
  color: #64748b;
}
:where(.au-shell) .au-empty-title { font-size: 1.05rem; font-weight: 600; color: #334155; margin-bottom: 6px; }
:where(.au-shell) .au-empty-body { font-size: 0.9rem; line-height: 1.5; }
:where(.au-shell) .au-loading { padding: 30px; text-align: center; color: #64748b; font-size: 0.9rem; }
:where(.au-shell) .au-error {
  padding: 14px 16px; background: #fef2f2; border: 1px solid #fecaca;
  border-radius: 8px; color: #991b1b; font-size: 0.9rem;
}

:where(.au-shell) .au-load-more-wrap { display: flex; justify-content: center; padding: 14px 0 24px; }
:where(.au-shell) .au-load-more {
  padding: 8px 18px; border: 1px solid #cbd5e1; border-radius: 8px;
  background: #ffffff; cursor: pointer; font-size: 0.9rem; font-weight: 600; color: #334155;
}
:where(.au-shell) .au-load-more:hover { background: #f1f5f9; border-color: #94a3b8; }
:where(.au-shell) .au-load-more:disabled { cursor: not-allowed; opacity: 0.6; }
:where(.au-shell) .au-end-marker { text-align: center; color: #94a3b8; font-size: 0.78rem; padding: 14px 0 24px; font-style: italic; }
