/* ============================================================================
   AppWorkloadPolicies — features.css
   All styling for the app. Extracted from the inline <style> block in
   index.html so the same rules can be reused across pages and cached
   independently by the browser.
   ============================================================================ */

/* ── Design Tokens ────────────────────────────────────────
   Palette inspired by the Blowfish Hugo theme used on
   https://michaeltheadmin.com — orange primary + warm neutral
   (Tailwind "orange" + "stone"). Dark only: one set of values, so a
   light theme later is just a second set.
────────────────────────────────────────────────────────── */
:root {
  color-scheme: dark;

  /* Brand — orange scale */
  --color-primary:         #FB923C; /* orange-400 */
  --color-primary-hover:   #FDBA74; /* orange-300 */
  --color-primary-soft:    #7C2D12; /* orange-900 */
  --color-primary-tint:    #2C1A0E; /* selected rows / items */
  --color-primary-ink:     #1C1917; /* text on a primary fill */
  --color-secondary:       #38BDF8; /* sky-400 — Available, Observed */
  --color-tertiary:        #78716C; /* stone-500 */

  /* Surfaces — stone, darkest first */
  --bg-chrome: #0C0A09;              /* top bar */
  --bg-page:   #100E0D;              /* page behind the panels */
  --bg-900:    #1C1917;              /* panels (stone-900) */
  --bg-800:    #292524;              /* cards, sidebar items (stone-800) */
  --bg-700:    #44403C;              /* inputs / table headers (stone-700) */
  --bg-hover:  #57534E;              /* hovers (stone-600) */
  --border:    #44403C;
  --border-subtle: #292524;

  --text-primary:   #FAFAF9;
  --text-secondary: #D6D3D1;
  --text-tertiary:  #A8A29E;

  --color-success: #22C55E;
  --color-warning: #F59E0B;
  --color-error:   #F87171;

  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  32px;

  /* Configurable via the Font popover (toolbar) */
  --policy-font-size:   12px;
  --policy-font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Configurable via the Row Height popover (toolbar) */
  --policy-row-height:  30px;
}

[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-900);
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ── App header ─────────────────────────────────────────── */
.app-header {
  background: var(--bg-800);
  border-bottom: 1px solid var(--border);
  padding: var(--space-sm) var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.brand { min-width: 0; }
.brand__label {
  color: var(--color-primary);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  line-height: 1.2;
}
.brand__title {
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
}
.toolbar-divider {
  width: 1px;
  height: 22px;
  background: var(--border);
  flex-shrink: 0;
}
.header-spacer { flex: 1; }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: none;
  border-radius: 6px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.btn--primary { background: var(--color-primary); color: var(--color-primary-ink); }
.btn--primary:hover { background: var(--color-primary-hover); }
.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn--ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--color-tertiary);
}

/* ── Main area ──────────────────────────────────────────── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Wrapper that stacks the viewer and the details panel vertically */
.workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* ── Drop zone ──────────────────────────────────────────── */
.drop-zone {
  position: absolute;
  inset: 0;
  z-index: 20;
  overflow: auto;
  background: var(--bg-page);
}

/* Ghost of the workspace behind the card */
.drop-zone__ghost {
  position: absolute;
  inset: 24px;
  display: flex;
  gap: 12px;
  opacity: 0.22;
  filter: blur(1.5px);
  pointer-events: none;
}
.ghost-col { flex: 1; display: flex; flex-direction: column; gap: 12px; }
.ghost-col--side { flex: 0 0 180px; padding: 16px; gap: 14px; }
.ghost-col--side,
.ghost-panel {
  border-radius: 12px;
  background: var(--bg-900);
  border: 1px solid var(--border-subtle);
}
.ghost-panel { flex: 1; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.ghost-panel--sheet { flex-direction: row; gap: 12px; }
.ghost-bar { display: block; height: 10px; width: 100%; border-radius: 4px; background: var(--bg-700); }
.ghost-bar--row { height: 14px; background: var(--bg-800); }
.ghost-bar--child { margin-left: 28px; }
.ghost-block { display: block; flex: 1; min-height: 44px; border-radius: 10px; background: var(--bg-800); }
.ghost-block--accent { flex: 0 0 44px; background: var(--color-primary-tint); }
.ghost-block--rail { flex: 0 0 260px; background: var(--bg-chrome); }
.ghost-col--side .ghost-block { flex: 0 0 44px; }

.drop-zone__stage {
  position: relative;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 40px 20px 28px;
}

.drop-card {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  padding: 40px 32px;
  border-radius: 20px;
  background: var(--bg-900);
  border: 2px dashed var(--border);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  text-align: center;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.drop-card__mark { color: var(--color-primary); }
.drop-card__title {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--text-primary);
}
.drop-card__title-over { display: none; }
.drop-card__desc {
  max-width: 520px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-secondary);
}
.drop-card__desc code {
  font-family: "Consolas", "Cascadia Code", monospace;
  font-size: 14px;
  color: var(--color-primary-hover);
}
.drop-zone__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.btn--lg {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: 14px;
}
.drop-card__where {
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}
.drop-card__label,
.drop-card__hint { font-size: 12px; color: var(--text-tertiary); }
.drop-card__path {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 12px;
  border-radius: 10px;
  background: var(--bg-chrome);
  border: 1px solid var(--border-subtle);
}
.drop-card__path code {
  flex: 1;
  min-width: 0;
  font-family: "Consolas", "Cascadia Code", monospace;
  font-size: 13px;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}
.drop-zone__privacy {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-tertiary);
}
.drop-zone__privacy svg { color: var(--color-success); }

/* Dragging a file over the page */
.drop-zone.drag-over .drop-card {
  background: var(--color-primary-tint);
  border-color: var(--color-primary);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--color-primary) 15%, transparent), 0 20px 60px rgba(0, 0, 0, 0.6);
}
.drop-zone.drag-over .drop-card__mark { color: var(--color-primary-hover); }
.drop-zone.drag-over .drop-card__title-idle { display: none; }
.drop-zone.drag-over .drop-card__title-over { display: inline; }

