/* ===============================================================
   LVRD — Earned Autonomy
   The trust system made visible: a stepped tier track
   (Supervised → Trusted → Autonomous), milestone progress, a
   self-correction event, and the custom-rules panel. Accent reads
   as autonomy the agent has earned; neutral is supervised work
   that still waits on you. All static DOM, LVRD tokens.
   =============================================================== */

/* ---------- Compact tier pill (rides an agent-card header) ---------- */
.au-pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-mono); font-size: 9px; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-subtle);
  border: 1px solid var(--border); background: var(--surface-2);
  border-radius: 9999px; padding: 3px 9px 3px 6px; white-space: nowrap; line-height: 1;
}
.au-pill .segs { display: inline-flex; gap: 2px; }
.au-pill .segs i { width: 8px; height: 4px; border-radius: 2px; background: var(--border-strong); display: block; }
.au-pill .segs i.on { background: var(--accent); }
/* Supervised: the one earned step reads neutral — autonomy not yet granted. */
.au-pill.t-supervised { color: var(--fg-subtle); }
.au-pill.t-supervised .segs i.on { background: var(--smoke-500); }
.au-pill.t-trusted { color: var(--fg-muted); }
.au-pill.t-autonomous { color: var(--fg-strong); border-color: color-mix(in oklab, var(--accent) 42%, var(--border)); }

/* ---------- Full tier module (lives inside a feature-row frame) ---------- */
.au {
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); padding: 18px; text-align: left;
}
[data-theme="dark"] .au { background: var(--surface-2); border-color: var(--border-strong); }
.au-row { display: flex; align-items: center; gap: 11px; }
.au-glyph {
  width: 30px; height: 30px; border-radius: 8px; background: var(--surface-2);
  border: 1px solid var(--border); color: var(--fg-muted); flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 11px;
}
[data-theme="dark"] .au-glyph { background: var(--bg); }
.au-id { min-width: 0; flex: 1; }
.au-id .nm { display: block; font-weight: 600; color: var(--fg-strong); font-size: 14px; letter-spacing: -0.005em; }
.au-id .rl { display: block; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-faint); margin-top: 3px; }
.au-row .au-pill { margin-left: auto; }

/* the stepped track */
.au-track { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 18px; }
.au-seg { height: 7px; border-radius: 4px; background: var(--border-strong); position: relative; overflow: hidden; }
.au-seg .fill {
  position: absolute; inset: 0; border-radius: 4px; background: var(--accent);
  transform: scaleX(0); transform-origin: left;
  transition: transform var(--duration-breath) var(--easing-breath);
}
.au-seg.on .fill { transform: scaleX(1); }
/* supervised step paints neutral, not accent */
.au-seg.on.neutral .fill { background: var(--smoke-500); }
/* a step that was earned then lost — faint, dashed ghost */
.au-seg.lost { background: var(--surface); box-shadow: inset 0 0 0 1px var(--border-strong); }
.au-seg.lost .fill { background: repeating-linear-gradient(115deg, color-mix(in oklab, var(--accent) 32%, transparent) 0 5px, transparent 5px 10px); transform: scaleX(1); opacity: 0.55; }

/* scroll-gated fill: hold at 0 until the row reveals, then breathe in */
.reveal .au-seg .fill { transform: scaleX(0); }
.reveal.in .au-seg.on .fill { transform: scaleX(1); }
.reveal.in .au-seg.lost .fill { transform: scaleX(1); }
.au-track .au-seg:nth-child(2) .fill { transition-delay: 120ms; }
.au-track .au-seg:nth-child(3) .fill { transition-delay: 240ms; }

.au-tiers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 9px; }
.au-tiers span { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-faint); }
.au-tiers span:nth-child(2) { text-align: center; }
.au-tiers span:nth-child(3) { text-align: right; }
.au-tiers span.cur { color: var(--fg-strong); }

/* milestone progress toward the next tier */
.au-mile { margin-top: 17px; }
.au-mile .lbl { display: flex; align-items: baseline; justify-content: space-between; font-family: var(--font-mono); font-size: 10.5px; color: var(--fg-subtle); margin-bottom: 8px; }
.au-mile .lbl .v { color: var(--fg-strong); }
.au-bar { height: 4px; border-radius: 2px; background: var(--border); overflow: hidden; }
.au-bar .v { height: 100%; border-radius: 2px; background: var(--accent); width: 0; transition: width var(--duration-breath) var(--easing-breath); }
.reveal .au-bar .v { width: 0; }
.reveal.in .au-bar .v { width: var(--p, 0%); }

