/*
 * agent-fleet-portal — design system foundation (Phase 1).
 * Token layer: color, semantic status, spacing, type, radius, elevation.
 * Dark mode: via data-theme attribute + prefers-color-scheme default.
 */

:root {
  /* Phoenix light theme tokens */
  --af-bg: #f5f7fa;
  --af-surface: #ffffff;
  --af-surface-2: #eff2f6;
  --af-border: #cbd0dd;
  --af-border-subtle: #e3e6ed;
  --af-text: #31374a;
  --af-text-muted: #525b75;
  --af-text-subtle: #8a94ad;
  --af-primary: #1D4ED8;
  --af-primary-hover: #1E40AF;
  --af-secondary: #31374a;
  --af-sidebar-width: 240px;
  --af-sidebar-width-collapsed: 64px;
  --af-success: #25b003;
  --af-danger: #fa3b1d;
  --af-warning: #e5780b;
  --af-info: #0097eb;

  /* Legacy aliases (kept for compatibility during Phase 1 transition) */
  --afp-navy: #31374a;
  --afp-navy-dark: #1f2937;
  --afp-teal: #3874ff;
  --afp-bg: #f5f7fa;
  --afp-card-border: #e3e6ed;
  --af-accent: #3874ff;
  --af-accent-navy: #31374a;

  /* Semantic status pairs (bg/fg) - Phoenix subtle badge style */
  --af-st-running-bg: rgba(56, 116, 255, 0.12);
  --af-st-running-fg: #3874ff;
  --af-st-queued-bg: rgba(138, 148, 173, 0.12);
  --af-st-queued-fg: #525b75;
  --af-st-paused-bg: rgba(229, 120, 11, 0.12);
  --af-st-paused-fg: #e5780b;
  --af-st-blocked-bg: rgba(250, 59, 29, 0.12);
  --af-st-blocked-fg: #fa3b1d;
  --af-st-failed-bg: rgba(250, 59, 29, 0.12);
  --af-st-failed-fg: #fa3b1d;
  --af-st-success-bg: rgba(37, 176, 3, 0.12);
  --af-st-success-fg: #25b003;
  --af-st-stopped-bg: rgba(82, 91, 117, 0.12);
  --af-st-stopped-fg: #525b75;

  /* Spacing */
  --af-space-1: 4px;
  --af-space-2: 8px;
  --af-space-3: 12px;
  --af-space-4: 16px;
  --af-space-5: 24px;
  --af-space-6: 32px;
  --af-space-7: 48px;
  --af-space-8: 64px;

  /* Type scale */
  --af-fs-xs: 0.75rem;
  --af-fs-sm: 0.8rem;
  --af-fs-base: 0.875rem;
  --af-fs-md: 0.925rem;
  --af-fs-lg: 1rem;
  --af-fs-xl: 1.25rem;
  --af-fs-2xl: 1.5rem;
  --af-fs-3xl: 1.75rem;

  /* Border radius (Phoenix values) */
  --af-r-sm: 0.375rem;
  --af-r-md: 0.5rem;
  --af-r-lg: 0.75rem;
  --af-r-pill: 50rem;

  /* Elevation (shadows) - layered, so cards read as raised surfaces rather
     than flat rectangles with a hairline border */
  --af-shadow-1: 0 1px 2px rgba(20, 24, 34, 0.04), 0 1px 1px rgba(20, 24, 34, 0.03);
  --af-shadow-2: 0 4px 10px rgba(20, 24, 34, 0.06), 0 1px 3px rgba(20, 24, 34, 0.05);
  --af-shadow-3: 0 12px 28px rgba(20, 24, 34, 0.10), 0 2px 6px rgba(20, 24, 34, 0.06);
}

/* Dark theme tokens */
:root[data-theme="dark"] {
  /* Color tokens (dark theme) - matched to Control Room's dark palette
     (admin-portal/assets/css/app.css --cr-* tokens) so the two portals read
     as the same product family, not just "also dark". */
  --af-bg: #0B0F19;
  --af-surface: #111827;
  --af-surface-2: #1F2937;
  --af-border: rgba(255, 255, 255, 0.06);
  --af-border-subtle: rgba(255, 255, 255, 0.06);
  --af-text: #E2E8F0;
  --af-text-muted: #94A3B8;
  --af-text-subtle: #64748B;
  --af-primary: #1D4ED8;
  --af-primary-hover: #2563EB;
  --af-secondary: #94A3B8;
  --af-success: #34D399;
  --af-danger: #F87171;
  --af-warning: #FBBF24;
  --af-info: #60A5FA;
  --af-accent: #1D4ED8;
  --af-accent-navy: #1D4ED8;

  /* Semantic status pairs (bg/fg) - dark theme */
  --af-st-running-bg: #1d4ed8;
  --af-st-running-fg: #dbe6ff;
  --af-st-queued-bg: #4b5563;
  --af-st-queued-fg: #eef0f4;
  --af-st-paused-bg: #92600a;
  --af-st-paused-fg: #fff2cc;
  --af-st-blocked-bg: #b3261e;
  --af-st-blocked-fg: #fde2e1;
  --af-st-failed-bg: #b3261e;
  --af-st-failed-fg: #fde2e1;
  --af-st-success-bg: #16793a;
  --af-st-success-fg: #dcf5e3;
  --af-st-stopped-bg: #4b5563;
  --af-st-stopped-fg: #e2e5ea;

  /* Elevation (shadows) - darker in dark mode */
  --af-shadow-1: 0 1px 2px rgba(0, 0, 0, 0.28), 0 1px 1px rgba(0, 0, 0, 0.2);
  --af-shadow-2: 0 4px 10px rgba(0, 0, 0, 0.36), 0 1px 3px rgba(0, 0, 0, 0.24);
  --af-shadow-3: 0 16px 32px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.32);

  /* Legacy alias overrides for dark mode */
  --afp-bg: var(--af-bg);
  --afp-card-border: var(--af-border);
  --afp-navy: var(--af-accent-navy);
  --afp-teal: var(--af-primary);
}

