:root {
  /* Warm charcoal with a faint indigo undertone — dark, but less "terminal" than
     the old blue-gray. Per-agent accents are layered on top in the agent home. */
  --bg: #16131e;
  --panel: #201c2b;
  --panel-2: #2a2438;
  --border: #3a3350;
  --text: #ece9f3;
  --muted: #9b94ad;
  --accent: #6f8cff;
  --accent-2: #9b6bff;
  --green: #4cc764;
  --red: #ff5c52;
  --gold: #e0b341;
}

* { box-sizing: border-box; }

.site-foot { text-align: center; color: var(--muted); font-size: 12px; padding: 26px 16px 18px; }

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 70% -10%, #3a2a5533, transparent), var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: #16131eee; backdrop-filter: blur(8px); z-index: 10;
}
.brand { font-weight: 700; font-size: 18px; cursor: pointer; }
.nav { display: flex; gap: 10px; align-items: center; }
.nav .pill { color: var(--muted); font-size: 13px; }

main { max-width: 980px; margin: 0 auto; padding: 32px 24px 80px; }

/* Hero */
.hero { text-align: center; padding: 56px 0 36px; }
.hero h1 { font-size: 40px; line-height: 1.1; margin: 0 0 16px; }
.hero .sub { color: var(--muted); font-size: 18px; max-width: 600px; margin: 0 auto 28px; }

h2 { font-size: 20px; margin: 28px 0 14px; }
.examples h2 { text-align: center; }

/* Cards */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.acard {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px; transition: border-color .15s, transform .1s;
}
.selectable .acard { cursor: pointer; }
.selectable .acard:hover { border-color: var(--accent); transform: translateY(-2px); }
.acard.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.acard h3 { margin: 0 0 4px; font-size: 16px; }
.acard .tagline { color: var(--muted); font-size: 13px; min-height: 34px; }
.acard .meta { margin-top: 10px; font-size: 12px; color: var(--muted); }
.acard .chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.chip { background: var(--panel-2); border: 1px solid var(--border); border-radius: 999px; padding: 2px 9px; font-size: 11px; }
.risk { font-weight: 600; }
.risk.conservative { color: var(--green); }
.risk.moderate { color: var(--gold); }
.risk.aggressive { color: var(--red); }

/* Buttons */
.btn {
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
  padding: 10px 16px; border-radius: 10px; font-size: 14px; cursor: pointer; font-weight: 600;
  transition: filter .12s, opacity .12s;
}
.btn:hover { filter: brightness(1.15); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: none; }
.btn.ghost { background: transparent; }
.btn.big { padding: 13px 24px; font-size: 16px; }

