/* Shared accordion, Misc/Ops link rows, and the ← Admin page header.
   Hashed with the other sheets (scripts/build.mjs ensure: section →
   assets/section-<hash>.css), before monitor-extra and views-admin so
   those sheets' overrides still win. Dev, which has no such <link> yet,
   gets one link to this file from js/components/section.js before paint.
   Same measurements as the old .adm-section / .adm-sub-section rules. */

.adm-section, .adm-section-frame, .adm-section-actionbar { --adm-section-bw: 1px; }
.adm-section {
  background: var(--bg-card);
  border: var(--adm-section-bw) solid var(--border-subtle);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color 120ms ease;
}
.adm-section:focus-within { border-color: var(--border); }
.adm-section-summary {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; cursor: pointer; list-style: none; user-select: none;
}
.adm-section-summary::-webkit-details-marker, .adm-section-summary::marker { display: none; }
.adm-section-summary:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.adm-section-summary:focus-visible { outline: none; box-shadow: var(--ring-inset); }
.adm-section-title { font-size: 14px; font-weight: 600; line-height: inherit; color: var(--text-1); flex: 1; margin: 0; }
.adm-section-extra { display: flex; align-items: center; gap: 8px; }
.adm-chevron { font-size: 18px; color: var(--text-muted); transition: transform 180ms ease; line-height: 1; flex-shrink: 0; }
.adm-section[open] > summary .adm-chevron { transform: rotate(90deg); }
.adm-section-body { padding: var(--s4) 18px 18px; border-top: 1px solid var(--border-subtle); }
/* A top section with header actions: the <details> plus an action bar laid
   over its summary row, right of the title and its extra, left of the chevron. The
   buttons are not inside <summary> (no control inside the toggle). section.js
   measures the bar into --adm-actions-w/-h. */
.adm-section-frame { position: relative; min-width: 0; }
.adm-section-frame > .adm-section > .adm-section-summary { min-height: calc(var(--adm-actions-h, 0px) + 28px); }
/* The room for the bar is kept left of the chevron, not after the title: the
   title -> extra (counts, badges) -> chevron order puts the extra slot there. */
.adm-section-frame > .adm-section > .adm-section-summary .adm-chevron { margin-left: calc(var(--adm-actions-w, 0px) + var(--s3)); }
.adm-section-frame .adm-chevron { width: 12px; text-align: center; }
.adm-section-actionbar { position: absolute; top: 14px; right: calc(var(--adm-section-bw) + 18px + 12px + var(--s3)); display: flex; align-items: center; gap: var(--s2); }
.adm-section-actionbar .btn { flex-shrink: 0; }

/* Nested accordion. Summary text is the title alone (call sites rewrite
   textContent). The chevron is ::after so that rewrite does not remove it. */
.adm-sub-section {
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  margin: 10px 0;
  overflow: hidden;
}
.adm-sub-summary {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  cursor: pointer; list-style: none; user-select: none;
  font-size: 13px; font-weight: 600; color: var(--text-2);
  background: color-mix(in srgb, var(--bg-raised) 60%, transparent);
}
.adm-sub-summary::-webkit-details-marker, .adm-sub-summary::marker { display: none; }
.adm-sub-summary:hover { color: var(--text-1); background: color-mix(in srgb, var(--accent) 6%, transparent); }
/* The section clips its overflow, so the outset --ring would be cut off; the
   inset ring matches .adm-section-summary. */
.adm-sub-summary:focus-visible { outline: none; box-shadow: var(--ring-inset); }
.adm-sub-summary::after {
  content: '›';
  margin-left: auto;
  font-size: 16px;
  color: var(--text-muted);
  transition: transform 180ms ease;
  line-height: 1;
  flex-shrink: 0;
}
.adm-sub-section[open] > .adm-sub-summary::after { transform: rotate(90deg); }
/* Top padding matters: with 0 the first content row of every unfolded
   sub-panel collided with the header bar. */
.adm-sub-body { padding: 10px 14px 14px; overflow-x: auto; }

/* Misc/Ops destination. Same frame as a sub-section (border, radius, padding,
   tint, type) but the whole row is a link. */
.adm-link-item {
  display: flex; align-items: center; gap: 10px;
  margin: 10px 0;
  padding: 10px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--bg-raised) 60%, transparent);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.adm-link-item:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.adm-link-item:focus-visible { box-shadow: var(--ring-inset); outline: none; }
.adm-link-item-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.adm-link-item-title { font-size: 13px; font-weight: 600; color: var(--text-2); }
.adm-link-item-desc { font-size: 11px; color: var(--text-muted); line-height: 1.4; }
.adm-link-item--flash { animation: adm-link-flash 1.6s ease; }
@keyframes adm-link-flash {
  0% { background: color-mix(in srgb, var(--accent) 28%, transparent); box-shadow: inset 0 0 0 2px var(--accent); }
  100% { background: color-mix(in srgb, var(--bg-raised) 60%, transparent); box-shadow: inset 0 0 0 0 transparent; }
}
/* Reduced motion: the global block cuts the flash to nothing, so show the
   highlight statically for the time the class stays on (R6). */
@media (prefers-reduced-motion: reduce) {
  .adm-link-item--flash { animation: none; background: color-mix(in srgb, var(--accent) 16%, transparent); box-shadow: inset 0 0 0 2px var(--accent); }
}

/* ← Admin sits above the H1. Column, not a row, so the link is not beside the title.
   stretch (not flex-start) so a subtitle and a list appended into the header
   (Cost Studio provenance) take the column width and wrap at 390px. */
.page-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  width: 100%;
  min-width: 0;
}
.page-header-back {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-muted); text-decoration: none;
  line-height: 1.2;
}
.page-header-sub,
.page-header > ul {
  min-width: 0;
}
.page-header > ul { width: 100%; }
.page-header-back:hover { color: var(--accent-text); }
.page-header-sub { margin: 0; color: var(--text-muted); font-size: var(--fs-13); line-height: 1.45; }
/* Title row when the page passes `trailing` (a picker, a badge, actions). */
.page-header-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s3); flex-wrap: wrap; min-width: 0;
}
.page-header-row > .page-header-title { min-width: 0; overflow-wrap: anywhere; }
.page-header-trailing { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