/* Bootstrap's .text-muted ships a fixed gray via --bs-secondary-color, not this
   app's --af-text-muted token, so it goes near-invisible on dark surfaces. */
:root[data-theme="dark"] .text-muted {
  color: var(--af-text-muted) !important;
}

/* Same root cause as .table above: .alert-* variants (and .table, handled
   separately) read Bootstrap's *-bg-subtle/-text-emphasis variables, which
   this app never repoints because it uses its own data-theme attribute
   instead of Bootstrap's data-bs-theme. Values below are lifted directly from
   Bootstrap's own [data-bs-theme=dark] block, not invented. */
:root[data-theme="dark"] {
  --bs-info-bg-subtle: #032830;
  --bs-info-border-subtle: #087990;
  --bs-info-text-emphasis: #6edff6;
  --bs-warning-bg-subtle: #332701;
  --bs-warning-border-subtle: #997404;
  --bs-warning-text-emphasis: #ffda6a;
  --bs-danger-bg-subtle: #2c0b0e;
  --bs-danger-border-subtle: #842029;
  --bs-danger-text-emphasis: #ea868f;
  --bs-success-bg-subtle: #051b11;
  --bs-success-border-subtle: #0f5132;
  --bs-success-text-emphasis: #75b798;
  --bs-light-bg-subtle: #343a40;
  --bs-light-border-subtle: #495057;
  --bs-light-text-emphasis: #f8f9fa;
}

/* Default to dark mode based on system preference */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --af-bg: #0B0F19;
    --af-surface: #111827;
    --af-surface-2: #1F2937;
    --af-border: rgba(255, 255, 255, 0.06);
    --af-border-subtle: rgba(255, 255, 255, 0.06);
    --af-text: #E2E8F0;
    --af-text-muted: #94A3B8;
    --af-text-subtle: #64748B;
    --af-primary: #1D4ED8;
    --af-primary-hover: #2563EB;
    --af-secondary: #94A3B8;
    --af-success: #34D399;
    --af-danger: #F87171;
    --af-warning: #FBBF24;
    --af-info: #60A5FA;
    --af-accent: #1D4ED8;
    --af-accent-navy: #1D4ED8;

    --af-st-running-bg: #1d4ed8;
    --af-st-running-fg: #dbe6ff;
    --af-st-queued-bg: #4b5563;
    --af-st-queued-fg: #eef0f4;
    --af-st-paused-bg: #92600a;
    --af-st-paused-fg: #fff2cc;
    --af-st-blocked-bg: #b3261e;
    --af-st-blocked-fg: #fde2e1;
    --af-st-failed-bg: #b3261e;
    --af-st-failed-fg: #fde2e1;
    --af-st-success-bg: #16793a;
    --af-st-success-fg: #dcf5e3;
    --af-st-stopped-bg: #4b5563;
    --af-st-stopped-fg: #e2e5ea;

    --af-shadow-1: 0 1px 2px rgba(0, 0, 0, 0.28), 0 1px 1px rgba(0, 0, 0, 0.2);
    --af-shadow-2: 0 4px 10px rgba(0, 0, 0, 0.36), 0 1px 3px rgba(0, 0, 0, 0.24);
    --af-shadow-3: 0 16px 32px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.32);

    --afp-bg: var(--af-bg);
    --afp-card-border: var(--af-border);
    --afp-navy: var(--af-accent-navy);
    --afp-teal: var(--af-primary);
  }

  :root:not([data-theme="light"]) .text-muted {
    color: var(--af-text-muted) !important;
  }

  :root:not([data-theme="light"]) {
    --bs-info-bg-subtle: #032830;
    --bs-info-border-subtle: #087990;
    --bs-info-text-emphasis: #6edff6;
    --bs-warning-bg-subtle: #332701;
    --bs-warning-border-subtle: #997404;
    --bs-warning-text-emphasis: #ffda6a;
    --bs-danger-bg-subtle: #2c0b0e;
    --bs-danger-border-subtle: #842029;
    --bs-danger-text-emphasis: #ea868f;
    --bs-success-bg-subtle: #051b11;
    --bs-success-border-subtle: #0f5132;
    --bs-success-text-emphasis: #75b798;
    --bs-light-bg-subtle: #343a40;
    --bs-light-border-subtle: #495057;
    --bs-light-text-emphasis: #f8f9fa;
  }
}

/* Global focus ring for accessibility */
*:focus-visible {
  outline: 2px solid var(--af-primary);
  outline-offset: 2px;
}

/* Form controls - Phoenix style */
.form-control:focus,
.form-select:focus {
  border-color: var(--af-primary);
  box-shadow: 0 0 0 0.25rem rgba(56, 116, 255, 0.25);
}

