/* ── Admin report components (shared) ─────────────────────────────────────
   One set of building blocks for the Agency Oversight reports, so every tab
   speaks the same visual language: status pills, progress bars, number
   tiles, cards, chips and task rows. Built on the Hub's own tokens
   (css/styles.css :root) rather than a new palette.

   First used by the AI objectives view (js/agency-objectives.js). Other tabs
   can adopt these classes one at a time.

   Status colours deliberately reuse the Meeting Log's lanes (--ml-*), so
   "On track" here is the same green as "Going well" there, and "Waiting" the
   same amber as "Needs attention". "At risk" adds one stronger red-brown. */

:root {
  --st-good:  var(--ml-well,  #5F7355); --st-good-bg:  var(--ml-well-bg,  #EAEEE3); --st-good-line:  var(--ml-well-line,  #CAD6B9);
  --st-wait:  var(--ml-watch, #AE7538); --st-wait-bg:  var(--ml-watch-bg, #F4EBDB); --st-wait-line:  var(--ml-watch-line, #E4CFA4);
  --st-risk:  #A8442A;                  --st-risk-bg:  #F6E3DC;                     --st-risk-line:  #E8C3B6;
  --st-idle:  var(--c-stone, #8A8580);  --st-idle-bg:  var(--c-grey-light, #ECEAE5); --st-idle-line: var(--c-grey-mid, #DDD9D3);
}

/* ── Section label ("AI objectives", "Meeting log") ── */
.ar-section-label {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-family: var(--font-display); font-size: 11px; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase; color: var(--c-black);
  padding-bottom: 8px; margin: 0 0 14px; border-bottom: 1px solid var(--c-grey-mid);
}
.ar-section-label__meta { font-size: 12px; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--c-stone); }
.ar-section-gap { height: 36px; }

/* ── Status pill ── */
.ar-pill {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  font-size: 11px; font-weight: 700; line-height: 1; letter-spacing: .02em;
  padding: 5px 9px; border-radius: 999px;
  background: var(--st-idle-bg); color: var(--st-idle); border: 1px solid transparent;
}
.ar-pill--good { background: var(--st-good-bg); color: var(--st-good); }
.ar-pill--wait { background: var(--st-wait-bg); color: var(--st-wait); }
.ar-pill--risk { background: var(--st-risk-bg); color: var(--st-risk); }
.ar-pill--idle { background: transparent; color: var(--st-idle); border-color: var(--st-idle-line); }
.ar-pill--dark { background: var(--c-black); color: var(--c-white); }

/* ── Chip (themes, parked ideas, names) ── */
.ar-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ar-chip {
  display: inline-block; font-size: 11px; line-height: 1.3; white-space: nowrap;
  padding: 3px 9px; border-radius: 999px;
  background: var(--c-grey-light); color: #55524D;
}

/* ── Progress bar ── */
.ar-bar {
  position: relative; display: inline-block; vertical-align: middle;
  width: 96px; height: 8px; border-radius: 999px; overflow: hidden;
  background: var(--c-grey-light);
}
.ar-bar > i { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--c-black); }
.ar-bar--good > i { background: var(--st-good); }
.ar-bar--wait > i { background: var(--st-wait); }
.ar-bar--risk > i { background: var(--st-risk); }
.ar-bar--idle > i { background: var(--st-idle); }
.ar-bar--wide { width: 100%; height: 10px; }

/* ── Number tiles ── */
.ar-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.ar-kpi {
  background: var(--c-white); border: 1px solid var(--c-grey-mid); border-radius: var(--radius-md);
  padding: 12px 14px;
}
.ar-kpi__label { font-size: 10px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--c-stone); }
.ar-kpi__value {
  font-family: var(--font-display); font-size: 26px; font-weight: 700; line-height: 1.1;
  color: var(--c-black); margin-top: 4px; font-variant-numeric: tabular-nums;
}
.ar-kpi__value small { font-size: 13px; font-weight: 400; color: var(--c-stone); margin-left: 4px; }
.ar-kpi--risk .ar-kpi__value { color: var(--st-risk); }
.ar-kpi--zero .ar-kpi__value { color: var(--c-grey); }