.drop-features {
  width: 100%;
  max-width: 1200px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}
.drop-feature {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  border-radius: 12px;
  background: var(--bg-900);
  border: 1px solid var(--border-subtle);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}
.drop-feature strong { font-size: 15px; color: var(--text-primary); }
.drop-feature__num {
  font-family: "Consolas", "Cascadia Code", monospace;
  font-size: 11px;
  color: var(--color-primary);
}

/* ── Viewer layout ──────────────────────────────────────── */
.viewer {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

/* ── Date panel (left sidebar) ──────────────────────────── */
.date-panel {
  width: 150px;
  min-width: 150px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-800);
  border-right: 1px solid var(--border);
  overflow: hidden;
  transition: width 0.18s ease, min-width 0.18s ease;
}
.date-panel__header {
  padding: var(--space-sm) var(--space-md);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}
.date-panel__title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.date-panel__count {
  font-size: 10px;
  font-weight: 600;
  background: var(--bg-700);
  color: var(--text-tertiary);
  padding: 1px 6px;
  border-radius: 12px;
}

/* Fully hidden sidebar */
.date-panel.is-collapsed {
  width: 0;
  min-width: 0;
  border-right-width: 0;
  overflow: hidden;
}

/* Toolbar sidebar toggle — orange accent so it stands out */
#sidebar-toggle-btn {
  color: var(--color-primary);
  border-color: var(--color-primary);
}
#sidebar-toggle-btn:hover {
  background: color-mix(in srgb, var(--color-primary) 15%, transparent);
  color: var(--color-primary);
  border-color: var(--color-primary);
}
#sidebar-toggle-btn[aria-pressed="true"] {
  background: var(--color-primary);
  color: var(--color-primary-ink);
  border-color: var(--color-primary);
}
#sidebar-toggle-btn[aria-pressed="true"]:hover {
  background: color-mix(in srgb, var(--color-primary) 85%, #000);
}
.date-panel__list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}
.date-panel__list::-webkit-scrollbar       { width: 6px; }
.date-panel__list::-webkit-scrollbar-track { background: var(--bg-800); }
.date-panel__list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.date-item {
  display: flex;
  flex-direction: column;
  padding: 9px var(--space-md);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
  transition: background 0.1s, border-color 0.1s;
  gap: 2px;
}
.date-item:hover { background: var(--bg-hover); }
.date-item.is-active {
  background: color-mix(in srgb, var(--color-primary) 10%, var(--bg-800));
  border-left-color: var(--color-primary);
}
.date-item__date {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}
.date-item__time {
  font-size: 11px;
  color: var(--text-secondary);
  font-family: "Consolas", "Cascadia Code", monospace;
}
.date-item__meta {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-top: 3px;
}
.date-item__badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  background: var(--bg-700);
  color: var(--text-secondary);
}
.date-item.is-active .date-item__badge {
  background: var(--color-primary);
  color: var(--color-primary-ink);
}
.date-item__meta-spacer { flex: 1; }
.date-item__copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  flex-shrink: 0;
}
.date-item__copy:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--color-tertiary);
}
.date-item__copy:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}
.date-item__copy.is-copied {
  color: var(--color-success);
  border-color: var(--color-success);
}
.date-item__copy svg { display: block; }
.date-item__file {
  font-size: 10px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

/* ── Policy panel (right) ───────────────────────────────── */
.policy-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}
/* ── Policy table ───────────────────────────────────────── */
.policy-table-wrap {
  flex: 1;
  overflow: auto;
  min-height: 0;
}
.policy-table-wrap:focus { outline: none; }
.policy-table-wrap:focus-visible { outline: 2px solid var(--color-primary); outline-offset: -2px; }
.policy-table-wrap::-webkit-scrollbar       { width: 12px; height: 12px; }
.policy-table-wrap::-webkit-scrollbar-track { background: var(--bg-900); }
.policy-table-wrap::-webkit-scrollbar-thumb { background: var(--color-primary); border-radius: 6px; border: 2px solid var(--bg-900); }
.policy-table-wrap::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--color-primary) 70%, transparent); }

.policy-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--policy-font-size);
  font-family: var(--policy-font-family);
  min-width: 960px;
}
.policy-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-700);
  border-bottom: 2px solid var(--border);
  padding: 6px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text-secondary);
  white-space: nowrap;
  -webkit-user-select: none;
  user-select: none;
}
.policy-table td {
  height: var(--policy-row-height);
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}
.policy-table tbody tr:hover td { background: var(--bg-hover); }
.policy-table td.col-name {
  color: var(--text-primary);
  font-weight: 500;
}
.policy-table td.col-id {
  font-family: "Consolas", "Cascadia Code", monospace;
  color: var(--text-tertiary);
  max-width: 320px;
}
.policy-table td.col-cmd {
  font-family: "Consolas", "Cascadia Code", monospace;
  max-width: 320px;
}
.policy-table td.col-rev {
  text-align: center;
  color: var(--text-tertiary);
}

/* ── Intent / Context badges ────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}
.badge--required     { background: color-mix(in srgb, var(--color-success)   18%, var(--bg-700)); color: var(--color-success);   }
.badge--available    { background: color-mix(in srgb, var(--color-secondary)  18%, var(--bg-700)); color: var(--color-secondary);  }
.badge--uninstall    { background: color-mix(in srgb, var(--color-error)      18%, var(--bg-700)); color: var(--color-error);      }
.badge--not-targeted { background: var(--bg-700); color: var(--text-tertiary); }
.badge--user         { background: color-mix(in srgb, var(--color-warning)   15%, var(--bg-700)); color: var(--color-warning);    }
.badge--system       { background: color-mix(in srgb, var(--color-secondary)  15%, var(--bg-700)); color: var(--color-secondary);  }

/* ── Empty state ────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  padding: var(--space-xl);
  color: var(--text-tertiary);
  font-size: 13px;
  height: 100%;
  text-align: center;
}
.empty-state svg { opacity: 0.3; }

/* ── Details panel (bottom) ─────────────────────────────── */
.details-panel {
  background: var(--bg-800);
  border-top: 2px solid var(--color-primary);
  display: flex;
  flex-direction: column;
  /* Default height scales with the viewport: ~45% of window height,
     clamped between 160px (very short windows) and 520px (large
     displays). Drag-resize / toggle still set inline height, but
     max-height keeps it within bounds when the window shrinks. */
  height: clamp(160px, 45vh, 520px);
  min-height: 80px;
  max-height: 70vh;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}