/* Links - Phoenix style */
a {
  color: var(--af-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Buttons - Phoenix style */
.btn {
  border-radius: var(--af-r-sm);
  font-weight: 700;
  transition: all 0.15s ease;
}

.btn-primary {
  background-color: var(--af-primary);
  border-color: var(--af-primary);
  box-shadow: 0 1px 2px rgba(56, 116, 255, 0.25);
}

.btn-primary:hover {
  background-color: #2d5fd4;
  border-color: #2d5fd4;
  box-shadow: 0 4px 10px rgba(56, 116, 255, 0.32);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-success {
  background-color: var(--af-success);
  border-color: var(--af-success);
}

.btn-warning {
  background-color: var(--af-warning);
  border-color: var(--af-warning);
}

.btn-danger {
  background-color: var(--af-danger);
  border-color: var(--af-danger);
}

body {
  background-color: var(--af-bg);
  color: var(--af-text);
  font-family: 'Nunito Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Phoenix typography: bold headings and buttons */
h1, h2, h3, h4, h5, h6,
.afp-brand,
.afp-page-title,
.btn,
.afp-badge {
  font-weight: 700;
}

/* -- top nav (Phoenix style: white bg, primary accent) --------------------- */

.afp-navbar {
  background: var(--af-surface);
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--af-border-subtle);
  box-shadow: var(--af-shadow-1);
  position: relative;
  z-index: 10;
}

.afp-brand {
  color: var(--af-text) !important;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.afp-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--af-r-md);
  background: linear-gradient(135deg, var(--af-primary) 0%, #2456c9 100%);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 6px rgba(56, 116, 255, 0.35);
}

.afp-brand-mark svg {
  width: 18px;
  height: 18px;
}

.afp-navbar .nav-link {
  color: var(--af-text-muted) !important;
  font-weight: 600;
  padding: 0.5rem 0.9rem;
  border-radius: var(--af-r-sm);
  transition: all 0.15s ease;
}

.afp-navbar .nav-link:hover {
  color: var(--af-text) !important;
  background: var(--af-surface-2);
}

.afp-navbar .nav-link.active {
  color: var(--af-primary) !important;
  background: transparent;
  border-bottom: 2px solid var(--af-primary);
  margin-bottom: -1px;
}

/* -- sidebar (Control Room pattern - see Control-Room/admin-portal's
   .cf-sidebar/.cf-nav-item/.cf-sidebar-footer) - replaces the old top navbar
   so both portals share the same navigation chrome, not just similar colors. */

.afp-sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--af-sidebar-width);
  height: 100vh;
  background: var(--af-surface);
  border-right: 1px solid var(--af-border);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: width 0.15s ease;
}

.afp-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 10px 12px 16px;
  border-bottom: 1px solid var(--af-border);
}

.afp-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.afp-sidebar-brand span {
  font-weight: 700;
  font-size: 14px;
  color: var(--af-text);
  letter-spacing: -0.01em;
}

.afp-sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.afp-sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  margin: 1px 8px;
  border-radius: var(--af-r-sm);
  color: var(--af-text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s ease;
  border: none;
  text-decoration: none;
}

.afp-sidebar .nav-link:hover {
  color: var(--af-text);
  background: var(--af-surface-2);
}

.afp-sidebar .nav-link.active {
  color: #fff;
  background: var(--af-primary);
  font-weight: 600;
}

:root:not([data-theme="dark"]) .afp-sidebar .nav-link.active {
  color: var(--af-primary);
  background: rgba(29, 78, 216, 0.1);
}

/* -- sidebar collapse (icons-only rail) -------------------------------------
   State lives as data-sidebar="collapsed|expanded" on <html> (same pattern as
   data-theme), set by js/common.js initSidebarState/setSidebarCollapsed. */

.afp-sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  background: var(--af-surface-2);
  border: 1px solid var(--af-border);
  border-radius: var(--af-r-sm);
  color: var(--af-text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.afp-sidebar-toggle:hover {
  color: var(--af-text);
  background: var(--af-bg);
  border-color: var(--af-primary);
}

.afp-sidebar-toggle:focus-visible,
.afp-sidebar .nav-link:focus-visible,
.afp-sidebar-brand:focus-visible {
  outline: 2px solid var(--af-primary);
  outline-offset: 2px;
}

.afp-nav-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

:root[data-sidebar="collapsed"] .afp-sidebar {
  width: var(--af-sidebar-width-collapsed);
}

:root[data-sidebar="collapsed"] .afp-page {
  margin-left: var(--af-sidebar-width-collapsed);
}

/* Labels become screen-reader-only (NOT display:none) so every icon-only
   link/control keeps its accessible name while collapsed. */
:root[data-sidebar="collapsed"] .afp-sidebar .afp-nav-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:root[data-sidebar="collapsed"] .afp-sidebar-head {
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 0 10px;
}

:root[data-sidebar="collapsed"] .afp-sidebar .nav-link {
  justify-content: center;
  padding: 10px 0;
  margin: 2px 10px;
}

:root[data-sidebar="collapsed"] .afp-sidebar-footer {
  padding: 10px 6px;
}

:root[data-sidebar="collapsed"] .afp-sidebar-footer-row {
  flex-direction: column;
  gap: 8px;
}

:root[data-sidebar="collapsed"] .afp-user-info {
  flex-direction: column;
}

:root[data-sidebar="collapsed"] .afp-user-meta {
  display: none;
}

:root[data-sidebar="collapsed"] .afp-theme-toggle {
  padding: 5px;
}

@media (prefers-reduced-motion: reduce) {
  .afp-sidebar, .afp-page { transition: none; }
}

.afp-sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--af-border);
}

