/* Admin › Hub pages: Change Log (#changelog) and Roadmap (#roadmap). Colours come from styles.css's tokens, so light and
   dark mode follow; area colours come from the nav map (nav-rules.js) as --c. */

/* ---------- shared ---------- */
.hub-kpis3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.hub-kpis4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.hub-filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
.hub-filters .search input { min-width: 170px; }
.hub-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--muted)); flex: none; }
.hub-dots { display: inline-flex; gap: 4px; align-items: center; }
.hub-empty { text-align: center; color: var(--muted); padding: 32px; }
.hub-version code, .rm-chip code { font-size: 12px; }
.hub-grow { flex: 1; }
.hub-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }

/* Type and status pills. */
.hub-type { display: inline-block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 2px 8px; border-radius: 99px; background: var(--grey-soft); color: var(--ink-2); white-space: nowrap; }
.hub-type.new, .hub-type.st-building { background: var(--pma-blue-soft); color: var(--pma-blue-ink); }
.hub-type.improved, .hub-type.st-brief { background: var(--violet-soft); color: var(--violet); }
.hub-type.fixed, .hub-type.st-planned { background: var(--amber-soft); color: var(--amber); }
.hub-type.security { background: var(--red-soft); color: var(--red); }
.hub-type.note { background: transparent; color: var(--muted); border: 1px dashed var(--line); }
.hub-type.st-done { background: var(--green-soft); color: var(--green); }
.hub-type-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.hub-type-dot.new { background: var(--pma-blue); } .hub-type-dot.improved { background: var(--violet); } .hub-type-dot.fixed { background: var(--amber); } .hub-type-dot.security { background: var(--red); }

/* The Change Log link's "new since your last visit" dot in the sidebar. */
.nav-dot { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--orange); flex: none; }

/* ---------- Change Log ---------- */
.chl-week { display: grid; gap: 8px; }
.chl-wk { font-size: 14px; color: var(--muted); }
.chl-entries { padding: 0; }
.chl-entry { padding: 14px 20px; border-bottom: 1px solid var(--line-2); min-width: 0; }
.chl-entry:last-child { border-bottom: 0; }
.chl-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.chl-new { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #fff; background: var(--orange); padding: 1px 7px; border-radius: 4px; }
.chl-title { font: 700 15px/1.35 var(--font); text-transform: none; letter-spacing: 0; margin: 6px 0 2px; overflow-wrap: anywhere; }
.chl-sum { margin: 0; color: var(--ink-2); overflow-wrap: anywhere; }
.chl-details { margin-top: 6px; font-size: 13px; color: var(--ink-2); }
.chl-details summary { cursor: pointer; color: var(--pma-blue); font-weight: 600; font-size: 12px; }
.chl-details ul { margin: 6px 0 0; padding-left: 18px; }
.chl-links { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 8px 0 0; font-size: 12.5px; font-weight: 600; }
.chl-links a { text-decoration: none; }
.chl-links a:hover { text-decoration: underline; }

/* ---------- Roadmap ---------- */
.rm-tabs { justify-self: start; display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); }
.rm-tabs button { border: 0; background: transparent; padding: 6px 14px; font: 600 12px var(--font); color: var(--muted); cursor: pointer; }
.rm-tabs button + button { border-left: 1px solid var(--line); }
.rm-tabs button[aria-selected="true"] { background: var(--ink); color: var(--panel); }