/* ── Card ── */
.ar-card {
  background: var(--c-white); border: 1px solid var(--c-grey-mid); border-radius: var(--radius-md);
  padding: 16px 18px; margin-bottom: 12px;
}
.ar-card--note { background: var(--c-cream); border-color: var(--c-grey-mid); }
.ar-card__eyebrow {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 10px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--c-stone); margin-bottom: 8px;
}
.ar-card__text { font-size: 14px; line-height: 1.55; color: var(--c-black); }
.ar-card__meta { font-size: 12px; color: var(--c-stone); margin-top: 8px; line-height: 1.6; }
.ar-card__meta b { color: var(--c-black); font-weight: 600; }
.ar-stale { color: var(--st-risk); font-weight: 700; }

/* ── Header row (status chip + links) ── */
.ar-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-bottom: 14px; font-size: 13px; color: var(--c-stone);
}
.ar-head__left, .ar-head__right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ar-link {
  font-size: 12px; font-weight: 700; color: var(--c-black); text-decoration: none;
  border: 1px solid var(--c-grey-mid); border-radius: 999px; padding: 4px 10px; white-space: nowrap;
  transition: border-color var(--t-fast) var(--ease);
}
.ar-link:hover { border-color: var(--c-black); }

/* ── Expandable rows (objectives) ── */
.ar-rows { display: flex; flex-direction: column; gap: 8px; }
.ar-row { border: 1px solid var(--c-grey-mid); border-radius: var(--radius-md); background: var(--c-white); overflow: hidden; }
.ar-row__head {
  display: grid; grid-template-columns: 18px minmax(0, 1fr) auto auto; align-items: center; gap: 12px;
  width: 100%; padding: 13px 16px; text-align: left; cursor: pointer;
  background: none; border: 0; font: inherit; color: inherit;
}
.ar-row__head:hover { background: var(--c-cream); }
.ar-row__head:focus-visible { outline: 2px solid var(--c-black); outline-offset: -2px; }
.ar-row__caret { color: var(--c-stone); font-size: 13px; transition: transform var(--t-fast) var(--ease); }
.ar-row.is-open .ar-row__caret { transform: rotate(90deg); }
.ar-row__title { font-family: var(--font-display); font-size: 15px; font-weight: 700; color: var(--c-black); line-height: 1.3; }
.ar-row__num { color: var(--c-stone); font-weight: 400; margin-right: 6px; }
.ar-row__sub { display: block; font-family: var(--font-body); font-size: 12px; font-weight: 400; color: var(--c-stone); margin-top: 3px; }
.ar-row__progress { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--c-stone); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ar-row__body { display: none; padding: 4px 16px 16px 46px; border-top: 1px solid var(--c-grey-light); }
.ar-row.is-open .ar-row__body { display: block; }
.ar-row__body p { font-size: 14px; line-height: 1.55; color: #2B2A28; margin: 12px 0; max-width: 820px; }
.ar-meta-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 12px; color: var(--c-stone); margin-top: 12px; }
.ar-meta-line b { color: var(--c-black); font-weight: 600; }

/* ── Task list ── */
.ar-tasks { list-style: none; margin: 10px 0 0; padding: 0; }
.ar-task {
  display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 10px; align-items: start;
  padding: 9px 0; border-top: 1px solid var(--c-grey-light); font-size: 14px; line-height: 1.4;
}
.ar-task__box {
  width: 14px; height: 14px; margin-top: 2px; border-radius: 3px;
  border: 1.5px solid var(--c-black); background: var(--c-white);
  display: inline-flex; align-items: center; justify-content: center;
}
.ar-task.is-done .ar-task__box { background: var(--c-black); }
.ar-task.is-done .ar-task__box::after { content: ''; width: 7px; height: 4px; border: 2px solid var(--c-white); border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }
.ar-task.is-done .ar-task__step { text-decoration: line-through; color: var(--c-stone); }
.ar-task__who { display: block; font-size: 12px; color: var(--c-stone); margin-top: 2px; }
.ar-task__when { font-size: 12px; color: var(--c-stone); white-space: nowrap; text-align: right; }
.ar-task__when.is-late { color: var(--st-risk); font-weight: 700; }
.ar-empty { font-size: 13px; color: var(--c-stone); margin: 10px 0 0; }