/* Release stamp: the smallest, quietest thing in the sidebar. It is reference
   metadata - useful when someone asks "is my change live yet?" - so it must not
   compete with the nav or the user identity above it. It also carries the
   .afp-nav-label class, which the collapsed-rail rule above already hides, so
   it disappears with every other label when the sidebar shrinks to icons. */
.afp-release-stamp {
  margin-top: 10px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--af-text-muted);
  opacity: 0.85;
}

.afp-release-sha {
  font-size: 10px;
  color: inherit;
  background: none;
  padding: 0;
}

/* Controls row: theme toggle + icon-only sign-out, ends justified so
   there's no ambiguity about which is which even at the sidebar's fixed
   240px width. */
.afp-sidebar-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.afp-signout-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--af-text-muted);
  font-size: 15px;
  transition: color 0.15s ease;
}

.afp-signout-link:hover {
  color: var(--af-text);
}

/* Identity row: avatar + name/email get their own full-width line instead
   of competing with the theme toggle and a text sign-out button for space -
   that's what was truncating the email down to "cedric....". */
.afp-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.afp-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--af-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.afp-user-meta {
  flex: 1;
  min-width: 0;
}

.afp-user-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--af-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.afp-user-email {
  font-size: 11px;
  color: var(--af-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* -- page shell ------------------------------------------------------------ */

.afp-page {
  margin-left: var(--af-sidebar-width);
  padding: 1.75rem 1.75rem 3rem;
  transition: margin-left 0.15s ease;
}

@media (max-width: 900px) {
  /* Off-canvas below 900px (pre-existing behaviour): the sidebar hides fully
     and content takes the whole width, collapsed or not. The extra selector
     out-specifies the collapsed margin rule above. */
  .afp-sidebar { transform: translateX(-100%); }
  .afp-page,
  :root[data-sidebar="collapsed"] .afp-page { margin-left: 0; }
}

.afp-page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.afp-page-title {
  font-weight: 800;
  color: var(--af-text);
  margin-bottom: 0.15rem;
  letter-spacing: -0.01em;
}

.afp-page-subtitle {
  color: var(--af-text-muted);
  font-size: var(--af-fs-md);
}

.afp-card {
  background: var(--af-surface);
  border: 1px solid var(--af-border-subtle);
  border-radius: var(--af-r-lg);
  box-shadow: var(--af-shadow-1);
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

/* Optional left-accent stripe for cards that represent a distinct path/choice
   (e.g. "create" vs "align" on Provision) - opt-in via a second class so it
   never applies where it isn't asked for. */
.afp-card-accent {
  border-left: 3px solid var(--af-card-accent-color, var(--af-primary));
}

.afp-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--af-r-md);
  background: var(--af-card-accent-bg, rgba(56, 116, 255, 0.12));
  color: var(--af-card-accent-color, var(--af-primary));
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* Cards that are themselves a click target (repo cards, run rows-as-cards)
   get a visible lift on hover; opt-in via .afp-card-hover so static content
   cards (stat tiles, forms) stay still. */
.afp-card-hover:hover {
  box-shadow: var(--af-shadow-2);
  border-color: var(--af-border);
  transform: translateY(-1px);
}

/* -- badges (Phoenix subtle style) ----------------------------------------- */

.afp-badge {
  font-weight: 700;
  font-size: var(--af-fs-xs);
  letter-spacing: 0.01em;
  padding: 0.35em 0.65em;
  border-radius: var(--af-r-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
}

/* Legacy badge variants - Phoenix subtle style with semantic colors */
.afp-badge-secondary { background-color: rgba(82, 91, 117, 0.12); color: var(--af-secondary); }
.afp-badge-primary   { background-color: rgba(56, 116, 255, 0.12); color: var(--af-primary); }
.afp-badge-warning   { background-color: rgba(229, 120, 11, 0.12); color: var(--af-warning); }
.afp-badge-danger    { background-color: rgba(250, 59, 29, 0.12); color: var(--af-danger); }
.afp-badge-info      { background-color: rgba(0, 151, 235, 0.12); color: var(--af-info); }
.afp-badge-success   { background-color: rgba(37, 176, 3, 0.12); color: var(--af-success); }
.afp-badge-dark      { background-color: rgba(82, 91, 117, 0.12); color: var(--af-secondary); }
.afp-badge-purple    { background-color: rgba(123, 97, 255, 0.12); color: #7b61ff; }
.afp-badge-teal      { background-color: rgba(56, 116, 255, 0.12); color: var(--af-primary); }

/* Semantic status badges (use CSS custom properties for dark mode support) */
.afp-badge-running { background-color: var(--af-st-running-bg); color: var(--af-st-running-fg); }
.afp-badge-queued { background-color: var(--af-st-queued-bg); color: var(--af-st-queued-fg); }
.afp-badge-paused { background-color: var(--af-st-paused-bg); color: var(--af-st-paused-fg); }
.afp-badge-blocked { background-color: var(--af-st-blocked-bg); color: var(--af-st-blocked-fg); }
.afp-badge-failed { background-color: var(--af-st-failed-bg); color: var(--af-st-failed-fg); }
.afp-badge-completed { background-color: var(--af-st-success-bg); color: var(--af-st-success-fg); }
.afp-badge-stopped { background-color: var(--af-st-stopped-bg); color: var(--af-st-stopped-fg); }

/* -- stat tiles --------------------------------------------------------------- */

.afp-stat-tile {
  background: var(--af-surface);
  border: 1px solid var(--af-border-subtle);
  border-radius: var(--af-r-lg);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--af-shadow-1);
}

.afp-stat-value {
  font-size: var(--af-fs-3xl);
  font-weight: 800;
  color: var(--af-text);
  line-height: 1.15;
}

.afp-stat-label {
  color: var(--af-text-muted);
  font-size: var(--af-fs-sm);
  letter-spacing: 0.04em;
  font-weight: 600;
}

/* -- runs table (Phoenix style: subtle header, comfortable padding) ----------- */

/* Bootstrap paints table cells via background-color: var(--bs-table-bg), which
   falls back to var(--bs-body-bg) - Bootstrap's OWN light-mode #fff, unrelated
   to this app's --af-bg tokens. Every .table in the app needs this override or
   its cells render solid white regardless of the app's dark/light theme. */
.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--af-text);
  --bs-table-border-color: var(--af-border-subtle);
}

.afp-runs-table td, .afp-runs-table th {
  vertical-align: middle;
  padding: 0.5rem 0.75rem;
}

.afp-runs-table thead th {
  background-color: rgba(255, 255, 255, 0.02);
  color: var(--af-text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--af-border-subtle);
}

/* Tighten the stacked sub-lines a run row can carry (status badge, pipeline
   strip, model badge, WHY line, inline remediation action) so density gains
   from the reduced cell padding above aren't undone by full Bootstrap mt-1
   gaps between them. */
.afp-runs-table td > .mt-1 {
  margin-top: 0.3rem !important;
}

.afp-runs-table tbody tr {
  transition: background-color 0.15s ease;
}

.afp-runs-table tbody td {
  border-bottom: 1px solid var(--af-border-subtle);
}

.afp-runs-table tbody tr:last-child td {
  border-bottom: none;
}

/* Runs-table summary cell. Two clamped lines rather than one ellipsised line: the first
   sentence of a summary is almost always machine-generated boilerplate ("Merged into dev at
   ..."), so a single line showed the reader the part they already knew and cut the part they
   wanted. Two lines reach the agent's actual narrative. */
.afp-run-summary {
  color: var(--af-text-muted);
  font-size: var(--af-fs-base);
  max-width: 460px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.45;
}

/* -- run detail: plain-English summary -------------------------------------------
   The summary is the one part of a run a non-technical reader is meant to understand, and it
   was rendered as a single dense line of unstyled text with the important facts buried mid-
   sentence. Three changes: the facts come out as chips built from the run's STRUCTURED columns
   (never parsed from the prose, so they cannot disagree with reality), the narrative gets a
   readable measure and leading, and identifiers inside it are made visually distinct. */

.afp-summary-facts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--af-space-2);
  margin-bottom: var(--af-space-3);
}