.dp-resize-handle {
  position: absolute;
  top: -3px;
  left: 0;
  right: 0;
  height: 6px;
  cursor: ns-resize;
  z-index: 10;
  border-radius: 3px;
  transition: background 0.15s;
}
.dp-resize-handle:hover,
.dp-resize-handle.is-dragging { background: var(--color-primary); opacity: 0.4; }

.dp-tabs {
  display: flex;
  align-items: stretch;
  background: var(--bg-900);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  min-height: 34px;
  gap: 0;
}
.dp-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.12s, border-color 0.12s;
}
.dp-tab:hover { color: var(--text-primary); }
.dp-tab.is-active {
  color: var(--text-primary);
  border-bottom-color: var(--color-primary);
}
.dp-tab:focus-visible { outline: 2px solid var(--color-primary); outline-offset: -2px; }
.dp-tabs__list {
  display: flex;
  align-items: stretch;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;                     /* Firefox */
  -ms-overflow-style: none;                  /* IE/Edge legacy */
  scroll-behavior: smooth;
}
.dp-tabs__list::-webkit-scrollbar { display: none; } /* WebKit */
.dp-tabs__list.is-scrollable { cursor: grab; }
.dp-tabs__list.is-scrollable:active { cursor: grabbing; }
.dp-tabs__spacer { flex: 1; }

.dp-tab-nav {
  display: none;
  align-items: center;
  justify-content: center;
  width: 24px;
  flex-shrink: 0;
  border: none;
  background: var(--bg-900);
  color: var(--color-primary);
  cursor: pointer;
  transition: color 0.12s, background 0.12s;
  position: relative;
  z-index: 1;
}
.dp-tab-nav.is-visible { display: inline-flex; }
.dp-tab-nav:hover { color: var(--color-primary-hover); background: var(--bg-hover); }
.dp-tab-nav:focus-visible { outline: 2px solid var(--color-primary); outline-offset: -2px; }
/* Subtle fade so tabs appear to slide behind the arrows */
.dp-tab-nav--left.is-visible {
  box-shadow: 6px 0 6px -4px color-mix(in srgb, var(--bg-900) 80%, transparent);
}
.dp-tab-nav--right.is-visible {
  box-shadow: -6px 0 6px -4px color-mix(in srgb, var(--bg-900) 80%, transparent);
}
.dp-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.dp-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.dp-close:focus-visible { outline: 2px solid var(--color-primary); outline-offset: -2px; }

.dp-body {
  flex: 1;
  overflow: auto;
  min-height: 0;
  padding: var(--space-md);
}
.dp-body::-webkit-scrollbar       { width: 8px; height: 8px; }
.dp-body::-webkit-scrollbar-track { background: var(--bg-800); }
.dp-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.dp-pane { display: none; }
.dp-pane.is-active { display: block; }

.dp-empty {
  color: var(--text-tertiary);
  font-size: 13px;
  text-align: center;
  padding: var(--space-xl);
}