/* ── Small controls ── */
.ar-toggle {
  font-size: 12px; font-weight: 700; color: var(--c-stone); background: none; border: 0; padding: 0;
  cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.ar-toggle:hover { color: var(--c-black); }
.ar-footnote { font-size: 12px; color: var(--c-stone); margin-top: 12px; line-height: 1.6; }
.ar-footnote a { color: var(--c-black); font-weight: 600; }

/* ── Status colours for rings, bars and swatches ──
   good / wait / risk / idle are the objective statuses; done = every task
   ticked; none = no status set yet. */
.ar-bar--done > i, .ar-bar--none > i { background: var(--c-black); }
.ar-bar--none > i { background: var(--st-idle); }
.ar-bar--fill { width: 100%; }
.ar-bar--big { height: 12px; }

.ar-ring { position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.ar-ring svg { position: absolute; inset: 0; }
.ar-ring__track { fill: none; stroke: var(--c-grey-light); }
.ar-ring__fill { fill: none; stroke: var(--c-black); stroke-linecap: round; }
.ar-ring--good .ar-ring__fill { stroke: var(--st-good); }
.ar-ring--wait .ar-ring__fill { stroke: var(--st-wait); }
.ar-ring--risk .ar-ring__fill { stroke: var(--st-risk); }
.ar-ring--idle .ar-ring__fill, .ar-ring--none .ar-ring__fill { stroke: var(--st-idle); }
.ar-ring__inner { position: relative; display: flex; flex-direction: column; align-items: center; line-height: 1.05; text-align: center; font-variant-numeric: tabular-nums; }
.ar-ring__inner b { font-family: var(--font-display); font-weight: 700; font-size: 15px; color: var(--c-black); }
.ar-ring__inner small { font-size: 11px; color: var(--c-stone); margin-top: 3px; }

.ar-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--c-black); margin-right: 6px; vertical-align: -1px; }
.ar-swatch--good { background: var(--st-good); }
.ar-swatch--wait { background: var(--st-wait); }
.ar-swatch--risk { background: var(--st-risk); }
.ar-swatch--idle { background: var(--st-idle); }
.ar-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 12px; color: #55524D; margin: -4px 0 16px; }
.ar-legend__note { color: var(--c-stone); }

/* ── Meeting view: headline row ── */
.ar-headline { display: grid; grid-template-columns: 180px repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 10px; }
.ar-tile {
  background: var(--c-white); border: 1px solid var(--c-grey-mid); border-radius: var(--radius-md);
  padding: 14px 16px; display: flex; flex-direction: column; justify-content: center; min-height: 120px;
}
.ar-tile--ring { align-items: center; }
.ar-tile--ring .ar-ring__inner b { font-size: 30px; }
.ar-tile__label { font-size: 10px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--c-stone); }
.ar-tile__value { font-family: var(--font-display); font-size: 40px; font-weight: 700; line-height: 1.05; color: var(--c-black); margin-top: 6px; font-variant-numeric: tabular-nums; }
.ar-tile__value small { font-size: 20px; font-weight: 400; color: var(--c-stone); margin-left: 2px; }
.ar-tile__sub { font-size: 12px; color: var(--c-stone); margin-top: 4px; }
.ar-tile--risk .ar-tile__value { color: var(--st-risk); }
.ar-tile--zero .ar-tile__value { color: var(--c-grey); }

/* ── Meeting view: one ring per objective ── */
.ar-objs {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px;
  margin-bottom: 10px;
}
.ar-obj {
  display: flex; align-items: center; gap: 14px;
  background: var(--c-white); border: 1px solid var(--c-grey-mid); border-radius: var(--radius-md); padding: 14px 16px;
}
.ar-obj__text { min-width: 0; }
.ar-obj__title { font-family: var(--font-display); font-size: 15px; font-weight: 700; line-height: 1.3; color: var(--c-black); }
.ar-obj__num { color: var(--c-stone); font-weight: 400; margin-right: 6px; }
.ar-obj__meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin-top: 8px; font-size: 12px; color: var(--c-stone); }