.afp-fact {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--af-r-pill);
  font-size: var(--af-fs-sm);
  background: var(--af-bg);
  border: 1px solid var(--af-border);
  white-space: nowrap;
}

.afp-fact-label {
  color: var(--af-text-muted);
  font-size: var(--af-fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.afp-fact-value { font-weight: 600; }

/* Outcome-coloured variants reuse the existing status palette so a chip can never drift from
   what the status badge says. */
.afp-fact-good  { background: var(--af-st-success-bg); border-color: var(--af-st-success-fg); }
.afp-fact-good  .afp-fact-value, .afp-fact-good .afp-fact-label { color: var(--af-st-success-fg); }
.afp-fact-bad   { background: var(--af-st-failed-bg); border-color: var(--af-st-failed-fg); }
.afp-fact-bad   .afp-fact-value, .afp-fact-bad .afp-fact-label { color: var(--af-st-failed-fg); }
/* AMBER, not red. "No test command configured" is a caution the reader should act on, not a
   failure - rendering it in the same red as "nothing merged" made an unverified success look
   like a broken run, which is both wrong and quickly ignored. */
.afp-fact-warn  { background: var(--af-st-paused-bg); border-color: var(--af-st-paused-fg); }
.afp-fact-warn  .afp-fact-value, .afp-fact-warn .afp-fact-label { color: var(--af-st-paused-fg); }

/* Readable measure. Long summaries ran the full width of a wide monitor, which is the single
   biggest reason they read as a wall of text. */
.afp-summary-narrative {
  font-size: var(--af-fs-md);
  line-height: 1.65;
  max-width: 72ch;
  margin: 0;
}

.afp-summary-narrative + .afp-summary-narrative { margin-top: var(--af-space-3); }

/* Structure from the markdown-lite narrative renderer (renderRichNarrative in run-detail.js):
   reviewer-written summaries carry ## headings and findings lists - give them the same measure
   and rhythm as the paragraphs so a blocked run's review reads as a document, not a blob. */
.afp-summary-heading {
  font-weight: 600;
  margin-top: var(--af-space-4);
}
.afp-summary-narrative + .afp-summary-heading,
.afp-summary-list + .afp-summary-narrative,
.afp-summary-narrative + .afp-summary-list { margin-top: var(--af-space-3); }
.afp-summary-list {
  font-size: var(--af-fs-md);
  line-height: 1.65;
  max-width: 72ch;
  margin: 0;
  padding-left: 1.4rem;
}
.afp-summary-list li + li { margin-top: var(--af-space-2); }
.afp-summary-list code {
  font-size: 0.92em;
  padding: 1px 5px;
  border-radius: var(--af-r-sm);
  background: var(--af-bg);
  border: 1px solid var(--af-border);
  color: inherit;
}

/* Identifiers the eye should be able to find without reading the sentence: commit shas, file
   paths, branch names, quoted names. */
.afp-summary-narrative code {
  font-size: 0.92em;
  padding: 1px 5px;
  border-radius: var(--af-r-sm);
  background: var(--af-bg);
  border: 1px solid var(--af-border);
  color: inherit;
}

.afp-run-link {
  font-weight: 600;
  text-decoration: none;
  color: var(--af-text);
}

.afp-run-link:hover {
  color: var(--af-accent);
}

/* "+N earlier runs" links on a plan that was run more than once (see mission-control.js's
   supersededHtml). Muted on purpose - the COUNT is the signal; the links are there so a
   superseded run is never unreachable, not to compete with the row's own identity link. */
.afp-superseded-link {
  text-decoration: underline;
  color: inherit;
}

.afp-superseded-link:hover {
  color: var(--af-accent);
}

.afp-mock-note {
  font-size: var(--af-fs-sm);
  color: var(--af-st-paused-fg);
  background: var(--af-st-paused-bg);
  border: 1px solid var(--af-st-paused-fg);
  border-radius: var(--af-r-md);
  padding: 0.5rem 0.75rem;
}

.afp-code-block {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: var(--af-fs-xs);
  background: var(--af-bg);
  color: var(--af-text);
  border: 1px solid var(--af-border);
  border-radius: var(--af-r-sm);
  padding: 0.6rem 0.75rem;
  overflow-x: auto;
  white-space: pre;
}
.afp-code-block code { color: inherit; background: none; border: none; padding: 0; }

.afp-model-code {
  font-size: var(--af-fs-xs);
  background: var(--af-surface-2);
  color: var(--af-text);
  padding: 0.2em 0.4em;
  border-radius: var(--af-r-sm);
  border: 1px solid var(--af-border);
}

/* -- event log ------------------------------------------------------------------- */

.afp-event-log {
  list-style: none;
  margin: 0;
  padding: 0;
}

.afp-event-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--af-border);
}