/* ── General tab fields ─────────────────────────────────── */
.dp-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px 24px;
}
.dp-field--full { grid-column: 1 / -1; }
.dp-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.dp-fk {
  font-size: calc(var(--policy-font-size) - 2px);
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-tertiary);
}
.dp-fv {
  font-size: var(--policy-font-size);
  color: var(--text-primary);
  font-family: var(--policy-font-family);
  word-break: break-word;
  white-space: pre-wrap;
}
.dp-fv--app-name {
  font-family: var(--policy-font-family);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dp-fv-copy {
  display: inline-block;
  max-width: 100%;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: var(--text-primary);
  font: inherit;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dp-fv-copy--wrap {
  white-space: pre-wrap;
  word-break: break-word;
  overflow: visible;
}
.dp-fv-copy:hover { color: var(--color-secondary, #9ecbff); }
.dp-fv-copy.is-copied { color: var(--color-success, #4caf50); }
/* "Copied!" replaces the label without changing its width */
.dp-field.is-copied > .dp-fk {
  position: relative;
  color: transparent;
}
.dp-field.is-copied > .dp-fk::after {
  content: 'Copied!';
  position: absolute;
  left: 0;
  top: 0;
  white-space: nowrap;
  color: var(--color-success, #4caf50);
}
.dp-fv--signed   { color: var(--color-success); }
.dp-fv--unsigned { color: var(--color-warning); }
.dp-fv--missing  { color: var(--text-tertiary); font-style: italic; }

/* Program tab */
.dp-program__fields {
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 10px 16px;
  align-items: start;
  align-items: start;
}
.dp-program__fields .dp-field--full { grid-column: 1 / -1; }
.dp-program__cmd,
.dp-program__id {
  word-break: break-all;
}
.dp-program__sig {
  display: inline-block;
  margin-left: 10px;
  font-size: 11px;
  letter-spacing: 0.3px;
}
.dp-program__hint {
  margin-left: 6px;
  color: var(--text-tertiary);
  font-size: 11px;
}

/* Cert chain disclosure shown under the detection meta row */
.dp-sig-chain {
  margin: 0 0 var(--space-sm);
  font-size: var(--policy-font-size);
  color: var(--text-secondary);
}
.dp-sig-chain summary {
  cursor: pointer;
  color: var(--text-tertiary);
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  font-size: calc(var(--policy-font-size) - 1px);
  padding: 2px 0;
  -webkit-user-select: none;
  user-select: none;
}
.dp-sig-chain summary:hover { color: var(--text-secondary); }
.dp-sig-chain__items {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dp-sig-chain__cert {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 2px 10px;
  padding: 6px 10px;
  background: var(--bg-700, rgba(255, 255, 255, 0.03));
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
  border-radius: 4px;
}
.dp-sig-chain__cert--leaf {
  border-color: var(--color-success, #4caf50);
}
.dp-sig-chain__k {
  color: var(--text-tertiary);
  text-transform: uppercase;
  font-size: calc(var(--policy-font-size) - 2px);
  letter-spacing: 0.4px;
  align-self: center;
}
.dp-sig-chain__v,
.dp-sig-chain__copy {
  font-family: "Consolas", "Cascadia Code", ui-monospace, monospace;
  word-break: break-all;
  min-width: 0;
}
.dp-sig-chain__copy {
  cursor: pointer;
  background: none;
  border: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
  text-align: left;
}
.dp-sig-chain__copy:hover { color: var(--color-secondary, #9ecbff); }
.dp-sig-chain__copy.is-copied { color: var(--color-success, #4caf50); }

/* ── Detection tab ──────────────────────────────────────── */
.dp-detection-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-bottom: var(--space-sm);
  align-items: center;
}

/* Rule selector strip shown when an app has multiple detection methods */
.dp-rule-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: var(--space-sm);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border);
}
.dp-rule-tabs__label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-tertiary);
  align-self: center;
  margin-right: 4px;
}
.dp-rule-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.dp-rule-tab:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--color-tertiary);
}
.dp-rule-tab.is-active {
  background: color-mix(in srgb, var(--color-primary) 18%, var(--bg-700));
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.dp-rule-tab:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.dp-rule-tab__num {
  font-size: 10px;
  color: var(--text-tertiary);
  font-weight: 700;
}
.dp-rule-tab.is-active .dp-rule-tab__num { color: var(--color-primary); }

.dp-detection-script {
  background: var(--bg-900);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: var(--space-sm) var(--space-md);
  font-family: "Cascadia Code", "Consolas", "Fira Code", ui-monospace, monospace;
  font-size: var(--policy-font-size);
  color: var(--text-primary);
  white-space: pre;
  overflow: auto;
  max-height: 100%;
  line-height: 1.5;
}
/* Notes about a group of related apps (Dependencies / Supersedence) */
.dp-rule-notes {
  margin: 0 0 var(--space-sm);
  padding-left: 18px;
  color: var(--color-warning, #e0a800);
  font-size: var(--policy-font-size);
  line-height: 1.5;
}
.dp-rule-note + .dp-rule-note { margin-top: 2px; }
.dp-rule-raw { margin-top: var(--space-sm); }
.dp-rule-raw summary {
  cursor: pointer;
  color: var(--text-tertiary);
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  font-size: calc(var(--policy-font-size) - 1px);
  padding: 2px 0 6px;
  -webkit-user-select: none;
  user-select: none;
}
.dp-rule-raw summary:hover { color: var(--text-secondary); }

.dp-detection-script::-webkit-scrollbar       { width: 8px; height: 8px; }
.dp-detection-script::-webkit-scrollbar-track { background: var(--bg-800); }
.dp-detection-script::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.dp-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.dp-copy-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--color-tertiary);
}
.dp-copy-btn.is-copied { color: var(--color-success); border-color: var(--color-success); }

.dp-fk--with-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.dp-program__copy-cmd {
  text-transform: none;
  letter-spacing: 0;
}

/* ── Dependencies tab ───────────────────────────────────── */
.dp-deps-summary {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: var(--space-sm);
  font-size: 11px;
  color: var(--text-tertiary);
}
.dp-deps-summary__count {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.2px;
}
.dp-deps-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--policy-font-size);
  font-family: var(--policy-font-family);
}
.dp-deps-table th,
.dp-deps-table td {
  text-align: left;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.dp-deps-table th {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-tertiary);
  background: var(--bg-800);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.dp-deps-table tr:last-child td { border-bottom: none; }
.dp-deps-table td.dp-deps-table__num { text-align: right; color: var(--text-secondary); width: 1%; white-space: nowrap; }
.dp-deps-table td.dp-deps-table__level { text-align: center; color: var(--text-secondary); width: 1%; white-space: nowrap; }
.dp-dep-name { font-weight: 600; color: var(--text-primary); }
.dp-dep-name--missing { color: var(--text-tertiary); font-style: italic; font-weight: 400; }
.dp-dep-id {
  display: block;
  margin-top: 1px;
  font-family: "Consolas", "Cascadia Code", ui-monospace, monospace;
  color: var(--text-tertiary);
  font-size: calc(var(--policy-font-size) - 1px);
}
.dp-dep-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}
.dp-dep-badge--dependency  { background: color-mix(in srgb, var(--color-primary) 18%, var(--bg-700));   color: var(--color-primary); }
.dp-dep-badge--supersedes  { background: color-mix(in srgb, var(--color-warning) 18%, var(--bg-700));   color: var(--color-warning); }
.dp-dep-badge--detect      { background: color-mix(in srgb, var(--color-secondary) 18%, var(--bg-700)); color: var(--color-secondary); }
.dp-dep-badge--install     { background: color-mix(in srgb, var(--color-success) 14%, var(--bg-700));   color: var(--color-success); }
.dp-dep-badge--uninstall   { background: color-mix(in srgb, var(--color-error)  14%, var(--bg-700));    color: var(--color-error);  }
.dp-dep-badge--update      { background: color-mix(in srgb, var(--color-secondary) 18%, var(--bg-700)); color: var(--color-secondary); }
.dp-dep-badge--replace     { background: color-mix(in srgb, var(--color-warning) 18%, var(--bg-700));   color: var(--color-warning); }
.dp-dep-badge--unknown     { background: var(--bg-700); color: var(--text-secondary); }

/* Resolved chain (transitive walk over per-app FlatDependencies) */
.dp-dep-chain {
  margin-top: var(--space-md);
  border-top: 1px dashed var(--border);
  padding-top: var(--space-sm);
}
.dp-dep-chain summary {
  cursor: pointer;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 0;
  -webkit-user-select: none;
  user-select: none;
}
.dp-dep-chain summary:hover { color: var(--text-secondary); }
.dp-dep-chain__hint {
  margin: 4px 0 8px;
  font-size: 11px;
  color: var(--text-tertiary);
}
.dp-dep-chain__list {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
}
.dp-dep-chain__list .dp-dep-chain__list {
  margin: 4px 0 0 8px;
  padding-left: 14px;
  border-left: 1px solid var(--border);
}
.dp-dep-chain__node { padding: 3px 0; }
.dp-dep-chain__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: var(--policy-font-size);
  font-family: var(--policy-font-family);
}
.dp-dep-chain__row .dp-dep-id { display: inline; margin-top: 0; }
.dp-dep-chain__cycle {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 700;
  color: var(--color-warning);
  padding: 1px 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-warning) 14%, var(--bg-700));
}
.dp-dep-chain__truncated {
  margin: 6px 0 0;
  font-size: 11px;
  color: var(--color-warning);
}

/* ── Return Codes tab ───────────────────────────────────── */
/* Reuses .dp-deps-table layout; only the type-badge colors change. */
.dp-rc-badge--success     { background: color-mix(in srgb, var(--color-success)   14%, var(--bg-700)); color: var(--color-success);   }
.dp-rc-badge--soft-reboot { background: color-mix(in srgb, var(--color-secondary) 18%, var(--bg-700)); color: var(--color-secondary); }
.dp-rc-badge--hard-reboot { background: color-mix(in srgb, var(--color-warning)   18%, var(--bg-700)); color: var(--color-warning);   }
.dp-rc-badge--retry       { background: color-mix(in srgb, var(--color-tertiary)  18%, var(--bg-700)); color: var(--color-tertiary);  }
.dp-rc-badge--failure     { background: color-mix(in srgb, var(--color-error)     14%, var(--bg-700)); color: var(--color-error);     }
.dp-rc-code {
  font-family: "Consolas", "Cascadia Code", ui-monospace, monospace;
  font-weight: 600;
  color: var(--text-primary);
}
.dp-rc-code-hex {
  margin-left: 8px;
  color: var(--text-tertiary);
  font-family: "Consolas", "Cascadia Code", ui-monospace, monospace;
  font-weight: 400;
  font-size: calc(var(--policy-font-size) - 1px);
}
/* Highlight the selected row in the policy table */
.policy-table tbody tr.is-selected td { background: color-mix(in srgb, var(--color-secondary) 14%, var(--bg-800)); }
.policy-table tbody tr.is-selected:hover td { background: color-mix(in srgb, var(--color-secondary) 22%, var(--bg-800)); }
.policy-table tbody tr { cursor: pointer; }

/* ── Modal (shared: dim + blur backdrop, centered card) ─── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: min(15vh, 120px) 16px 16px;
  animation: modal-fade-in 0.12s ease-out;
}
.modal-backdrop[hidden] { display: none !important; }

@keyframes modal-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes modal-pop {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal {
  background: var(--bg-800);
  border: 1px solid var(--border);
  border-radius: 12px;
  min-width: 260px;
  max-width: min(540px, 90vw);
  width: max-content;
  /* Keep the modal within the backdrop's content area (its top padding + 16px bottom).
     dvh accounts for mobile browser chrome; vh is the fallback. */
  max-height: calc(100vh - min(15vh, 120px) - 16px);
  max-height: calc(100dvh - min(15vh, 120px) - 16px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-pop 0.14s ease-out;
}
.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 8px 10px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal__title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--text-primary);
  margin: 0;
}
.modal__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-tertiary);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.modal__close:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal__close:focus-visible { outline: 2px solid var(--color-primary); outline-offset: -2px; }
.modal__body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  min-height: 0;
  overscroll-behavior: contain;
}
.modal__footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── Settings modal sections ────────────────────────────── */
.modal__section + .modal__section {
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
}
.modal__section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 var(--space-md) 0;
  letter-spacing: 0.2px;
}

