/* ============================================================================
   ATLAS REDESIGN — Trust Center screen styles  ·  Phase 2
   Branch: atlas-redesign-2026-06-29

   Prefix: .rd-trust-center. Tokens only (--r-*) so Calm (almanac) + Operator
   themes both work automatically. No hardcoded hex. Theme-specific selectors
   (html[data-rtheme="operator"] …) are used only where a token can't express
   the tweak (rare).

   Composition (mirrors the .dc.html isTrust slice):
     eyebrow + h1 + sub  →  4-up KPI tiles  →  1.5fr/1fr grid
       left:  Connected data sources · Audit log
       right: How Atlas earns trust · Permissions
   Trust signals (source freshness, sync status, audit entries) render only
   when a real fetcher supplies them; otherwise honest em-dash / empty states.
   ========================================================================== */

.rd-trust-center {
  font-family: var(--r-font-body);
  color: var(--r-body);
  padding: var(--r-gutter);
  max-width: var(--r-page-max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ---- page header --------------------------------------------------------- */
.rd-tc-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rd-tc-eyebrow {
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-eyebrow);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--r-clay);
}
.rd-tc-h1 {
  font-family: var(--r-font-display);
  font-size: var(--r-fs-h1);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -.01em;
  color: var(--r-ink);
  margin: 0;
}
.rd-tc-sub {
  margin: 2px 0 0;
  font-size: var(--r-fs-body);
  color: var(--r-muted);
  max-width: 600px;
  line-height: 1.5;
}

/* ---- KPI strip (4-up) ---------------------------------------------------- */
.rd-tc-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.rd-tc-kpi {
  background: var(--r-surface);
  border: 1px solid var(--r-hairline-2);
  border-radius: var(--r-radius-card);
  box-shadow: var(--r-shadow-card);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  transition: box-shadow var(--r-dur) var(--r-ease),
              transform var(--r-dur) var(--r-ease),
              border-color var(--r-dur) var(--r-ease);
}
.rd-tc-kpi:hover {
  box-shadow: var(--r-shadow-hover);
  transform: translateY(-2px);
}
/* source-freshness tile reads visibly "live" — a faint good-tone edge when its dot is lit */
.rd-tc-kpi:has(.rd-tc-dot[data-tone="good"]) {
  border-color: color-mix(in srgb, var(--r-good) 30%, var(--r-hairline-2));
}
.rd-tc-kpi-label {
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-eyebrow);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--r-faint);
}
.rd-tc-kpi-val {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--r-font-display);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.1;
  color: var(--r-ink);
}
/* status pulse dot — tone-driven, defaults muted when no live signal */
.rd-tc-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--r-faint);
}
.rd-tc-dot[data-tone="good"] {
  background: var(--r-good);
  animation: rdTcPulse 2.4s infinite;
}
.rd-tc-dot[data-tone="warn"] { background: var(--r-amber); }
.rd-tc-dot[data-tone="alert"] { background: var(--r-alert); }
@keyframes rdTcPulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--r-good) 45%, transparent); }
  50%      { box-shadow: 0 0 0 5px color-mix(in srgb, var(--r-good) 0%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .rd-tc-dot[data-tone="good"] { animation: none; }
}

/* ---- main grid (left detail | right rails) ------------------------------- */
.rd-tc-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 20px;
  align-items: start;
  min-height: 0;
}
.rd-tc-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}
.rd-tc-col-r { gap: 16px; }

/* ---- shared card --------------------------------------------------------- */
.rd-tc-tile {
  background: var(--r-surface);
  border: 1px solid var(--r-border);
  border-radius: var(--r-radius-card);
  box-shadow: var(--r-shadow-card);
  padding: 20px 22px;
  transition: box-shadow var(--r-dur) var(--r-ease),
              transform var(--r-dur) var(--r-ease);
}
.rd-tc-tile:hover {
  box-shadow: var(--r-shadow-hover);
  transform: translateY(-2px);
}
.rd-tc-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.rd-tc-card-title {
  margin: 0;
  font-family: var(--r-font-display);
  font-size: var(--r-fs-h2);
  font-weight: 600;
  color: var(--r-ink);
}
.rd-tc-export {
  appearance: none;
  border: none;
  background: transparent;
  font-family: var(--r-font-body);
  font-size: 12px;
  font-weight: 600;
  color: var(--r-primary);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: var(--r-radius-chip);
  transition: filter var(--r-dur) var(--r-ease);
}
.rd-tc-export:hover { filter: brightness(1.1); }
.rd-tc-export:focus-visible { outline: var(--r-focus); outline-offset: 2px; }
.rd-tc-export[disabled] { color: var(--r-faint); cursor: default; }

/* the "How Atlas earns trust" card gets a faint primary edge */
.rd-tc-tile.is-feature {
  border-color: color-mix(in srgb, var(--r-primary) 28%, var(--r-border));
}