.afp-event-item:last-child {
  border-bottom: none;
}

.afp-event-ts {
  flex: 0 0 150px;
  color: var(--af-text-subtle);
  font-size: var(--af-fs-sm);
  font-variant-numeric: tabular-nums;
}

.afp-event-type {
  flex: 0 0 110px;
}

.afp-event-detail {
  flex: 1 1 auto;
  font-size: var(--af-fs-base);
  color: var(--af-text);
}

/* -- file changes list (replaces fake diff) ---------------------------------------- */

.afp-file-changes {
  background: var(--af-surface-2);
  border: 1px solid var(--af-border);
  border-radius: var(--af-r-md);
  padding: 1rem;
  max-height: 400px;
  overflow-y: auto;
}

.afp-file-change-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: var(--af-fs-sm);
  color: var(--af-text);
}

.afp-file-change-item:not(:last-child) {
  border-bottom: 1px solid var(--af-border);
}

.afp-file-change-icon {
  flex-shrink: 0;
  width: 1em;
  height: 1em;
}

.afp-empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--af-text-muted);
  font-size: var(--af-fs-base);
}

/* -- login page --------------------------------------------------------------------- */

.afp-login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 20% 20%, var(--af-primary) 0%, var(--af-secondary) 60%);
}

.afp-login-card {
  background: var(--af-surface);
  border-radius: var(--af-r-lg);
  padding: 2.5rem 2.25rem;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  text-align: center;
}

.afp-login-mark {
  width: 56px;
  height: 56px;
  border-radius: var(--af-r-lg);
  background: var(--af-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  margin: 0 auto 1rem;
  font-size: 1.1rem;
}

.afp-login-mark svg {
  width: 32px;
  height: 32px;
}

.afp-google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.65rem 1rem;
  border: 1px solid var(--af-border);
  border-radius: var(--af-r-md);
  background: var(--af-surface);
  font-weight: 700;
  color: var(--af-text);
  transition: all 0.15s ease;
}

.afp-google-btn:hover {
  background: var(--af-surface-2);
}

/* -- skeleton loaders ---------------------------------------------------------- */

.afp-skeleton {
  background: linear-gradient(90deg, var(--af-surface-2) 0%, var(--af-border) 50%, var(--af-surface-2) 100%);
  background-size: 200% 100%;
  animation: afp-skeleton-pulse 1.5s ease-in-out infinite;
  border-radius: var(--af-r-sm);
}

.afp-skeleton-tile {
  height: 80px;
  border-radius: var(--af-r-lg);
}

.afp-skeleton-row {
  height: 48px;
  border-radius: var(--af-r-sm);
  margin-bottom: 0.5rem;
}

@keyframes afp-skeleton-pulse {
  0%, 100% { background-position: 0% 0%; }
  50% { background-position: 100% 0%; }
}

/* -- dark mode toggle (adapts to Phoenix light navbar) ----------------------- */

.afp-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: none;
  border: 1px solid var(--af-border);
  border-radius: var(--af-r-sm);
  color: var(--af-text-muted);
  font-size: 13px;
  cursor: pointer;
}

.afp-theme-toggle:hover {
  color: var(--af-text);
}

.afp-theme-toggle-icon {
  width: 14px;
  height: 14px;
}

/* -- sparklines (inline SVG for KPIs on Overview) ---------------------------- */

.afp-sparkline {
  display: inline-block;
  vertical-align: middle;
  color: var(--af-accent);
}

@media (max-width: 576px) {
  .afp-event-ts { flex-basis: 110px; }
}

/* -- SVG charts (Cost & Reporting, hand-rolled inline charts) --------------- */