.rm-board { display: grid; grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr)); gap: 12px; align-items: start; }
.rm-board:has(> :nth-child(6)) { --cols: 6; }
.rm-col { background: var(--line-2); border-radius: var(--radius); padding: 10px; min-width: 0; display: grid; gap: 8px; }
.rm-col-h { font-size: 14px; display: flex; gap: 6px; align-items: baseline; padding: 2px 4px; }
.rm-list { display: grid; gap: 8px; min-height: 48px; border-radius: 8px; transition: background .12s; }
.rm-list.over { background: var(--pma-blue-soft); outline: 2px dashed var(--pma-blue); outline-offset: 2px; }
.rm-none { margin: 8px 4px; }
.rm-card { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 10px 10px 10px 14px; min-width: 0; overflow: visible; }
.rm-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; border-radius: 10px 0 0 10px; background: var(--c, var(--line)); }
.rm-card[draggable="true"] { cursor: grab; }
.rm-card.dragging { opacity: .45; }
.rm-card-top { display: flex; gap: 6px; align-items: flex-start; justify-content: space-between; }
.rm-title { font: 700 13.5px/1.3 var(--font); text-transform: none; letter-spacing: 0; min-width: 0; overflow-wrap: anywhere; }
.rm-open { border: 0; background: none; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.rm-open:hover { color: var(--pma-blue); text-decoration: underline; }
.rm-sum { margin: 4px 0 0; font-size: 12.5px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.rm-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.rm-chips:empty { display: none; }
.rm-chip { display: inline-block; max-width: 100%; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 4px; background: var(--grey-soft); color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
.rm-chip.amber { background: var(--amber-soft); color: var(--amber); white-space: normal; }
.rm-chip.green { background: var(--green-soft); color: var(--green); }
.rm-chip.link { background: var(--pma-blue-soft); color: var(--pma-blue-ink); }
.rm-ship { margin: 8px 0 0; font-size: 12px; color: var(--green); }

.rm-menu { position: relative; flex: none; }
.rm-menu-btn { width: 28px; height: 28px; font-size: 18px; line-height: 1; color: var(--muted); }
.rm-menu-btn:hover { background: var(--line-2); color: var(--ink); }
.rm-pop { position: absolute; right: 0; top: 30px; z-index: 20; min-width: 168px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 6px; display: grid; }
.rm-pop button { border: 0; background: none; text-align: left; padding: 7px 10px; border-radius: 6px; font: 500 13px var(--font); color: var(--ink); cursor: pointer; }
.rm-pop button:hover, .rm-pop button:focus-visible { background: var(--line-2); outline: none; }
.rm-pop button.danger { color: var(--red); }
.rm-pop hr { border: 0; border-top: 1px solid var(--line-2); margin: 4px 0; width: 100%; }
.rm-pop-h { margin: 4px 10px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

.rm-area { display: grid; gap: 8px; }
.rm-area-h { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.rm-rows { padding: 0; }
.rm-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 10px 14px 10px 20px; border-bottom: 1px solid var(--line-2); position: relative; }
.rm-row:last-child { border-bottom: 0; }
.rm-row::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c); }
.rm-row:first-child::before { border-top-left-radius: var(--radius); }
.rm-row:last-child::before { border-bottom-left-radius: var(--radius); }
.rm-row-main { display: grid; gap: 2px; min-width: 0; }
.rm-row-main .rm-open { font-weight: 600; overflow-wrap: anywhere; }
.rm-row > .hub-type { justify-self: start; margin-top: 2px; }

/* The add / edit side panel. */
dialog.hub-panel { margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: min(480px, 100vw); border-radius: 14px 0 0 14px; overflow-y: auto; }
.hub-panel form { display: grid; gap: 12px; }
.hub-panel .field input, .hub-panel .field select, .hub-panel .field textarea { width: 100%; }
.hub-panel .field textarea { resize: vertical; }
.hub-panel input[readonly] { color: var(--muted); background: var(--line-2); }
.hub-panel .dialog-actions { align-items: center; position: sticky; bottom: -22px; background: var(--panel); padding: 12px 0; margin: 0; }

@media (max-width: 1180px) {
  .rm-board { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .hub-kpis3, .hub-kpis4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hub-kpis3 > :last-child { grid-column: span 2; }
  .rm-board { grid-template-columns: minmax(0, 1fr); }
  .hub-filters .search { width: 100%; }
  .hub-filters .search input { min-width: 0; width: 100%; }
  .chl-entry { padding: 12px 14px; }
  .rm-row { grid-template-columns: minmax(0, 1fr) auto; padding-left: 16px; }
  .rm-row > .hub-type { grid-column: 1 / -1; }
  .rm-row > .rm-row-main { grid-column: 1; }
  .hub-two { grid-template-columns: minmax(0, 1fr); }
  dialog.hub-panel { width: 100vw; border-radius: 0; }
}
.hub-panel p:empty { display: none; }

/* ---------- Audit Log ---------- */
.hub-kpis5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.au-filters { display: grid; gap: 10px; }
.au-filters .chips { margin: 0; }
.au-custom { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
#au-actor { max-width: 260px; }
.au-tbl td { vertical-align: top; }
.au-when { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 12.5px; }
.au-who { overflow-wrap: anywhere; font-size: 13px; }
.au-sched { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--violet); font-weight: 600; white-space: nowrap; }
.au-what b { font-weight: 600; }
.au-raw { font-size: 12.5px; color: var(--ink); }
.au-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.au-cat, .au-sodium, .au-warn { display: inline-block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 1px 7px; border-radius: 4px; background: var(--grey-soft); color: var(--ink-2); }
.au-cat.warn, .au-warn { background: var(--amber-soft); color: var(--amber); }
.au-sodium { background: var(--pma-blue-soft); color: var(--pma-blue-ink); }
.au-warnrow td:first-child { box-shadow: inset 3px 0 0 var(--amber); }
.au-target { overflow-wrap: anywhere; max-width: 220px; font-size: 13px; }
.au-details { min-width: 220px; font-size: 13px; color: var(--ink-2); }
.au-toggle { border: 0; background: none; color: var(--pma-blue); cursor: pointer; font-size: 12px; padding: 0 6px 0 0; }
.au-json { margin: 8px 0 0; padding: 10px 12px; background: var(--line-2); border-radius: 8px; font-size: 12px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 360px; overflow: auto; color: var(--ink); }
.au-moreline { text-align: center; margin: 0; }
.au-foot { text-align: center; margin: 4px 0 0; }
.au-sources { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.au-source { padding: 14px 16px; display: grid; gap: 4px; font-size: 13px; }
.au-source h3 { font-size: 15px; }
.au-source p { margin: 0; display: flex; justify-content: space-between; gap: 8px; }
.au-source.bad { border-color: var(--red); }
.au-ok { color: var(--green); font-weight: 700; font-size: 12px; }
.au-fail { color: var(--red); font-weight: 700; font-size: 12px; }
.au-failn { color: var(--red); }
.au-failrow td { color: var(--red); }
.au-failrow td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.au-err summary { cursor: pointer; }
.cl-auditlink { margin: 4px 0 0; text-align: right; }

@media (max-width: 1180px) { .hub-kpis5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .hub-kpis5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hub-kpis5 > :last-child { grid-column: span 2; }
  #au-actor { max-width: none; width: 100%; }
  /* The table becomes one card per entry. */
  .au-tbl thead { display: none; }
  .au-tbl, .au-tbl tbody, .au-tbl tr, .au-tbl td { display: block; width: 100%; }
  .au-tbl tr { padding: 10px 14px; border-bottom: 1px solid var(--line-2); }
  .au-tbl td, .au-tbl td:first-child, .au-tbl td:last-child { padding: 2px 0; border: 0; max-width: none; min-width: 0; }
  .au-tbl td[data-label]::before { content: attr(data-label); display: inline-block; width: 66px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
  .au-tbl td .au-what, .au-tbl td .au-tags { display: inline-flex; }
  .au-tbl td.empty::before { content: none; }
  .au-warnrow td:first-child, .au-failrow td:first-child { box-shadow: none; }
  .au-warnrow, .au-failrow { box-shadow: inset 3px 0 0 var(--amber); }
  .au-failrow { box-shadow: inset 3px 0 0 var(--red); }
}