/* "now handled on its own" list */
.au-unlocked { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.au-unlocked .rl { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--fg-faint); }
.au-unlocked .it { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--fg); line-height: 1.4; }
.au-unlocked .it .nm { flex: 1; }

/* the "auto" badge — autonomous completions */
.au-auto {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-mono); font-size: 9px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent); border: 1px solid color-mix(in oklab, var(--accent) 38%, transparent);
  border-radius: 9999px; padding: 2px 7px; line-height: 1; white-space: nowrap;
}
.au-auto .d { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }

/* a small caption strip under the track */
.au-since { margin-top: 14px; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.03em; color: var(--fg-faint); display: flex; align-items: center; gap: 8px; }
.au-since .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--border-strong); }

/* ---------- Self-correction event (audit-trail row) ---------- */
.au-event {
  display: grid; grid-template-columns: 30px 1fr auto; gap: 11px; align-items: start;
  border: 1px solid var(--border); border-left: 2px solid var(--accent);
  border-radius: 0 9px 9px 0; background: var(--surface-2); padding: 13px 14px; margin-top: 16px;
}
[data-theme="dark"] .au-event { background: var(--bg); }
.au-event .ic {
  width: 30px; height: 30px; border-radius: 8px; flex: 0 0 auto;
  background: color-mix(in oklab, var(--accent) 14%, transparent); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
}
.au-event .tx { min-width: 0; }
.au-event .tx .h { display: block; font-size: 12.5px; font-weight: 600; color: var(--fg-strong); line-height: 1.35; }
.au-event .tx .s { display: block; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.02em; color: var(--fg-subtle); margin-top: 4px; line-height: 1.55; }
.au-event .when { font-family: var(--font-mono); font-size: 10px; color: var(--fg-faint); white-space: nowrap; padding-top: 1px; }

/* ---------- Custom-rules panel ---------- */
.au-rules-head { display: flex; align-items: center; gap: 10px; padding: 2px 2px 14px; }
.au-rules-head h5, .au-rules-head .mock-label { font-size: 14px; font-weight: 600; color: var(--fg-strong); margin: 0; }
.au-rules-head .meta { font-family: var(--font-mono); font-size: 10.5px; color: var(--fg-faint); }
.au-rules-head .grow { flex: 1; }
.au-rules { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); overflow: hidden; }
[data-theme="dark"] .au-rules { background: var(--surface-2); border-color: var(--border-strong); }
.au-rule { display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: center; padding: 14px 15px; border-top: 1px solid var(--border); }
.au-rule:first-child { border-top: 0; }
.au-rule .ico {
  width: 28px; height: 28px; border-radius: 8px; flex: 0 0 auto;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--fg-subtle);
  display: inline-flex; align-items: center; justify-content: center;
}
[data-theme="dark"] .au-rule .ico { background: var(--bg); }
.au-rule .tx { min-width: 0; }
.au-rule .tx .agent { display: block; font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-faint); }
.au-rule .tx .rule { display: block; font-size: 13.5px; color: var(--fg-strong); line-height: 1.4; margin-top: 3px; letter-spacing: -0.005em; }
.au-rule .tx .rule b { font-weight: 600; color: var(--accent); }
.au-rule .gate { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-subtle); }
.au-rule .gate .lock { width: 14px; height: 14px; color: var(--accent); }
.au-rule-add { display: flex; align-items: center; gap: 9px; padding: 13px 15px; border-top: 1px solid var(--border); color: var(--fg-muted); font-size: 13px; }
.au-rule-add .plus { width: 18px; height: 18px; border-radius: 6px; border: 1px dashed var(--border-strong); display: inline-flex; align-items: center; justify-content: center; color: var(--fg-subtle); }

/* static toggle showing a rule is active */
.au-switch { width: 34px; height: 20px; border-radius: 9999px; background: var(--accent); position: relative; flex: 0 0 auto; }
.au-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--fg-on-accent); transform: translateX(14px); transition: transform var(--duration-fast) var(--easing-default); }
.au-switch.off { background: var(--smoke-400); }
.au-switch.off::after { transform: translateX(0); }

/* auto badge sized down for the hero "Done today" timeline */
.od-ev .au-auto { margin-left: 8px; vertical-align: middle; }