.afp-chart {
  display: block;
  max-width: 100%;
  height: auto;
  color: var(--af-text);
}

.afp-chart-bar {
  fill: var(--af-accent);
}

.afp-chart-label {
  fill: var(--af-text);
  font-size: 12px;
  dominant-baseline: middle;
}

.afp-chart-value {
  fill: var(--af-text-muted);
  font-size: 11px;
  dominant-baseline: middle;
}

.afp-chart-axis-label {
  fill: var(--af-text-subtle);
  font-size: 10px;
}

.afp-chart-grid {
  stroke: var(--af-border);
  stroke-width: 1;
  stroke-dasharray: 2,2;
}

/* Fleet efficacy adoption chart (reports.html): fleet vs direct stacked bars.
   Two fixed series colors - accent (blue) for fleet, subtle ink for direct -
   chosen for strong chroma/lightness separation in both themes (CVD-safe),
   with a legend + per-segment titles so identity is never color-alone. */
.afp-eff-bar-fleet { fill: var(--af-accent); }
.afp-eff-bar-direct { fill: var(--af-text-subtle); }

.afp-eff-legend-chip {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  vertical-align: baseline;
}
.afp-eff-legend-fleet { background: var(--af-accent); }
.afp-eff-legend-direct { background: var(--af-text-subtle); }

/* Fleet efficacy headline (2026-07-27 density redesign): one card, three
   numbers, each with a one-line plain-English meaning - replaces four
   equal-weight bordered tiles. */
.afp-eff-hero-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2.5rem;
}

.afp-eff-hero {
  flex: 1 1 220px;
  min-width: 200px;
  max-width: 380px;
}

.afp-eff-flag {
  margin-top: 0.9rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--af-border-subtle);
}

/* Reference material demoted behind a native <details> row: closed it reads
   as a single quiet line (title + live count + caveat); open it holds the
   full table. */
.afp-eff-details {
  background: var(--af-surface);
  border: 1px solid var(--af-border-subtle);
  border-radius: var(--af-r-lg);
}

.afp-eff-details > summary {
  cursor: pointer;
  padding: 0.85rem 1rem;
  list-style: none;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.afp-eff-details > summary::-webkit-details-marker { display: none; }

.afp-eff-details > summary::before {
  content: '';
  align-self: center;
  flex: 0 0 auto;
  width: 0.55em;
  height: 0.55em;
  border-right: 2px solid var(--af-text-subtle);
  border-bottom: 2px solid var(--af-text-subtle);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}

.afp-eff-details[open] > summary::before { transform: rotate(45deg); }

.afp-eff-details[open] > summary { border-bottom: 1px solid var(--af-border-subtle); }

.afp-eff-details-title {
  font-weight: 600;
  color: var(--af-text);
}

.afp-eff-details-caveat { flex-basis: 100%; padding-left: 1.3em; margin-top: -0.25rem; }

/* -- Block analytics: proportional bars for rate + breakdown ----------------- */
.afp-block-bar-track {
  background: var(--af-surface-2);
  border-radius: 999px;
  height: 8px;
  width: 100%;
  overflow: hidden;
}
.afp-block-bar {
  height: 100%;
  border-radius: 999px;
  background: var(--af-accent);
  min-width: 2px;
}
.afp-block-bar-cool { background: var(--af-accent); }
.afp-block-bar-warm { background: var(--af-warning); }
.afp-block-bar-hot  { background: var(--af-danger); }
.afp-block-bd-row { margin-bottom: 0.6rem; }
.afp-block-bd-row:last-child { margin-bottom: 0; }
.afp-block-bd-label { letter-spacing: 0.04em; font-weight: 600; }

/* -- Phoenix-inspired components (Runs page UI/UX overhaul) ----------------- */

/* Avatar component - circular initials with deterministic color */
.afp-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: var(--af-fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  line-height: 1;
  flex-shrink: 0;
}

/* Avatar color palette - Phoenix subtle style matching badges */
.afp-avatar-secondary { background-color: rgba(82, 91, 117, 0.12); color: var(--af-secondary); }
.afp-avatar-primary   { background-color: rgba(56, 116, 255, 0.12); color: var(--af-primary); }
.afp-avatar-info      { background-color: rgba(0, 151, 235, 0.12); color: var(--af-info); }
.afp-avatar-success   { background-color: rgba(37, 176, 3, 0.12); color: var(--af-success); }
.afp-avatar-warning   { background-color: rgba(229, 120, 11, 0.12); color: var(--af-warning); }
.afp-avatar-purple    { background-color: rgba(123, 97, 255, 0.12); color: #7b61ff; }
.afp-avatar-teal      { background-color: rgba(56, 116, 255, 0.12); color: var(--af-primary); }

/* Filter tabs component */
.afp-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--af-space-2);
  align-items: center;
  padding: var(--af-space-3);
  background: var(--af-surface);
  border: 1px solid var(--af-border);
  border-radius: var(--af-r-lg);
  box-shadow: var(--af-shadow-1);
}

.afp-filter-tab {
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--af-border);
  background: transparent;
  color: var(--af-text);
  font-size: var(--af-fs-sm);
  font-weight: 500;
  border-radius: var(--af-r-pill);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.afp-filter-tab:hover {
  background: var(--af-surface-2);
  border-color: var(--af-primary);
}

.afp-filter-tab.active {
  background: var(--af-primary);
  border-color: var(--af-primary);
  color: #fff;
}