/* ── Columns picker ─────────────────────────────────────── */
.cols-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cols-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  white-space: nowrap;
}
.cols-item input[type="checkbox"] {
  accent-color: var(--color-primary);
  cursor: pointer;
}
.policy-table th[draggable="true"] { cursor: grab; }
.policy-table th[draggable="true"]:hover { color: var(--text-primary); }
.policy-table th.col-dragging { opacity: 0.35; }
.policy-table th.col-drag-over { border-bottom: 2px solid var(--color-primary); }

/* ── Font / Row-height toolbar button ───────────────────── */
.font-btn-wrap { position: relative; flex-shrink: 0; }
.font-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.font-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--color-tertiary);
}
.font-btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.font-popover__label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.font-popover__label--mt { margin-top: 10px; }
.font-stepper {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-700);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.font-size-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 28px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  transition: background 0.12s, color 0.12s;
  flex-shrink: 0;
}
.font-size-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.font-size-btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: -2px; }
.font-size-btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.font-size-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 28px;
  text-align: center;
  -webkit-user-select: none;
  user-select: none;
}
.font-family-select {
  width: 100%;
  background: var(--bg-700);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 11px;
  padding: 4px 6px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.12s;
}
.font-family-select:focus { border-color: var(--color-primary); }

/* ── Filter input (toolbar) ─────────────────────────────── */
.filter-btn-wrap { position: relative; flex-shrink: 0; }
.filter-btn { position: relative; }
.filter-btn--active {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.filter-btn__badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--color-primary);
  color: var(--color-primary-ink);
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  box-sizing: border-box;
  pointer-events: none;
}
.filter-btn__badge[hidden] { display: none; }