/* ── Panels (actions agreed, themes, goal cards) ── */
.ar-panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.ar-panel { background: var(--c-white); border: 1px solid var(--c-grey-mid); border-radius: var(--radius-md); padding: 14px 16px; }
.ar-panel__title { font-size: 10px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--c-stone); margin-bottom: 6px; }
.ar-panel__title span { letter-spacing: 0; text-transform: none; font-weight: 400; margin-left: 4px; }
.ar-actions { list-style: none; margin: 0; padding: 0; }
.ar-actions li { position: relative; padding: 8px 0 8px 20px; border-top: 1px solid var(--c-grey-light); font-size: 14px; line-height: 1.4; }
.ar-actions li:first-child { border-top: 0; }
.ar-actions li::before { content: ''; position: absolute; left: 2px; top: 13px; width: 8px; height: 8px; border-radius: 2px; border: 1.5px solid var(--c-black); }
.ar-actions li > span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.ar-more { font-size: 12px; color: var(--c-stone); margin: 6px 0 0 20px; }

.ar-hbars { list-style: none; margin: 0; padding: 0; }
.ar-hbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(70px, 38%) 44px; align-items: center; gap: 10px; padding: 6px 0; font-size: 13px; }
.ar-hbar__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ar-hbar__val { font-size: 12px; color: var(--c-stone); text-align: right; font-variant-numeric: tabular-nums; }

/* ── Detail fold (tasks, objective wording, parked ideas) ── */
.ar-fold { margin-top: 4px; }
.ar-fold > summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; color: var(--c-black); padding: 6px 0;
}
.ar-fold > summary::-webkit-details-marker { display: none; }
.ar-fold > summary::before { content: '\203A'; color: var(--c-stone); font-size: 14px; transition: transform var(--t-fast) var(--ease); }
.ar-fold[open] > summary::before { transform: rotate(90deg); }
.ar-rows-head { display: flex; justify-content: flex-end; margin: 4px 0 8px; }
.ar-fold .ar-row__head { grid-template-columns: 18px minmax(0, 1fr) auto; }
.ar-parked { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 12px; color: var(--c-stone); margin-top: 14px; }
.ar-parked b { color: var(--c-black); font-weight: 600; }
.ar-late-dot { display: none; }

/* ── AI team note: one line, note on request ── */
.ar-note { margin-bottom: 12px; font-size: 12px; color: var(--c-stone); }
.ar-note__line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.ar-note__body { margin-top: 8px; background: var(--c-cream); border: 1px solid var(--c-grey-mid); border-radius: var(--radius-md); padding: 12px 14px; }
.ar-note__body p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--c-black); }
.ar-note__body .ar-note__meta { margin-top: 6px; font-size: 12px; color: var(--c-stone); }
.ar-eng { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--c-black); }
.ar-eng::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--st-idle); }
.ar-eng--active::before { background: var(--st-good); }
.ar-eng--light::before { background: var(--st-wait); }

/* ── Present mode: the meeting view fills the screen; AI-team-only parts hide ── */
.ar-present-head { display: none; }
.ar-meeting.is-present {
  position: fixed; inset: 0; z-index: 2000; overflow: auto;
  background: var(--c-white); padding: 32px max(24px, 4vw) 48px;
}
.ar-meeting.is-present > * { max-width: 1280px; margin-left: auto; margin-right: auto; }
.ar-meeting.is-present .ar-present-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.ar-present-head__name { font-family: var(--font-display); font-size: clamp(28px, 3.4vw, 44px); font-weight: 700; line-height: 1.05; }
.ar-present-head__sub { font-size: 14px; color: var(--c-stone); margin-top: 6px; }
.ar-meeting.is-present .ar-ai-only,
.ar-meeting.is-present .ar-present-btn,
.ar-meeting.is-present .ar-ai-hide { display: none !important; }
.ar-meeting.is-present .ar-tile__value { font-size: 52px; }
.ar-meeting.is-present .ar-obj__title { font-size: 17px; }
.ar-meeting.is-present .ar-actions li, .ar-meeting.is-present .ar-hbar { font-size: 15px; }
.ar-meeting:fullscreen { background: var(--c-white); }
html.ar-presenting, html.ar-presenting body { overflow: hidden; }