.afp-filter-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4em;
  padding: 0.1em 0.4em;
  background: rgba(255, 255, 255, 0.25);
  border-radius: var(--af-r-pill);
  font-size: 0.9em;
  font-weight: 600;
}

.afp-filter-tab:not(.active) .afp-filter-tab-count {
  background: var(--af-surface-2);
  color: var(--af-text-muted);
}

/* Row action menu component */
.afp-row-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--af-border);
  background: transparent;
  color: var(--af-text-muted);
  border-radius: var(--af-r-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 1rem;
  line-height: 1;
}

.afp-row-menu-btn:hover {
  background: var(--af-surface-2);
  color: var(--af-text);
  border-color: var(--af-accent);
}

.afp-row-menu-btn::after {
  content: '\22EE';
  display: block;
}

/* Table hover effect - matches Control Room's .cf-table: a faint overlay,
   not a fixed surface color, so it reads as a subtle highlight rather than a
   visible background swap. */
.afp-runs-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

/* -- collapsible card toggle ------------------------------------------------- */

.afp-collapse-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0;
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  text-align: left;
  transition: opacity 0.15s ease;
}

.afp-collapse-toggle:hover {
  opacity: 0.8;
}

.afp-collapse-chevron {
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 0.5rem;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--af-text-muted);
  transition: transform 0.2s ease;
}

.afp-collapse-toggle[aria-expanded="true"] .afp-collapse-chevron {
  transform: rotate(180deg);
}

/* Plan name buttons - clickable plan names that open the viewer modal */
.afp-plan-name-btn,
.afp-plan-name-btn-inline {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--af-link-color);
  text-decoration: underline;
  cursor: pointer;
}

.afp-plan-name-btn:hover,
.afp-plan-name-btn-inline:hover {
  color: var(--af-link-hover-color);
  text-decoration: none;
}

.afp-plan-name-btn-inline {
  font-size: inherit;
  font-weight: 600;
}

/* -- info popovers (2026-07-27: plain-English metric explanations) ----------
   Small ⓘ buttons that open click/focus-triggered Bootstrap popovers. Click,
   not hover: hover does not exist on touch and dismisses mid-read. */

.afp-info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  margin-left: 0.35rem;
  border: 1px solid var(--af-border);
  border-radius: 50%;
  background: transparent;
  color: var(--af-text-subtle);
  font-size: 10px;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, 'Times New Roman', serif;
  line-height: 1;
  cursor: pointer;
  vertical-align: baseline;
  flex: 0 0 auto;
  transition: all 0.15s ease;
}

.afp-info-btn:hover,
.afp-info-btn:focus {
  color: var(--af-primary);
  border-color: var(--af-primary);
  background: rgba(56, 116, 255, 0.08);
}

.afp-info-popover {
  max-width: 380px;
  font-size: var(--af-fs-sm);
  --bs-popover-max-width: 380px;
}

.afp-info-popover .popover-body { line-height: 1.55; }
.afp-info-popover ul { margin: 0; padding-left: 1.1rem; }
.afp-info-popover li + li { margin-top: 0.35rem; }

:root[data-theme="dark"] .afp-info-popover {
  --bs-popover-bg: var(--af-surface-2);
  --bs-popover-body-color: var(--af-text);
  --bs-popover-header-bg: var(--af-surface-2);
  --bs-popover-header-color: var(--af-text);
  --bs-popover-border-color: var(--af-border);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .afp-info-popover {
    --bs-popover-bg: var(--af-surface-2);
    --bs-popover-body-color: var(--af-text);
    --bs-popover-header-bg: var(--af-surface-2);
    --bs-popover-header-color: var(--af-text);
    --bs-popover-border-color: var(--af-border);
  }
}

/* -- capped scroll regions (2026-07-27 vertical-density pass) ----------------
   A long list must scroll inside its own container, not extend the page.
   Combine with .table-responsive so wide tables still get overflow-x: auto. */

.afp-scroll-y {
  max-height: 420px;
  overflow-y: auto;
}

/* Sticky header inside a capped table region needs an OPAQUE surface (the
   default thead background is translucent, so rows would ghost through). */
.afp-scroll-y thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background-color: var(--af-surface);
}

/* -- compact stat tiles (used where tiles share a half-width card) ----------- */

.afp-stat-tile-sm {
  padding: 0.55rem 0.85rem;
}

.afp-stat-tile-sm .afp-stat-value {
  font-size: var(--af-fs-xl);
}

/* -- generic quiet disclosure row (same visual as .afp-eff-details) ----------
   Reference-shaped prose collapses behind these on Configuration and Reports:
   closed it reads as one informative line; open it holds the full material. */

.afp-details {
  background: var(--af-surface);
  border: 1px solid var(--af-border-subtle);
  border-radius: var(--af-r-lg);
}

.afp-details > summary {
  cursor: pointer;
  padding: 0.7rem 1rem;
  list-style: none;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.afp-details > summary::-webkit-details-marker { display: none; }

.afp-details > summary::before {
  content: '';
  align-self: center;
  flex: 0 0 auto;
  width: 0.55em;
  height: 0.55em;
  border-right: 2px solid var(--af-text-subtle);
  border-bottom: 2px solid var(--af-text-subtle);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}

.afp-details[open] > summary::before { transform: rotate(45deg); }

.afp-details[open] > summary { border-bottom: 1px solid var(--af-border-subtle); }

.afp-details-title {
  font-weight: 600;
  color: var(--af-text);
}

.afp-details-hint {
  color: var(--af-text-muted);
  font-size: var(--af-fs-sm);
}