.filter-wrap {
  flex: 1;
  min-width: 140px;
  max-width: 380px;
  position: relative;
}
.filter-input {
  width: 100%;
  background: var(--bg-700);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12px;
  padding: 6px 10px;
  outline: none;
  transition: border-color 0.12s;
}
.filter-input::placeholder { color: var(--text-tertiary); }
.filter-input:focus { border-color: var(--color-primary); }

/* ── Hidden file input ──────────────────────────────────── */
#file-input { display: none; }

/* ── Overflow menu action buttons (mobile) ────────────── */
.overflow-btn-wrap { position: relative; flex-shrink: 0; }
.actions-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.actions-btn + .actions-btn { margin-top: 6px; }
.actions-btn:hover {
  background: var(--bg-hover);
  border-color: var(--color-tertiary);
}
.actions-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.actions-btn svg { flex-shrink: 0; color: var(--text-secondary); }
.actions-btn--danger:hover {
  border-color: #b91c1c;
  color: #fecaca;
}
.actions-btn--danger:hover svg { color: #fecaca; }

/* ── Mobile-only filter search inside Filters modal ───── */
.filters-search { margin-bottom: var(--space-md); }
.filters-search .filter-input { width: 100%; box-sizing: border-box; }

/* ── Responsive utilities ─────────────────────────────── */
/* Two-tier progressive collapse:
     md-down (≤ 720px) — filter textbox collapses into the Filters modal.
     sm-down (≤ 550px) — toolbar wraps to two rows; view controls (sidebar toggle, filter, settings) drop below actions. */
.show-md-down { display: none !important; }
.show-sm-down { display: none !important; }

@media (max-width: 720px) {
  .hide-md-down { display: none !important; }
  .show-md-down { display: revert !important; }
  .app-header {
    flex-wrap: nowrap;
    gap: 6px;
    padding: var(--space-sm) var(--space-md);
  }
  .brand__title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .toolbar-divider { height: 20px; }
}

@media (max-width: 550px) {
  .hide-sm-down { display: none !important; }
  .show-sm-down { display: revert !important; }

  /* Two-row toolbar.
     Row 1: brand + Open/Paste/Clear.
     Row 2: sidebar toggle (leftmost) + filter input + filter button + settings. */
  .app-header { flex-wrap: wrap; row-gap: 6px; }
  .toolbar-row-break { display: block; flex-basis: 100%; height: 0; margin: 0; }

  /* Row 1 now has room — restore the action buttons */
  #btn-open.hide-sm-down,
  #btn-paste.hide-sm-down,
  #btn-clear.hide-sm-down { display: inline-flex !important; }

  /* Kebab overflow is redundant with two rows */
  .overflow-btn-wrap.show-sm-down { display: none !important; }

  /* Bring the filter input back — row 2 gives it plenty of room */
  .filter-wrap.hide-md-down { display: block !important; }

  /* Drop the divider that would otherwise trail at end of row 1 */
  .app-header > .toolbar-divider:first-of-type { display: none; }
}

/* ── Explainer panel ──────────────────────────────────────────
   Opens from a field label, table header or tagged cell and shows the
   field's catalog entry (fields.js): meaning, raw value, values, sources. */
[data-field] > .dp-fk,
th[data-field] {
  cursor: help;
}
[data-field] > .dp-fk::after,
th[data-field]::after {
  content: "ⓘ";
  margin-left: 4px;
  font-size: 0.95em;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-tertiary);
  opacity: 0.55;
  transition: opacity 0.12s, color 0.12s;
}
[data-field] > .dp-fk:hover,
th[data-field]:hover {
  color: var(--color-primary);
}
[data-field] > .dp-fk:hover::after,
th[data-field]:hover::after,
.is-explained > .dp-fk::after,
th.is-explained::after {
  opacity: 1;
  color: var(--color-primary);
}
[data-field] > .dp-fk:focus-visible,
th[data-field]:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 3px;
}
td[data-field] { cursor: help; }
.is-explained > .dp-fk,
th.is-explained { color: var(--color-primary); }
td.is-explained {
  background: color-mix(in srgb, var(--color-primary) 10%, transparent);
}