/* ── Overview: group goal cards ── */
.ar-goals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ar-goal { background: var(--c-white); border: 1px solid var(--c-grey-mid); border-radius: var(--radius-md); padding: 16px 18px; }
.ar-goal__head { display: flex; align-items: center; gap: 16px; margin-bottom: 10px; }
.ar-goal__head .ar-ring__inner b { font-size: 19px; }
.ar-goal__title { font-family: var(--font-display); font-size: 17px; font-weight: 700; line-height: 1.25; color: var(--c-black); }
.ar-goal__due { font-size: 12px; color: var(--c-stone); margin-top: 4px; }

/* ── Overview: agencies by theme ── */
.ar-grid-wrap { overflow-x: auto; border: 1px solid var(--c-grey-mid); border-radius: var(--radius-md); background: var(--c-white); }
.ar-grid { width: 100%; border-collapse: collapse; font-size: 13px; }
.ar-grid th, .ar-grid td { padding: 10px 8px; border-top: 1px solid var(--c-grey-light); text-align: center; vertical-align: middle; }
.ar-grid .ar-grid__num--last { border-right: 1px solid var(--c-grey-mid); padding-right: 14px; }
.ar-grid thead th {
  border-top: 0; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--c-stone); line-height: 1.25; vertical-align: bottom;
}
.ar-grid__theme { min-width: 64px; max-width: 90px; }
.ar-grid__theme span { display: inline-block; max-width: 84px; white-space: normal; }
.ar-grid th.ar-grid__agency { text-align: left; white-space: nowrap; font-family: var(--font-display); font-size: 14px; font-weight: 700; color: var(--c-black); padding-left: 16px; }
.ar-grid thead th.ar-grid__agency { font-family: var(--font-body); font-size: 10px; color: var(--c-stone); }
.ar-grid__go { color: var(--c-stone); margin-left: 8px; transition: transform var(--t-fast) var(--ease); display: inline-block; }
.ar-grid tbody tr { cursor: pointer; }
.ar-grid tbody tr:hover { background: var(--c-cream); }
.ar-grid tbody tr:hover .ar-grid__go { transform: translateX(3px); color: var(--c-black); }
.ar-grid tbody tr:focus-visible { outline: 2px solid var(--c-black); outline-offset: -2px; }
.ar-grid__overall .ar-ring__inner b { font-size: 11px; }
.ar-grid__cell .ar-bar { width: 100%; max-width: 80px; }
.ar-grid__num { font-family: var(--font-display); font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ar-grid__num.is-zero { color: var(--c-grey); }
.ar-grid__num.is-late { color: var(--st-risk); }

@media (max-width: 900px) {
  .ar-headline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ar-tile--ring { grid-column: 1 / -1; }
  .ar-panels, .ar-goals { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  .ar-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ar-row__head { grid-template-columns: 14px minmax(0, 1fr); }
  .ar-row__head .ar-pill, .ar-row__progress { grid-column: 2; justify-self: start; }
  .ar-row__body { padding-left: 16px; }
  .ar-task { grid-template-columns: 18px minmax(0, 1fr); }
  .ar-task__when { grid-column: 2; text-align: left; }
  .ar-tile__value { font-size: 32px; }
  .ar-objs { grid-template-columns: minmax(0, 1fr); }
}

/* ── Meeting log: entries written from the Brain ──
   Copied in by the daily objectives sync after approval, so they are
   changed in the Brain, not edited here (js/admin-panel.js). */
.ml-src {
  font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap;
  color: var(--c-stone); border: 1px solid var(--c-grey-mid); border-radius: 999px; padding: 3px 8px;
}
.ml-src-note { font-size: 12px; color: var(--c-stone); }