/* Forms */
.row { display: flex; gap: 10px; align-items: center; margin: 12px 0; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.input {
  background: var(--panel); border: 1px solid var(--border); color: var(--text);
  padding: 11px 13px; border-radius: 10px; font-size: 15px; flex: 1; min-width: 180px;
}
.field { display: block; margin: 14px 0; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field em { font-style: normal; opacity: .7; }
.advanced { margin: 18px 0; border: 1px solid var(--border); border-radius: 10px; padding: 6px 14px; background: var(--panel); }
.advanced summary { cursor: pointer; padding: 8px 0; font-weight: 600; }
.hint { color: var(--muted); font-size: 13px; }
.msg { font-size: 14px; min-height: 18px; }
.msg.err { color: var(--red); }
.msg.ok { color: var(--green); }

/* Preview */
.preview { display: grid; gap: 20px; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 20px; }
.agent-banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.agent-banner h2 { margin: 0; }
.journal-quote { border-left: 3px solid var(--accent); padding: 6px 14px; color: #cdd6e0; font-style: italic; margin: 10px 0; }
.persona-desc { color: var(--muted); font-style: italic; margin: 8px 0 4px; }
.opt { font-size: 14px; font-weight: 400; color: var(--muted); font-style: normal; opacity: .8; }
.kv { display: flex; gap: 22px; flex-wrap: wrap; margin: 10px 0; }
.kv div { font-size: 13px; color: var(--muted); }
.kv b { display: block; font-size: 19px; color: var(--text); font-weight: 700; }
.signup-box { background: var(--panel-2); border: 1px solid var(--border); border-radius: 14px; padding: 20px; }
.signup-box h3 { margin: 0 0 6px; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: right; padding: 9px 10px; border-bottom: 1px solid var(--border); }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.pos { color: var(--green); }
.neg { color: var(--red); }
.side-buy { color: var(--green); font-weight: 600; }
.side-sell { color: var(--red); font-weight: 600; }

/* Home */
.home-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.home-head .title { display: flex; align-items: center; gap: 14px; }
.home-head .avatar { box-shadow: 0 0 0 4px color-mix(in srgb, var(--av) 14%, transparent); }
.home-head .title h2 { margin: 0; }
.home-head .title .sub { color: var(--muted); font-size: 14px; }
.mood-line { margin-top: 4px; min-height: 18px; }
.mood-chip { font-size: 12px; color: var(--accent); background: var(--panel-2); border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; }
.badge { font-size: 11px; padding: 3px 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border); }
.badge.active { color: var(--green); }
.badge.retired, .badge.hibernated { color: var(--muted); }
.danger-zone { margin-top: 22px; border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; background: var(--panel); }
.danger-zone h3 { margin: 0 0 4px; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.back-link { display: inline-block; color: var(--muted); font-size: 13px; text-decoration: none; margin-bottom: 10px; }
.back-link:hover { color: var(--text); }
.agents-list .home-head { margin-bottom: 16px; }
.agents-list .acard { cursor: pointer; }
.tabs { display: flex; gap: 6px; margin: 18px 0; border-bottom: 1px solid var(--border); }
.tab { background: none; border: none; color: var(--muted); padding: 10px 14px; cursor: pointer; font-size: 14px; font-weight: 600; border-bottom: 2px solid transparent; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab-panel.hidden, .hidden { display: none; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 18px; }
.metric { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.metric .label { color: var(--muted); font-size: 12px; }
.metric .value { font-size: 22px; font-weight: 700; margin-top: 4px; }

.journal-entry { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 12px; }
.journal-entry .head { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.journal-entry .etype { text-transform: uppercase; letter-spacing: .05em; }
.journal-entry .mood { color: var(--accent); text-transform: none; letter-spacing: 0; font-weight: 600; }
.journal-entry .jtitle { margin: 0 0 6px; font-size: 16px; color: var(--text); }
.journal-entry p { margin: 0; line-height: 1.55; color: #cdd6e0; }

.statcard { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.statcard .row2 { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.statcard .row2 .label { color: var(--muted); font-size: 12px; }
.statcard .row2 .val { font-size: 17px; font-weight: 700; margin-top: 4px; }

/* Theses */
.thesis { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; }
.thesis-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.thesis-head .tk { font-weight: 700; font-size: 16px; }
.thesis-head .stance { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border: 1px solid var(--border); border-radius: 999px; }
.thesis-head .ev { margin-left: auto; font-size: 12px; color: var(--muted); }
.ev-catalyst { color: var(--green); }
.ev-risk { color: var(--red); }
.ev-structural { color: var(--accent); }
.conv { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.conv-bar { flex: 1; height: 7px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.conv-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.conv em { color: var(--muted); font-size: 12px; font-style: normal; white-space: nowrap; }
.thesis p { margin: 0; color: #cdd6e0; line-height: 1.5; }

/* Feed */
.feed-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.feed-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.feed-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 10px; }
.feed-tone { margin: 0 0 12px; font-size: 13px; line-height: 1.5; color: #cdd6e0; }
.news-item { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.news-item:last-child { border-bottom: none; padding-bottom: 0; }
.news-item a { color: var(--text); text-decoration: none; line-height: 1.4; flex: 1; }
.news-item a:hover { color: var(--accent); }
.news-date { font-size: 11px; color: var(--muted); white-space: nowrap; }

/* Watchlist manager */
.watchlist-mgr { margin-top: 24px; }
.watchlist-mgr h3 { margin: 0 0 4px; font-size: 15px; }
.watchlist-mgr .hint { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.wl-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; min-height: 28px; }
.wl-chip { display: inline-flex; align-items: center; gap: 5px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 999px; padding: 4px 6px 4px 12px; font-size: 13px; font-weight: 600; }
.wl-chip .rm { background: none; border: none; color: var(--muted); cursor: pointer; padding: 0 2px; font-size: 15px; line-height: 1; border-radius: 999px; }
.wl-chip .rm:hover { color: var(--red); }
.wl-add { display: flex; gap: 8px; align-items: center; }
#wl-msg { font-size: 13px; margin-top: 8px; min-height: 18px; }
#wl-msg.err { color: var(--red); }

.empty { color: var(--muted); text-align: center; padding: 30px; }
.spinner { display: inline-block; width: 15px; height: 15px; border: 2px solid #ffffff66; border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--border); padding: 12px 20px;
  border-radius: 10px; font-size: 14px; box-shadow: 0 10px 30px #0008; z-index: 50; max-width: 90%;
}
.toast.err { border-color: var(--red); }
.toast.ok { border-color: var(--green); }

/* ===== Wave 1: character identity, perf chart, run-box ===== */

/* Agent avatar — circular emoji badge tinted by archetype accent (--av) */
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  border-radius: 50%; line-height: 1;
  background: color-mix(in srgb, var(--av) 22%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--av) 55%, var(--border));
}

/* Character cards (landing + builder) */
.acard-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.acard-head h3 { margin: 0; }
.acard-take { color: #cdd6e0; font-style: italic; font-size: 13px; line-height: 1.45; margin: 8px 0; }

/* Run-a-cycle box, demoted into the Agent tab */
.run-box {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px; margin-bottom: 16px;
}
.run-box h3 { margin: 0 0 4px; font-size: 15px; }
.run-box .hint { margin: 0; max-width: 460px; }

/* Performance equity curve */
.perf-chart { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 18px; }
.perf-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.perf-legend { display: flex; gap: 14px; font-size: 12px; }
.perf-legend .lg-agent { color: var(--accent); }
.perf-legend .lg-voo { color: var(--muted); }
.perf-svg { display: block; width: 100%; height: 90px; overflow: visible; }
.perf-svg .ln { fill: none; vector-effect: non-scaling-stroke; }
.perf-svg .ln-agent { stroke: var(--accent); stroke-width: 2; }
.perf-svg .ln-voo { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 3 3; }

/* ===== Plans: "The Plan" strip pinned atop the Journal (open loops) ===== */
.loops-line { margin-top: 4px; }
.loops-chip { font-size: 12px; color: var(--muted); }

.plan-strip { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; margin-bottom: 18px; }
.plan-strip-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }

.plan-card { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.plan-card:last-child { margin-bottom: 0; }
.plan-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.plan-kind { font-weight: 700; font-size: 11px; letter-spacing: .04em; color: var(--muted); white-space: nowrap; }
.plan-tk { font-weight: 700; font-size: 15px; }
.plan-trigger { color: #cdd6e0; flex: 1; min-width: 120px; }
.plan-conv { color: var(--accent); font-weight: 600; white-space: nowrap; }
.plan-bar { height: 6px; background: var(--bg); border-radius: 999px; overflow: hidden; margin: 9px 0 4px; }
.plan-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
/* Bar tone by intent: a ripening buy is anticipation, a sell level is harvest, avoid is a watch. */
.plan-bar.bar-up span { background: linear-gradient(90deg, #2e7d4f, var(--green)); }
.plan-bar.bar-down span { background: linear-gradient(90deg, #8a6a2a, var(--gold)); }
.plan-bar.bar-watch span { background: linear-gradient(90deg, #5a5470, var(--muted)); }
.plan-sub { font-size: 11px; color: var(--muted); }
.plan-size { font-size: 12px; color: var(--muted); margin-top: 5px; }

/* status treatments */
.plan-armed { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.plan-triggered { border-color: var(--gold); }
.plan-executed { opacity: .75; }
.plan-expired, .plan-abandoned { opacity: .5; }
.plan-resolved { margin-top: 10px; }
.plan-resolved summary { cursor: pointer; color: var(--muted); font-size: 12px; padding: 4px 0; }
.plan-resolved .plan-card { margin-top: 8px; }

/* ===== Gated create button + retired/read-only agent theme ===== */
/* A disabled "create" button wrapped so the tooltip still shows on hover. */
.gated { display: inline-block; cursor: not-allowed; }
.gated > .btn { pointer-events: none; }

/* Read-only (retired / hibernated) agents: muted, frozen look. */
.status-banner { border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; font-size: 13px; background: var(--panel); color: var(--muted); }
.status-banner.retired { border-color: var(--gold); }
.home.readonly .avatar { filter: grayscale(1); opacity: .75; }
.home.readonly .tab.active { border-bottom-color: var(--muted); }

/* ===== Talk-back (per-entry reply threads) ===== */
.entry-footer { margin-top: 12px; }
.reply-toggle { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 600; padding: 4px 0; }
.reply-toggle:hover { color: var(--accent); }
/* Tiny share affordance on conviction rows and plan cards (entry footers reuse .reply-toggle). */
.share-mini { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px; padding: 0 2px; }
.plan-head .share-mini { margin-left: auto; }  /* cv-head already right-aligns via .cv-pct */
.share-mini:hover { color: var(--accent); }
.reply-thread { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.bubble { max-width: 88%; padding: 8px 12px; border-radius: 12px; font-size: 14px; line-height: 1.5; }
.bubble .who { display: block; font-size: 11px; font-weight: 700; letter-spacing: .03em; opacity: .7; margin-bottom: 2px; }
.bubble p { margin: 0; color: var(--text); }
.bubble.user { align-self: flex-end; background: var(--panel-2); border: 1px solid var(--border); border-bottom-right-radius: 4px; }
.bubble.agent { align-self: flex-start; background: linear-gradient(135deg, rgba(111,140,255,.16), rgba(155,107,255,.16)); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.reply-compose { display: flex; gap: 8px; margin-top: 4px; }
.reply-compose .input { flex: 1; }

/* ===== Coaching ===== */
.coaching-mgr { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.coaching-mgr h3 { margin: 0 0 4px; }
.coach-add { display: flex; gap: 8px; margin: 12px 0; }
.coach-add .input { flex: 1; }
.coach-note { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.coach-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.coach-text { margin: 0; font-weight: 600; color: var(--text); font-size: 14px; }
.coach-row .rm { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 2px; }
.coach-row .rm:hover { color: var(--red); }
.coach-ack { margin: 6px 0 0; font-size: 13px; color: var(--accent); font-style: italic; }

/* ===== Conviction drift / stance flip (Conviction Engine) ===== */
.drift { font-weight: 700; margin-left: 6px; font-size: 12px; }
.drift.pos { color: var(--green); }
.drift.neg { color: var(--red); }
.flip { font-size: 11px; font-weight: 600; color: var(--gold); border: 1px solid var(--border);
        border-radius: 999px; padding: 1px 8px; background: var(--panel-2); }

/* ===== Today (voice-led glance) ===== */
.today-take { background: linear-gradient(135deg, rgba(111,140,255,.14), rgba(155,107,255,.14));
  border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; cursor: pointer; }
.today-take:hover { border-color: var(--accent); }
.take-head { font-weight: 700; margin-bottom: 6px; }
.take-head .mood { color: var(--accent); font-weight: 600; }
.take-head .muted { float: right; font-weight: 400; font-size: 12px; }
.today-take p { margin: 0; color: #cdd6e0; line-height: 1.5; }
.read-more { display: inline-block; margin-top: 8px; font-size: 12px; color: var(--accent); font-weight: 600; }
.score { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; cursor: pointer; }
.score:hover { border-color: var(--accent); }
.score-main { font-size: 26px; font-weight: 800; }
.score-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.watch-teaser { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; cursor: pointer; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.watch-teaser:hover { border-color: var(--accent); }

/* ===== Conviction board / cards ===== */
.cv { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 9px 13px; margin-bottom: 7px; }
.cv-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cv-head .tk { font-weight: 800; }
.cv-quote { font-size: 13px; font-variant-numeric: tabular-nums; color: var(--muted); }
.cv-held { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--text); background: var(--panel-2); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; }
.cv-held.muted { color: var(--muted); background: transparent; }
.cv-pct { margin-left: auto; font-weight: 700; font-size: 13px; }
.cv-bars { display: flex; align-items: center; gap: 10px; margin: 7px 0 5px; }
.cv-bars .conv-bar { flex: 1; }
.conv-bar span.bar-pos { background: var(--green); }
.conv-bar span.bar-neg { background: var(--red); }
.conv-bar span.bar-neutral { background: var(--muted); }
.cv p { margin: 3px 0 0; color: #aeb6c2; font-size: 13px; line-height: 1.45; }
.spark { width: 64px; height: 16px; flex: none; }
.spark polyline { fill: none; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }

/* ===== Timeline trade events ===== */
.tl-day { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin: 18px 0 8px; }
.tl-day:first-child { margin-top: 0; }
.tl-trade { background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; }
.tl-trade-head { display: flex; justify-content: space-between; font-weight: 600; }
.tl-trade-head .tl-when { color: var(--muted); font-weight: 400; font-size: 12px; }
.tl-trade p { margin: 6px 0 0; color: #cdd6e0; font-size: 14px; }
.side-buy { color: var(--green); font-weight: 800; }
.side-sell { color: var(--red); font-weight: 800; }

/* ===== Markets ===== */
.mk-mood { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; }
.mk-summary { display: block; margin: 4px 0 8px; color: #cdd6e0; }
.idx-row { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; }
.idx { color: var(--muted); }
.mk-row { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.mk-row-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mk-row-head .tk { font-weight: 800; }
.mk-price { font-variant-numeric: tabular-nums; }
.mk-view { margin-left: auto; font-size: 13px; }
.mk-take { color: #cdd6e0; font-size: 14px; margin: 6px 0 0; }
.mk-news { display: block; margin-top: 6px; font-size: 13px; color: var(--accent); text-decoration: none; }
.mk-news:hover { text-decoration: underline; }

/* ===== Character sheet (trait dials + mandates) ===== */
.char-sheet { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.char-sheet h3 { margin: 0 0 4px; }
.dial { margin: 12px 0; }
.dial-ends { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.dial-ends .dial-name { color: var(--text); font-weight: 700; text-transform: capitalize; }
.dial-track { position: relative; height: 6px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 999px; }
.dial-fill { position: absolute; top: 50%; width: 12px; height: 12px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-2)); transform: translate(-50%, -50%); }
.mandates { margin-top: 12px; }
.mandate-chip { display: inline-block; font-size: 12px; font-weight: 600; color: var(--gold); border: 1px solid var(--border); background: var(--panel-2); border-radius: 999px; padding: 3px 10px; margin: 2px 0; }

/* ===== Plan slots (agents list header) ===== */
.slots { font-size: 13px; color: var(--muted); margin-right: 12px; }

/* ===== Builder: character dials, chips, opening-portfolio table ===== */
#builder-rest { margin-top: 8px; }
.dial-edit { margin: 10px 0; }
.dial-edit .dial-ends { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.dial-edit .dial-name { color: var(--text); font-weight: 600; text-transform: capitalize; }
.dial-range { width: 100%; accent-color: var(--accent); cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; min-height: 22px; }
.chip.removable { display: inline-flex; align-items: center; gap: 4px; }
.chip.removable button { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px; line-height: 1; padding: 0; }
.chip.removable button:hover { color: var(--danger, #e5534b); }
.quick-rules { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip-btn { background: var(--panel-2); border: 1px dashed var(--border); border-radius: 999px; padding: 3px 10px; font-size: 11px; color: var(--muted); cursor: pointer; }
.chip-btn:hover { color: var(--text); border-style: solid; }
.port-table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.port-table th { text-align: left; font-size: 11px; color: var(--muted); font-weight: 500; padding: 4px 6px; }
.port-table td { padding: 4px 6px; vertical-align: middle; }
.input.mini { padding: 5px 8px; font-size: 13px; width: 100%; max-width: 130px; }
.amt-cell { display: flex; align-items: center; gap: 6px; }
.unit-toggle { background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; font-size: 11px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.unit-toggle:hover { color: var(--text); }
.val-cell { font-size: 13px; color: var(--text); white-space: nowrap; }
.icon-btn { background: none; border: none; cursor: pointer; font-size: 14px; opacity: 0.6; }
.icon-btn:hover { opacity: 1; }
.port-table .cash-row td { border-top: 1px solid var(--border); padding-top: 8px; font-weight: 600; }
.port-table .total-row td { padding-top: 8px; font-size: 14px; }

/* ===== Builder identity fields ===== */
.name-input { max-width: 300px; }
textarea.persona-input { width: 100%; resize: vertical; min-height: 64px; font-family: inherit; line-height: 1.4; }

/* ===== Builder: anchored dial fold ===== */
.dial-fold { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; margin: 6px 0 14px; background: var(--panel); }
.dial-fold > summary { cursor: pointer; font-weight: 600; font-size: 14px; list-style: none; }
.dial-fold > summary::-webkit-details-marker { display: none; }
.dial-fold > summary::before { content: "▸ "; color: var(--muted); }
.dial-fold[open] > summary::before { content: "▾ "; }
.marker-key { color: var(--accent); font-weight: 700; }
.dial-wrap { position: relative; }
.dial-home { position: absolute; top: -2px; width: 2px; height: 18px; background: var(--accent); opacity: 0.7; transform: translateX(-1px); pointer-events: none; z-index: 1; }
.dial-note { min-height: 15px; font-size: 11px; margin-top: 2px; }

/* ===== Agents list: active vs retired groups ===== */
.agent-group { margin-bottom: 22px; }
.group-label { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 4px 0 10px; }
.group-count { background: var(--panel-2); border-radius: 999px; padding: 1px 8px; font-size: 11px; margin-left: 4px; }
.port-table .prc-cell { font-size: 13px; color: var(--muted); white-space: nowrap; }

/* ===== Modal (confirmations + staged editors) ===== */
#modal-back { position: fixed; inset: 0; background: #0009; backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 100; }
#modal-back.hidden { display: none; }
#modal-box { background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 24px; max-width: 500px; width: calc(100% - 48px); max-height: 80vh; overflow: auto; }
#modal-box h3 { margin-top: 0; }
#modal-box .row { margin-top: 16px; }

/* ===== Performance chart (axes + range selector) ===== */
.perf-svg2 { width: 100%; height: auto; display: block; }
.perf-svg2 .axis { stroke: var(--border); stroke-width: 1; }
.perf-svg2 .grid { stroke: var(--border); stroke-width: 0.5; opacity: 0.5; }
.perf-svg2 .lbl { fill: var(--muted); font-size: 11px; }
.perf-svg2 .ln { fill: none; stroke-width: 2; }
.perf-svg2 .ln-agent { stroke: var(--accent); }
.perf-svg2 .ln-voo { stroke: var(--muted); stroke-dasharray: 4 3; }
.perf-ranges { display: flex; gap: 6px; }
.perf-ranges button { background: none; border: 1px solid var(--border); color: var(--muted);
  border-radius: 8px; padding: 2px 10px; font-size: 12px; cursor: pointer; }
.perf-ranges button.active { color: var(--text); border-color: var(--accent); }

/* ===== Portfolio: lot drill-down + totals row ===== */
.pos-row { cursor: pointer; }
.pos-row .caret { color: var(--muted); font-size: 11px; }
.lots-row td { background: var(--panel-2); padding: 0 12px 12px; }
.lots-box table { margin: 0; font-size: 13px; }
.totals-row td { border-top: 2px solid var(--border); font-weight: 700; }