.explainer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 90; /* below modals (100) */
  width: min(440px, 100vw);
  background: var(--bg-800);
  border-left: 1px solid var(--border);
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  animation: explainer-in 0.16s ease-out;
}
@keyframes explainer-in {
  from { transform: translateX(16px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .explainer { animation: none; }
}
.explainer__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 8px 12px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.explainer__heading { min-width: 0; }
.explainer__eyebrow {
  font-size: 11px;
  color: var(--text-tertiary);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  word-break: break-all;
}
.explainer__title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}
.explainer__body {
  padding: 16px 18px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  font-size: 13px;
  line-height: 1.55;
}
.explainer__what {
  font-size: 14px;
  color: var(--text-primary);
}
.explainer__section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.explainer__h {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-tertiary);
}
.explainer__muted { color: var(--text-tertiary); font-style: italic; }
.explainer__kv {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.explainer__kv > span {
  font-size: 11px;
  color: var(--text-tertiary);
}
.explainer__kv > span em {
  font-style: normal;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
.explainer__kv--inline {
  flex-direction: row;
  align-items: baseline;
  gap: 8px;
}
.explainer code,
.explainer pre {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  color: var(--text-primary);
}
.explainer__kv > code,
.explainer pre {
  background: var(--bg-700);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  white-space: pre-wrap;
  word-break: break-word;
}
.explainer__values {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.explainer__values th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  padding: 4px 6px;
  border-bottom: 1px solid var(--border);
}
.explainer__values td {
  padding: 5px 6px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
  color: var(--text-secondary);
  vertical-align: top;
}
.explainer__values tr.is-current td {
  background: color-mix(in srgb, var(--color-primary) 12%, transparent);
  color: var(--text-primary);
  font-weight: 600;
}
.explainer__sources {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.explainer__sources li {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding-left: 10px;
  border-left: 2px solid var(--border);
}
.explainer__sources p { color: var(--text-primary); }
.explainer blockquote {
  margin: 2px 0;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--bg-700);
  color: var(--text-secondary);
  font-style: italic;
}
.explainer a {
  color: var(--color-secondary);
  text-decoration: none;
  font-size: 12px;
}
.explainer a:hover { text-decoration: underline; }
.explainer__list { padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.explainer__doc {
  font-size: 12px;
  color: var(--text-tertiary);
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.tier-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
  vertical-align: middle;
}
.tier-badge--documented   { background: color-mix(in srgb, var(--color-success) 16%, var(--bg-700));   color: var(--color-success); }
.tier-badge--observed     { background: color-mix(in srgb, var(--color-secondary) 18%, var(--bg-700)); color: var(--color-secondary); }
.tier-badge--undocumented { background: color-mix(in srgb, var(--color-warning) 18%, var(--bg-700));   color: var(--color-warning); }

@media (max-width: 720px) {
  .explainer {
    top: auto;
    width: 100vw;
    height: min(75vh, 640px);
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3);
  }
  @keyframes explainer-in {
    from { transform: translateY(16px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
  }
}

/* Keep the "Copied!" flash (it reuses .dp-fk::after) looking as before. */
.dp-field.is-copied[data-field] > .dp-fk::after {
  margin-left: 0;
  font-size: inherit;
  font-weight: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  opacity: 1;
  color: var(--color-success, #4caf50);
}

/* ── Policy Lens shell ────────────────────────────────────────
   Dark chrome, snapshot timeline, and the nested app table. */
body { background: var(--bg-page); }

.app-header {
  background: var(--bg-chrome);
  border-bottom: 1px solid var(--border-subtle);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand__mark {
  flex-shrink: 0;
  color: var(--color-primary);
}
.brand__text { min-width: 0; }

.filter-wrap__icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
}
.filter-wrap .filter-input {
  padding-left: 30px;
  background: var(--bg-800);
}

/* Nested / Flat */
.view-switch {
  display: inline-flex;
  padding: 2px;
  border-radius: 8px;
  background: var(--bg-800);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.view-switch__btn {
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  min-height: 26px;
  border-radius: 6px;
  cursor: pointer;
}
.view-switch__btn:hover { color: var(--text-primary); }
.view-switch__btn[aria-pressed="true"] {
  background: var(--color-primary);
  color: var(--color-primary-ink);
}
.view-switch__btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* Panels float on the page */
.workspace {
  padding: 10px;
  gap: 10px;
}
.viewer { gap: 10px; }
.date-panel,
.policy-panel {
  background: var(--bg-900);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
}
.date-panel { width: 184px; min-width: 184px; }
.date-item__badge { white-space: nowrap; }
.date-panel.is-collapsed { border-width: 0; }
.date-panel__header { border-bottom: none; padding-bottom: 0; }
.date-panel__hint {
  padding: 2px var(--space-md) 8px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-tertiary);
}
.details-panel {
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  border-top: 2px solid var(--color-primary);
}

/* Snapshot timeline: a line through one dot per snapshot */
.date-panel__list { position: relative; padding: 2px 0 8px; }
.date-item {
  position: relative;
  border-bottom: none;
  border-left: none;
  padding: 8px var(--space-md) 8px 34px;
  margin: 0 6px;
  border-radius: 8px;
}
.date-item::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.date-item:first-child::before { top: 14px; }
.date-item:last-child::before  { bottom: calc(100% - 22px); }
.date-item:only-child::before  { display: none; }
.date-item__dot {
  position: absolute;
  left: 10px;
  top: 12px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg-900);
  border: 2px solid var(--text-tertiary);
}
.date-item.is-active {
  background: var(--color-primary-tint);
}
.date-item.is-active .date-item__dot {
  background: var(--color-primary);
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}
.date-item__diff {
  font-family: "Consolas", "Cascadia Code", monospace;
  font-size: 11px;
  color: var(--text-tertiary);
}
.date-item__diff--up   { color: var(--color-success); }
.date-item__diff--down { color: var(--color-warning); }

/* Nested app table */
.policy-table td.col-name { max-width: 460px; }
.name-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.name-cell__text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tree-guide {
  font-family: "Consolas", "Cascadia Code", monospace;
  color: var(--text-tertiary);
  white-space: pre;
  flex-shrink: 0;
}
.tree-toggle {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 5px;
  background: var(--bg-800);
  color: var(--text-secondary);
  font-size: 10px;
  cursor: pointer;
}
.tree-toggle:hover { background: var(--bg-700); color: var(--text-primary); }
.tree-toggle:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 1px; }
.tree-spacer { width: 20px; flex-shrink: 0; }
.rel-tag {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
}
.rel-tag--installs,
.rel-tag--updates   { background: color-mix(in srgb, var(--color-success) 16%, var(--bg-900)); color: var(--color-success); }
.rel-tag--must-exist,
.rel-tag--replaces  { background: color-mix(in srgb, var(--color-warning) 16%, var(--bg-900)); color: var(--color-warning); }
.rel-tag--related   { background: var(--bg-800); color: var(--text-secondary); }
.policy-table tbody tr.is-child td { color: var(--text-secondary); }
.policy-table tbody tr.is-child td.col-name { font-weight: 400; }

/* An app can have several rows: all are marked, the current one most. */
.policy-table tbody tr.is-selected td { background: color-mix(in srgb, var(--color-primary) 8%, var(--bg-900)); }
.policy-table tbody tr.is-current td  { background: var(--color-primary-tint); }
.policy-table tbody tr.is-current td:first-child { box-shadow: inset 3px 0 0 var(--color-primary); }

.policy-panel__note {
  flex-shrink: 0;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--text-tertiary);
  border-top: 1px solid var(--border-subtle);
}

/* ── Details sheet ────────────────────────────────────────────
   The bottom panel as a raised sheet: app title + segmented tabs, field
   cards on the left, the explainer docked on the right. */
.details-panel {
  background: var(--bg-900);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
}
.dp-tabs {
  background: var(--bg-900);
  border-bottom: 1px solid var(--border-subtle);
  align-items: center;
  gap: 12px;
  padding: 8px 10px 8px 16px;
  min-height: 52px;
}
.dp-title {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 0 1 340px;
  line-height: 1.25;
}
.dp-title__name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dp-title__id {
  font-family: "Consolas", "Cascadia Code", monospace;
  font-size: 11px;
  color: var(--text-tertiary);
}
.dp-tabs__list {
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: var(--bg-800);
}
.dp-tab {
  border-bottom: none;
  border-radius: 8px;
  padding: 6px 12px;
  min-height: 30px;
  color: var(--text-tertiary);
}
.dp-tab.is-active {
  background: var(--bg-700);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.dp-close[aria-pressed="true"] { color: var(--color-primary); }

.dp-main {
  flex: 1;
  min-height: 0;
  display: flex;
}
.dp-main > .dp-body {
  flex: 1;
  min-width: 0;
}

/* Cards and tiles (General groups fields into cards; the other tabs'
   field groups get the same look). */
.dp-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
  align-items: start;
}
.dp-card,
.dp-body .dp-pane > div > .dp-fields,
.dp-body .dp-detection-meta {
  background: var(--bg-800);
  border-radius: 12px;
  padding: 12px;
}
.dp-card__title {
  margin: 0 0 8px 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.dp-card__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}
.dp-card__grid .dp-field--full { grid-column: 1 / -1; }
.dp-body .dp-fields { gap: 4px; }
.dp-body .dp-detection-meta { gap: 4px; }
.dp-body .dp-field {
  background: var(--bg-900);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  min-height: 44px;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.dp-body .dp-field[data-field] { cursor: pointer; }
.dp-body .dp-field[data-field]:hover { border-color: var(--text-tertiary); }
.dp-body .dp-field.is-explained {
  border-color: var(--color-primary);
  box-shadow: inset 0 0 0 1px var(--color-primary);
}
.dp-body .dp-fk {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  font-size: 11px;
}
.dp-body .dp-field[data-field]:not(.is-copied) > .dp-fk::after { content: none; }
.dp-body .is-explained > .dp-fk { color: var(--color-primary); }

/* Explainer docked in the sheet on wide screens */
@media (min-width: 1000px) {
  .dp-main > .explainer.is-docked {
    position: static;
    width: 360px;
    flex-shrink: 0;
    border-left: 1px solid var(--border-subtle);
    border-radius: 0;
    box-shadow: none;
    background: var(--bg-900);
    animation: none;
    z-index: auto;
  }
  .explainer.is-docked .explainer__header { padding-top: 12px; }
}
.explainer__placeholder {
  color: var(--text-tertiary);
  font-size: 13px;
  line-height: 1.55;
}

/* Maximized: the sheet fills the workspace and the table steps aside. */
.workspace.is-details-max .viewer { display: none; }
.workspace.is-details-max .details-panel {
  flex: 1;
  height: auto !important;
  max-height: none;
}
.workspace.is-details-max .dp-resize-handle { display: none; }

/* Program: type next to its command (spanning 3), then the settings 4 across */
.dp-body .dp-program__fields {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.dp-body .dp-program__fields > .dp-field--full { grid-column: span 1; }
.dp-body .dp-program__fields > .dp-field:nth-child(2),
.dp-body .dp-program__fields > .dp-field:nth-child(4) { grid-column: span 3; }
@media (max-width: 900px) {
  .dp-body .dp-program__fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dp-body .dp-program__fields > .dp-field:nth-child(2),
  .dp-body .dp-program__fields > .dp-field:nth-child(4) { grid-column: span 1; }
}

/* The docked rail's × only clears a picked field */
.explainer.is-docked:not(.has-field) #explainer-close { visibility: hidden; }

/* ── Raw tab: annotated policy ────────────────────────────────
   Each top-level key's JSON (and the JSON parsed out of it) beside the
   catalog fields that read it. */
.raw-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.raw-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.raw-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 8px;
  border-radius: 12px;
  background: var(--bg-800);
  transition: box-shadow 0.2s, background 0.2s;
}
.raw-row.is-target {
  background: var(--color-primary-tint);
  box-shadow: inset 0 0 0 2px var(--color-primary);
}
.raw-row__code {
  flex: 3 1 420px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.raw-code {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg-chrome);
  color: var(--text-primary);
  font-family: "Consolas", "Cascadia Code", monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 320px;
  overflow: auto;
}
.raw-code--layer {
  margin-left: 14px;
  border: 1px solid var(--border);
}
.raw-layer__label {
  margin-left: 14px;
  font-size: 11px;
  color: var(--text-tertiary);
}
.raw-row__notes {
  flex: 2 1 260px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.raw-note {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-900);
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.raw-note:hover { border-color: var(--text-tertiary); }
.raw-note:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.raw-note.is-explained {
  border-color: var(--color-primary);
  box-shadow: inset 0 0 0 1px var(--color-primary);
}
.raw-note__label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.raw-note__what {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.explainer__jump {
  align-self: flex-start;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  min-height: 32px;
  background: var(--color-primary-tint);
  color: var(--color-primary-hover);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.explainer__jump:hover { background: var(--color-primary-soft); color: var(--text-primary); }
.explainer__jump:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* Keys that feed many fields (DetectionRule, InstallEx …): compact chips */
.raw-row__notes--compact {
  flex-direction: row;
  flex-wrap: wrap;
  align-content: flex-start;
}
.raw-row__notes--compact .raw-note { padding: 6px 8px; }
.raw-row__notes--compact .raw-note__what { display: none; }
.raw-row__notes--compact .raw-note__label { font-size: 12px; }