/* ---- connected data sources / list rows ---------------------------------- */
.rd-tc-rows {
  display: flex;
  flex-direction: column;
  margin-top: 6px;
  max-height: calc(100vh - 360px);
  overflow: auto;
}
.rd-tc-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 8px;
  border-top: 1px solid var(--r-hairline);
  border-radius: 10px;
  transition: background var(--r-dur) var(--r-ease);
}
.rd-tc-row:first-child { border-top: none; }
.rd-tc-row:hover { background: var(--r-canvas-raised); }
.rd-tc-row-body {
  flex: 1 1 auto;
  min-width: 0;
}
.rd-tc-row-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--r-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rd-tc-row-desc {
  font-size: 12px;
  color: var(--r-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* source sync status badge (right side of a source row) */
.rd-tc-status {
  flex: none;
  font-family: var(--r-font-mono);
  font-size: 12px;
  color: var(--r-muted);
}
.rd-tc-status[data-tone="good"] { color: var(--r-good); }
.rd-tc-status[data-tone="warn"] { color: var(--r-clay-2); }
.rd-tc-status[data-tone="alert"] { color: var(--r-alert); }

/* ---- audit log rows ------------------------------------------------------ */
.rd-tc-log {
  display: flex;
  flex-direction: column;
  margin-top: 6px;
  max-height: calc(100vh - 420px);
  overflow: auto;
}
.rd-tc-logrow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 8px;
  border-top: 1px solid var(--r-hairline);
  border-radius: 10px;
  transition: background var(--r-dur) var(--r-ease);
}
.rd-tc-logrow:first-child { border-top: none; }
.rd-tc-logrow:hover { background: var(--r-canvas-raised); }
/* "who" column — icon + the row's own real actor classification, held to a
   fixed width so every row's what/when reads as a straight scannable column
   regardless of label length ("atlas" vs "user"). The label text comes
   straight from the row's own data-actor attribute — never invented. */
.rd-tc-logicon {
  flex: 0 0 66px;
  font-size: 14px;
  color: var(--r-muted);
  line-height: 1;
}
.rd-tc-logicon[data-actor="atlas"] { color: var(--r-primary); }
.rd-tc-logicon::after {
  content: attr(data-actor);
  display: inline-block;
  margin-left: 6px;
  font-family: var(--r-font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: capitalize;
  vertical-align: middle;
  color: var(--r-muted);
}
.rd-tc-logicon[data-actor="atlas"]::after { color: var(--r-primary); }
.rd-tc-logtext {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  color: var(--r-body);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rd-tc-logsrc { color: var(--r-faint); }
.rd-tc-logtime {
  flex: none;
  font-family: var(--r-font-mono);
  font-size: 12px;
  color: var(--r-faint);
}

/* ---- "How Atlas earns trust" pillars ------------------------------------- */
.rd-tc-pillar {
  display: flex;
  gap: 11px;
  margin-bottom: 13px;
}
.rd-tc-pillar:last-child { margin-bottom: 0; }
.rd-tc-pillar-ic {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--r-mint-surface);
  color: var(--r-mint-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.rd-tc-pillar-ic i { font-size: 16px; }
.rd-tc-pillar-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--r-ink);
}
.rd-tc-pillar-desc {
  font-size: 12px;
  color: var(--r-muted);
  line-height: 1.45;
}
.rd-tc-feature-head { margin-bottom: 12px; }

/* ---- permissions rows ---------------------------------------------------- */
.rd-tc-perm {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--r-hairline);
}
.rd-tc-perm:first-of-type { margin-top: 8px; }
.rd-tc-perm-role {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--r-ink);
}
.rd-tc-perm-scope {
  font-size: 12px;
  color: var(--r-muted);
  text-align: right;
}

/* ---- honest empty / dashed states ---------------------------------------- */
.rd-tc-empty {
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-meta);
  letter-spacing: .03em;
  color: var(--r-faint);
  text-align: center;
  padding: 22px 12px;
  border: 1px dashed var(--r-border);
  border-radius: var(--r-radius-control);
  margin-top: 8px;
}

/* ---- entrance motion (one-shot; off under reduced motion) ---------------- */
.rd-tc-kpis, .rd-tc-tile {
  animation: rdTcIn .38s var(--r-ease) both;
}
.rd-tc-col-r .rd-tc-tile:nth-child(2) { animation-delay: .05s; }
@keyframes rdTcIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .rd-tc-kpis, .rd-tc-tile { animation: none; }
  .rd-tc-tile:hover, .rd-tc-kpi:hover { transform: none; }
}

/* ---- focus visibility ------------------------------------------------------ */
.rd-trust-center :focus-visible { outline: var(--r-focus); outline-offset: 2px; }

/* ---- responsive ---------------------------------------------------------- */
@media (max-width: 980px) {
  .rd-tc-grid { grid-template-columns: 1fr; }
  .rd-tc-rows { max-height: 46vh; }
  .rd-tc-log { max-height: 40vh; }
}
@media (max-width: 720px) {
  .rd-tc-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .rd-tc-kpis { grid-template-columns: 1fr; }
  .rd-tc-tile { padding: 16px; }
  .rd-tc-row-desc { display: none; }
  .rd-tc-logicon { flex-basis: 52px; }
}
