/* Good Hope v5: Learning hub (lh-), profile (pf-), admin console (ad-). Uses the tokens in styles.css. */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.choice.right { border-color: var(--sage); box-shadow: 0 0 0 1px var(--sage) inset; background: var(--sage-soft); }
.choice.wrong { border-color: var(--clay); box-shadow: 0 0 0 1px var(--clay) inset; background: var(--clay-soft); }
.chip[aria-checked="true"] { background: var(--accent); color: var(--on-accent); border-color: transparent; }

/* ================= LEARN ================= */
.lh > section { margin-bottom: 28px; }
.lh-head { display: grid; gap: 18px; align-items: end; }
@media (min-width: 720px) { .lh-head { grid-template-columns: 1fr auto; } }
.lh-level { display: flex; gap: 14px; align-items: center; padding: 14px 18px; text-decoration: none; color: inherit; border-radius: var(--r-lg); }
.lh-level > span:last-child { display: grid; gap: 2px; }
.lh-mini { font-size: .8rem; color: var(--muted); }
.lh-ring { --p: 0; width: 58px; height: 58px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--ember) calc(var(--p) * 1%), var(--surface-2) 0); position: relative; }
.lh-ring::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--surface); }
.lh-ring b { position: relative; font: 600 1.3rem/1 var(--serif); }
.lh-next { display: block; text-decoration: none; position: relative; overflow: hidden; }
.lh-next::after { content: ""; position: absolute; right: -40px; bottom: -60px; width: 200px; height: 200px; border-radius: 50%; background: radial-gradient(circle, rgba(226,162,74,.45), transparent 65%); pointer-events: none; }
.lh-insight { border-left: 3px solid var(--ember); }

.lh-tabs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 720px) { .lh-tabs { grid-template-columns: repeat(4, 1fr); } }
.lh-tab { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: center; text-align: left; padding: 12px 14px; border-radius: var(--r);
  border: 1.5px solid transparent; background: var(--surface-2); color: var(--text); font: inherit; cursor: pointer; transition: transform .2s var(--ease); }
.lh-tab.tint-gold { background: var(--ember-soft); } .lh-tab.tint-sage { background: var(--sage-soft); } .lh-tab.tint-lilac { background: var(--lilac-soft); } .lh-tab.tint-clay { background: var(--clay-soft); }
.lh-tab[aria-selected="true"] { border-color: var(--text); }
.lh-tab:active { transform: scale(.98); }
.lh-tab > span:nth-child(2) { display: grid; line-height: 1.2; }
.lh-tab .progress { grid-column: 1 / -1; height: 4px; background: rgba(42,27,61,.1); }
.lh-tic { font-size: 1.5rem; }

/* winding path (Duolingo-style), offset per node by --x */
.lh-path { list-style: none; margin: 0; padding: 4px 0 0; display: grid; gap: 6px; position: relative; }
.lh-path::before { content: ""; position: absolute; left: 50%; top: 20px; bottom: 30px; border-left: 3px dashed var(--line-strong); transform: translateX(-50%); }
.lh-node { position: relative; display: flex; justify-content: center; transform: translateX(calc(var(--x) * 64px)); }
.lh-node a { display: flex; flex-direction: column; align-items: center; gap: 6px; text-decoration: none; color: inherit; max-width: 220px; text-align: center; padding: 6px; }
.lh-dot { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--line-strong);
  box-shadow: 0 5px 0 var(--line-strong); font: 600 1.2rem/1 var(--serif); transition: transform .15s var(--ease); }
.lh-dot svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.lh-node a:hover .lh-dot { transform: translateY(-2px); }
.lh-node a:active .lh-dot { transform: translateY(3px); box-shadow: 0 2px 0 var(--line-strong); }
.lh-lbl { display: grid; gap: 1px; background: var(--bg); padding: 2px 8px; border-radius: 10px; }
.lh-lbl b { font-size: .95rem; line-height: 1.25; }
.lh-node.done .lh-dot { background: var(--sage); border-color: var(--sage); color: #fff; box-shadow: 0 5px 0 #3F6A53; }
.lh-node.now .lh-dot { background: var(--ember); border-color: var(--ember); color: var(--plum); box-shadow: 0 5px 0 #B07A2C; animation: lh-pulse 2.4s ease-in-out infinite; }
.lh-node.lock .lh-dot { background: var(--surface-2); color: var(--muted); }
.lh-node.lock .lh-lbl b { color: var(--muted); }
.lh-node.video .lh-dot { background: var(--plum); color: var(--ember); border-color: var(--plum); box-shadow: 0 5px 0 #160D22; }
@keyframes lh-pulse { 0%,100% { outline: 0 solid rgba(226,162,74,.4); } 50% { outline: 10px solid rgba(226,162,74,0); } }
@media (min-width: 720px) { .lh-node { transform: translateX(calc(var(--x) * 110px)); } }

.lh-games { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 720px) { .lh-games { grid-template-columns: repeat(4, 1fr); } }
.lh-game { display: grid; gap: 4px; padding: 16px; text-decoration: none; color: inherit; position: relative; box-shadow: none; }
.lh-gic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(255,255,255,.55); margin-bottom: 6px; }
.lh-gic svg { width: 22px; height: 22px; }
.lh-lock { position: absolute; top: 12px; right: 12px; color: var(--muted); }
.lh-quiz { display: flex; gap: 14px; align-items: center; text-decoration: none; color: inherit; box-shadow: none; }
.lh-quiz > span:last-child { margin-left: auto; }
.lh-badges { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; }
.lh-badge { flex: none; width: 96px; display: grid; justify-items: center; gap: 4px; text-align: center; padding: 12px 6px; border-radius: var(--r); background: var(--surface-2); font-size: .78rem; }
.lh-badge > span { font-size: 1.7rem; filter: grayscale(1); opacity: .45; }
.lh-badge b { color: var(--muted); font-weight: 600; line-height: 1.2; }
.lh-badge.on { background: var(--ember-soft); } .lh-badge.on > span { filter: none; opacity: 1; } .lh-badge.on b { color: var(--text); }

/* lesson player */
.lh-player .ob-top { gap: 12px; }
.lh-player .ob-top .back { font-size: 1rem; text-decoration: none; color: var(--text); }
.lh-q { font-size: clamp(1.5rem, 5vw, 2rem); margin: 0 0 18px; }
.lh-opts { gap: 10px; }
.lh-opts .choice { text-align: left; }
.lh-tip { margin-top: 18px; }
.lh-why.ok { background: var(--sage-soft); } .lh-why.no { background: var(--clay-soft); }
.lh-spot { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.lh-spot li { padding: 14px 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.lh-spot li p { margin: 0 0 10px; font-weight: 500; }
.lh-spot li.right { border-color: var(--sage); background: var(--sage-soft); } .lh-spot li.wrong { border-color: var(--clay); background: var(--clay-soft); }
.lh-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.lh-tags .chip.answer { outline: 2px solid var(--sage); outline-offset: 1px; }
.lh-sorted { margin: 0 0 14px; padding: 12px 12px 12px 36px; border-radius: var(--r); background: var(--surface); border: 1.5px dashed var(--line-strong); display: grid; gap: 8px; min-height: 52px; }
.lh-sorted li { padding: 2px 0; }
.lh-sorted li.right { color: var(--sage); font-weight: 600; } .lh-sorted li.wrong { color: var(--clay); font-weight: 600; }
.lh-empty { list-style: none; margin-left: -24px; color: var(--muted); }
.lh-pool { display: flex; flex-wrap: wrap; gap: 8px; }
.lh-pool .chip:disabled { opacity: .3; }
.lh-scale { padding: 18px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.lh-scale input[type=range] { width: 100%; accent-color: var(--ember); margin-bottom: 10px; }
.lh-private { margin-top: 8px; }
.lh-done { text-align: center; position: relative; padding-top: 16px; }
.lh-res { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0; }
.lh-res .card { padding: 14px 8px; display: grid; gap: 2px; }
.lh-res b { font-size: 1.6rem; }
.lh-lvl { text-align: left; margin-bottom: 14px; }
.lh-newbadge { display: flex; gap: 12px; align-items: center; text-align: left; margin-bottom: 10px; animation: rise .5s var(--ease); }
.lh-newbadge > span:last-child { display: grid; }
.lh-burst { position: absolute; inset: 0; pointer-events: none; }
.lh-burst i { position: absolute; left: 50%; top: 60px; color: var(--ember); font-style: normal; animation: lh-burst 1.4s var(--ease) forwards; --a: calc(var(--i) * 36deg); }
@keyframes lh-burst { from { transform: rotate(var(--a)) translateY(0) scale(.4); opacity: 1; } to { transform: rotate(var(--a)) translateY(-110px) scale(1); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .lh-burst, .lh-node.now .lh-dot { animation: none !important; } .lh-burst { display: none; } }

/* ================= PROFILE ================= */
.pf > section { margin-bottom: 28px; }
.pf-hero { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; padding-top: 8px; }
.pf-avatar { width: 84px; height: 84px; border-radius: 28px; display: grid; place-items: center; font-size: 2.6rem; background: linear-gradient(145deg, var(--ember-soft), var(--lilac-soft)); box-shadow: var(--shadow); }
.pf-id h1 { font-size: clamp(1.8rem, 6vw, 2.4rem); margin: 0; }
.pf-bio { margin: 8px 0 0; max-width: 46ch; }
.pf-goals { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.pf-goals .chip { font-size: .8rem; padding: 6px 10px; }
.pf-edit { grid-column: 1 / -1; justify-self: start; }
@media (min-width: 720px) { .pf-hero { grid-template-columns: auto 1fr auto; } .pf-edit { grid-column: auto; align-self: start; } }
.pf-bento { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 720px) { .pf-bento { grid-template-columns: repeat(4, 1fr); } }
.pf-bento .card { text-decoration: none; color: inherit; padding: 16px; display: grid; gap: 4px; align-content: start; }
.pf-bento b.serif { font-size: 1.8rem; line-height: 1.1; }
.pf-lvl { grid-column: span 2; }
.pf-lvl .progress { margin: 6px 0 2px; flex: none; }
.pf-streak { grid-column: span 2; grid-template-columns: auto 1fr; align-items: center; column-gap: 12px; }
.pf-streak .pf-flame { grid-row: span 2; font-size: 2.2rem; }
@media (min-width: 720px) { .pf-streak { grid-column: span 2; } }
.pf-stat { box-shadow: none; }
.pf-heat-card { overflow-x: auto; }
.pf-heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 4px; width: max-content; }
.pf-heat i, .pf-heat-key i { width: 14px; height: 14px; border-radius: 4px; display: block; background: var(--surface-2); }
.pf-heat i.h1, .pf-heat-key i.h1 { background: #F2DDB8; } .pf-heat i.h2, .pf-heat-key i.h2 { background: #E8BE78; }
.pf-heat i.h3, .pf-heat-key i.h3 { background: #D99B3C; } .pf-heat i.h4, .pf-heat-key i.h4 { background: #A86B17; }
.pf-heat-key { display: flex; gap: 4px; align-items: center; margin-top: 10px; }
.pf-heat-key span { margin: 0 4px; }
.pf-badges { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 720px) { .pf-badges { grid-template-columns: repeat(5, 1fr); } }
.pf-badge { display: grid; justify-items: center; text-align: center; gap: 3px; padding: 14px 10px; border-radius: var(--r); background: var(--surface-2); }
.pf-bi { font-size: 1.9rem; filter: grayscale(1); opacity: .4; }
.pf-badge b { font-size: .9rem; color: var(--muted); }
.pf-badge .small { font-size: .75rem; line-height: 1.3; }
.pf-badge.on { background: var(--ember-soft); } .pf-badge.on .pf-bi { filter: none; opacity: 1; } .pf-badge.on b { color: var(--text); }
.pf-journal { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.pf-journal li { padding: 16px 18px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.pf-prompt { margin: 8px 0 4px; font: italic 500 .95rem/1.4 var(--serif); color: var(--muted); }
.pf-entry { margin: 0; white-space: pre-wrap; }
.pf-av-pick { border: 0; padding: 0; margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.pf-av-pick legend { margin-bottom: 8px; }
.pf-av-pick label { cursor: pointer; }
.pf-av-pick input { position: absolute; opacity: 0; }
.pf-av-pick span { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 1.5rem; background: var(--surface-2); border: 2px solid transparent; }
.pf-av-pick input:checked + span { border-color: var(--text); background: var(--ember-soft); }
.pf-av-pick input:focus-visible + span { outline: 2px solid var(--ember); outline-offset: 2px; }
.sheet textarea, .sheet select { width: 100%; }

/* ================= ADMIN ================= */
#root[data-layout="admin"] { min-height: 100dvh; }
main.cx { display: grid; grid-template-columns: 1fr; min-height: 100dvh; width: 100%; }

.cx-side { background: color-mix(in oklab, var(--surface) 86%, transparent); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 12px 16px 0; position: sticky; top: 10px; z-index: 20; margin: 10px 12px 0; overflow: hidden; backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4); }
@media (min-width: 960px) { .cx-side { top: 14px; margin: 14px 0 14px 14px; height: calc(100dvh - 28px); border-radius: 26px; padding: 22px 14px; display: flex; flex-direction: column; overflow: visible; } main.cx { grid-template-columns: 254px 1fr; } }
.cx-brand { display: flex; gap: 10px; align-items: center; text-decoration: none; color: var(--text); margin-bottom: 10px; }
.cx-brand svg { width: 32px; height: 32px; }
.cx-brand span { display: grid; line-height: 1.1; } .cx-brand b { font: 600 1.05rem/1 var(--serif); } .cx-brand small { font-size: .6rem; letter-spacing: .16em; color: var(--muted); margin-top: 3px; }
.cx-nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding-inline: 12px; }
.cx-nav::-webkit-scrollbar { display: none; }
.cx-nav a { flex: none; display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-radius: 12px; color: var(--muted); text-decoration: none; font-weight: 500; font-size: .92rem; border-bottom: 2px solid transparent; }
.cx-nav a:hover { color: var(--text); background: var(--surface-2); }
.cx-nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
@media (max-width: 959px) { .cx-nav a { border-radius: 10px 10px 0 0; } .cx-nav a[aria-current="page"] { background: transparent; border-bottom-color: var(--ember); } .cx-side-foot { display: none; } }
@media (min-width: 960px) { .cx-nav { flex-direction: column; margin: 18px 0 0; padding: 0; overflow: visible; } }
.cx-badge { margin-left: auto; font-style: normal; font-size: .7rem; font-weight: 700; background: var(--clay); color: #fff; border-radius: 99px; padding: 2px 7px; }
.cx-side-foot { margin-top: auto; display: grid; gap: 8px; font-size: .8rem; }
.cx-side-foot .small { word-break: break-all; }
.cx-test { justify-self: start; font: 700 .64rem/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; padding: 6px 9px; border-radius: 99px; background: var(--ember-soft); color: var(--text); }
.cx-body { padding: 20px 16px 80px; min-width: 0; }
@media (min-width: 960px) { .cx-body { padding: 30px 36px 80px; } }
.cx-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.cx-top h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); margin: 0; }
.cx-h { font: 600 1.05rem/1.3 var(--sans); margin: 0 0 12px; }
.cx-body h2.cx-h { margin-top: 24px; } .cx-body .card h2.cx-h, .cx-grid h2.cx-h { margin-top: 0; }
.cx-drawer h3.cx-h { margin-top: 22px; font-size: .95rem; }
.cx-seg { display: inline-flex; padding: 3px; background: var(--surface-2); border-radius: 12px; gap: 2px; }
.cx-seg a, .cx-seg button { padding: 7px 12px; border-radius: 9px; font: 500 .85rem/1 var(--sans); color: var(--muted); text-decoration: none; border: 0; background: none; cursor: pointer; }
.cx-seg a[aria-current="true"], .cx-seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.cx-seg.sm a, .cx-seg.sm button { padding: 5px 10px; font-size: .78rem; }
.cx-alert { display: grid; gap: 2px; margin-bottom: 14px; padding: 14px 18px; text-decoration: none; color: inherit; }
.cx-kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
@media (min-width: 720px) { .cx-kpis { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1280px) { .cx-kpis { grid-template-columns: repeat(7, 1fr); } }
.cx-kpi { padding: 14px 16px; display: grid; gap: 4px; align-content: start; }
.cx-kpi b.serif { font-size: 1.75rem; line-height: 1.05; font-variant-numeric: tabular-nums; }
.cx-hint { font-size: .72rem; }
.cx-delta { font-size: .74rem; font-weight: 600; }
.cx-delta.up { color: var(--sage); } .cx-delta.down { color: var(--clay); } .cx-delta.flat { color: var(--muted); font-weight: 500; }
.cx-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .cx-grid { grid-template-columns: repeat(2, 1fr); } .cx-span2 { grid-column: span 2; } }
@media (min-width: 1280px) { .cx-grid { grid-template-columns: repeat(3, 1fr); } }
.cx-grid > .card { padding: 18px; min-width: 0; }
.cx-chart { position: relative; margin-top: 10px; }
.cx-svg { width: 100%; height: auto; display: block; overflow: visible; }
.cx-grid-l { stroke: var(--line); stroke-width: 1; }
.cx-ax { fill: var(--muted); font: 500 11px var(--sans); }
.cx-cross { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 3 3; }
.cx-tip { position: absolute; top: -6px; width: 140px; padding: 8px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow); pointer-events: none; display: grid; font-size: .85rem; }
.cx-tip b { font: 600 1.15rem/1.1 var(--serif); }
.cx-table-view summary { cursor: pointer; margin-top: 8px; }
.cx-stack { display: flex; height: 18px; border-radius: 6px; overflow: hidden; gap: 2px; background: var(--surface-2); margin: 6px 0 14px; }
.cx-stack i { display: block; min-width: 4px; }
.cx-legend { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.cx-legend li { display: grid; grid-template-columns: 12px 1fr auto 44px; gap: 10px; align-items: center; font-size: .9rem; }
.cx-legend li i, .cx-tier i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.cx-legend .small { text-align: right; }
.cx-funnel { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.cx-bar { height: 8px; border-radius: 99px; background: var(--surface-2); margin-top: 4px; overflow: hidden; }
.cx-bar i { display: block; height: 100%; background: #C98420; border-radius: 99px; }
.cx-rank { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.cx-rank li { padding-left: 4px; } .cx-rank li::marker { color: var(--muted); font-size: .8rem; }
.cx-rank li, .cx-mini li { display: list-item; }
.cx-rank li > span { display: inline; } .cx-rank li > b { float: right; font-variant-numeric: tabular-nums; }
.cx-people { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.cx-person { width: 100%; display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; text-align: left; padding: 8px; border-radius: 12px; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.cx-person:hover { background: var(--surface-2); }
.cx-person > span:nth-child(2) { display: grid; line-height: 1.25; }
.cx-av { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--lilac-soft); color: var(--text); font: 600 .95rem/1 var(--serif); }
.cx-av.sm { width: 26px; height: 26px; font-size: .8rem; } .cx-av.lg { width: 56px; height: 56px; font-size: 1.4rem; }
.cx-tier { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; white-space: nowrap; }
.cx-check { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.cx-check li { display: flex; gap: 10px; align-items: center; font-size: .92rem; }
.cx-check li > span:first-child { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-size: .75rem; flex: none; }
.cx-check li.ok > span:first-child { background: var(--sage); color: #fff; } .cx-check li.ok > span:nth-child(2) { color: var(--muted); text-decoration: line-through; }

.cx-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.cx-filters input, .cx-filters select, .cx-comp select, .cx-rform input { padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font: inherit; font-size: .9rem; }
.cx-filters input { flex: 1 1 220px; }
.cx-table { width: 100%; }
.cx-table td, .cx-table th { vertical-align: middle; }
.cx-table th.num, .cx-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.cx-table tr[data-member] { cursor: pointer; }
.cx-table tr[data-member]:hover td, .cx-table tr[data-member]:focus td { background: var(--surface-2); }
.cx-table.compact td, .cx-table.compact th { padding: 8px 6px; font-size: .86rem; }
.cx-person-cell { display: flex; gap: 10px; align-items: center; }
.cx-paused { background: var(--clay-soft); color: var(--clay); }
.cx-pages { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }
.cx-tracks { display: grid; gap: 14px; }
@media (min-width: 1100px) { .cx-tracks { grid-template-columns: repeat(2, 1fr); } }
.cx-tracks .card { padding: 16px; overflow-x: auto; }

.cx-drawer-bg { display: flex; justify-content: flex-end; align-items: stretch; }
.cx-drawer { width: min(480px, 100%); height: 100dvh; overflow-y: auto; background: var(--bg); padding: 20px; box-shadow: var(--shadow-lg); animation: cx-in .3s var(--ease); }
@keyframes cx-in { from { transform: translateX(40px); opacity: 0; } }
.cx-dhead { display: flex; gap: 14px; align-items: center; margin: 14px 0; }
.cx-dhead h2 { font-size: 1.6rem; margin: 0; }
.cx-dplan { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.cx-dstats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.cx-dstats > div { display: grid; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.cx-dstats b { font-size: 1.4rem; line-height: 1.1; }
.cx-privacy { padding: 10px 12px; border-radius: 12px; background: var(--lilac-soft); }
.cx-comp { display: flex; gap: 8px; flex-wrap: wrap; }
.cx-mini { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.cx-mini li { display: flex; justify-content: space-between; gap: 10px; font-size: .86rem; padding: 8px 0; border-bottom: 1px solid var(--line); }
.cx-reports { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.cx-reports .card { padding: 16px 18px; }
.cx-safety { border-left: 4px solid var(--clay); }
.cx-msg { margin: 10px 0 6px; white-space: pre-wrap; }
.cx-rform { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.cx-rform input { flex: 1 1 200px; }
.cx-log { list-style: none; padding: 0; margin: 0; display: grid; }
.cx-log li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.cx-skel { height: 120px; border-radius: var(--r); background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2)); background-size: 200% 100%; animation: cx-shim 1.2s linear infinite; margin-bottom: 12px; }
@keyframes cx-shim { to { background-position: -200% 0; } }
.cx-deny { grid-column: 1 / -1; min-height: 80dvh; display: grid; place-content: center; justify-items: center; text-align: center; gap: 8px; padding: 24px; }
@media (prefers-reduced-motion: reduce) { .cx-skel, .cx-drawer { animation: none; } }
:root[data-theme="dark"] .pf-heat i.h1, :root[data-theme="dark"] .pf-heat-key i.h1 { background: #4A3517; } :root[data-theme="dark"] .pf-heat i.h2, :root[data-theme="dark"] .pf-heat-key i.h2 { background: #7A5419; }
:root[data-theme="dark"] .pf-heat i.h3, :root[data-theme="dark"] .pf-heat-key i.h3 { background: #B0782A; } :root[data-theme="dark"] .pf-heat i.h4, :root[data-theme="dark"] .pf-heat-key i.h4 { background: #E8B25E; }
:root[data-theme="dark"] .lh-tab .progress { background: rgba(247,241,232,.12); } :root[data-theme="dark"] .lh-gic { background: rgba(0,0,0,.2); }
@media (max-width: 480px) { .lh-node { transform: translateX(calc(var(--x) * 26px)); } .lh-node a { max-width: 180px; } }
.lh-path { overflow-x: clip; padding-inline: 4px; }

/* ===== Automation hub (automation.js) — ax- ===== */
.cx-hub-link { margin-bottom: 4px; }
.ax-mode { font: 600 .72rem/1 var(--sans); padding: 6px 10px; border-radius: 99px; background: var(--surface-2); color: var(--muted); width: fit-content; }
.ax-mode.live { background: var(--sage-soft); color: var(--text); } .ax-mode.live::before { content: "●  "; color: var(--sage); }
.ax-mode.test::before { content: "○  "; }
.ax-st { font: 600 .68rem/1 var(--sans); padding: 3px 7px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.ax-st.ax-sent, .ax-st.ax-delivered { background: var(--sage-soft); color: var(--text); }
.ax-st.ax-blocked, .ax-st.ax-failed { background: var(--clay-soft); color: var(--clay); }
.ax-st.ax-queued, .ax-st.ax-draft { background: var(--ember-soft); color: var(--text); }
.ax-ch { font: 600 .68rem/1 var(--sans); padding: 3px 7px; border-radius: 99px; color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); }
.ax-key { display: flex; gap: 12px; list-style: none; margin: 0; padding: 0; font-size: .8rem; color: var(--muted); }
.ax-key i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; }
.ax-setup { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 10px; }
.ax-setup li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; font-size: .9rem; }
.ax-setup li.ok { color: var(--muted); }
.ax-tick { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line-strong); display: grid; place-items: center; font-size: .7rem; font-weight: 700; }
.ax-setup li.ok .ax-tick { background: var(--sage); border-color: var(--sage); color: #fff; }
.ax-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); margin-right: 8px; } .ax-dot.on { background: var(--sage); }
.ax-empty { padding: 28px 12px; text-align: center; color: var(--muted); list-style: none; }
.ax-search input { width: 100%; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font: inherit; color: var(--text); }
/* inbox */
.ax-inbox { display: grid; grid-template-columns: minmax(240px, 340px) 1fr; gap: 14px; height: calc(100dvh - 150px); min-height: 520px; }
.ax-list, .ax-convo { display: flex; flex-direction: column; min-height: 0; padding: 12px; }
.ax-threads { list-style: none; margin: 10px 0 0; padding: 0; overflow-y: auto; flex: 1; }
.ax-threads a { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px; border-radius: 12px; color: var(--text); text-decoration: none; }
.ax-threads a:hover { background: var(--surface-2); } .ax-threads a.on { background: var(--ember-soft); }
.ax-threads a > span:nth-child(2) { min-width: 0; display: grid; } .ax-threads a .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ax-threads a.unread b::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ember); margin-left: 6px; vertical-align: middle; }
.ax-meta { display: grid; justify-items: end; gap: 4px; }
.ax-flag { color: var(--clay); } .ax-dr { font: 600 .66rem/1 var(--sans); color: var(--ember); }
.ax-chead { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.ax-chead .tag { margin: 0 0 0 6px; padding: 4px 7px; } .ax-cact { gap: 6px; flex-wrap: wrap; justify-content: end; }
.ax-reach { display: flex; gap: 12px; flex-wrap: wrap; padding: 8px 0; } .ax-reach .ok { color: var(--sage); } .ax-reach .no { color: var(--muted); }
.ax-msgs { list-style: none; margin: 0; padding: 8px 2px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; min-height: 120px; }
.ax-msg { display: grid; max-width: 78%; gap: 4px; }
.ax-msg.outbound { align-self: end; justify-items: end; } .ax-msg.inbound { align-self: start; }
.ax-bub { padding: 10px 14px; border-radius: 18px; background: var(--surface-2); line-height: 1.45; font-size: .93rem; overflow-wrap: anywhere; }
.ax-msg.outbound .ax-bub { background: var(--plum); color: #F7F1E8; border-bottom-right-radius: 6px; }
.ax-msg.inbound .ax-bub { border-bottom-left-radius: 6px; }
.ax-msg.draft .ax-bub { background: var(--ember-soft); color: var(--text); border: 1.5px dashed var(--ember); }
.ax-bub details { margin-top: 8px; opacity: .9; }
.ax-by { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ax-draft-act { gap: 6px; }
.ax-note { align-self: center; max-width: 86%; text-align: center; background: var(--lilac-soft); border-radius: 12px; padding: 8px 12px; font-size: .86rem; }
.ax-note.safety { background: var(--clay-soft); } .ax-note p { margin: 2px 0 0; }
.ax-comp { border-top: 1px solid var(--line); padding-top: 10px; display: grid; gap: 8px; }
.ax-comp-top { justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.ax-comp textarea, .ax-comp input, .ax-form input, .ax-form textarea, .ax-form select, .ax-inline input, .ax-inline select, .ax-when select, .ax-ai select { width: 100%; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; }
.ax-ai { gap: 6px; } .ax-ai select { width: auto; padding: 6px 10px; font-size: .85rem; }
/* forms */
.ax-form { display: grid; gap: 12px; }
.ax-form label { display: grid; gap: 5px; font-size: .86rem; font-weight: 500; }
.ax-form fieldset { border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; display: grid; gap: 8px; margin: 0; }
.ax-form legend { font-size: .8rem; font-weight: 600; padding: 0 4px; color: var(--muted); }
.ax-form label.ax-check, .ax-check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.ax-check input { width: auto !important; accent-color: var(--plum); }
.ax-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ax-inline { display: flex; gap: 8px; margin-top: 8px; } .ax-inline input, .ax-inline select { flex: 1; }
.ax-n { width: 72px !important; display: inline-block; }
.ax-dt { font-size: 1.3rem; margin: 0; }
.cx-drawer.ax-wide { width: min(720px, 100%); }
.ax-consent-log li { align-items: start; }
.ax-pref { display: grid !important; grid-template-columns: auto 1fr; gap: 12px; align-items: start; padding: 12px; border: 1px solid var(--line); border-radius: 14px; font-weight: 400 !important; }
.ax-pref input { width: 20px !important; height: 20px; margin-top: 2px; accent-color: var(--plum); }
.ax-pref span { display: grid; gap: 4px; }
/* cards */
.ax-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.ax-agent, .ax-tpl, .ax-recipe { display: grid; gap: 8px; align-content: start; text-align: left; font: inherit; color: var(--text); cursor: pointer; border: 1px solid var(--line); transition: transform .2s var(--ease), box-shadow .2s var(--ease); }
.ax-recipe { cursor: default; }
.ax-agent:hover, .ax-tpl:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.ax-orb { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: radial-gradient(circle at 30% 30%, #F3C887, var(--ember) 55%, var(--plum)); box-shadow: 0 6px 18px color-mix(in srgb, var(--ember) 35%, transparent); }
.ax-tags { gap: 6px; flex-wrap: wrap; } .ax-tags .tag { margin: 0; padding: 4px 8px; }
.ax-clip { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ax-test { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 6px; }
.ax-test .ax-msgs { max-height: 300px; min-height: 80px; background: var(--surface); border-radius: 14px; padding: 10px; margin: 10px 0; }
/* workflows */
.ax-wfs { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; margin-bottom: 26px; }
.ax-wf { display: grid; gap: 12px; }
.ax-flow { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); display: grid; gap: 8px; }
.ax-flow.sm { gap: 5px; font-size: .85rem; }
.ax-step { position: relative; display: flex; gap: 8px; align-items: center; font-size: .88rem; }
.ax-step::before { content: ""; position: absolute; left: -20px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); }
.ax-step.send::before { border-color: var(--ember); background: var(--ember); } .ax-step.wait { color: var(--muted); } .ax-step.stop_if::before { border-color: var(--clay); }
.ax-switch { position: relative; width: 42px; height: 24px; flex: none; }
.ax-switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.ax-switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--line-strong); transition: background .2s; }
.ax-switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.ax-switch input:checked + span { background: var(--sage); } .ax-switch input:checked + span::after { transform: translateX(18px); }
.ax-switch input:focus-visible + span { outline: 2px solid var(--ember); outline-offset: 2px; }
.ax-lbl { font: 700 .66rem/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.ax-when { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } .ax-when select { width: auto; flex: 1; }
.ax-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: s; }
.ax-sedit { display: grid; gap: 8px; padding: 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line-strong); }
.ax-sedit.send { border-left-color: var(--ember); } .ax-sedit.stop_if { border-left-color: var(--clay); } .ax-sedit.notify { border-left-color: var(--sage); }
.ax-sedit select, .ax-sedit input, .ax-sedit textarea { width: 100%; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; }
.ax-pick { display: flex; flex-wrap: wrap; gap: 6px; }
/* settings */
.ax-hooks li { align-items: start; flex-direction: column; gap: 4px; }
.ax-copy { display: flex; gap: 8px; align-items: center; max-width: 100%; }
.ax-copy code { font-size: .75rem; background: var(--surface-2); padding: 4px 8px; border-radius: 8px; overflow-x: auto; white-space: nowrap; max-width: 520px; }
.ax-code { font-size: .75rem; background: var(--surface-2); padding: 12px; border-radius: 12px; overflow-x: auto; white-space: pre; max-height: 260px; }
.ax-q { gap: 6px; align-items: center; }
.ax-confirm { margin-top: 12px; display: grid; gap: 8px; }
.ax-vars { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; } .ax-vars .tag { margin: 0; cursor: pointer; border: 0; text-transform: none; letter-spacing: 0; font-weight: 600; }
.ax-ok { color: var(--sage); font-weight: 700; } .ax-no { color: var(--clay); font-weight: 700; } .ax-na { color: var(--line-strong); }
@media (max-width: 860px) {
  .ax-inbox { grid-template-columns: 1fr; height: auto; }
  .ax-list { max-height: 320px; } .ax-convo { min-height: 70dvh; }
  .ax-2 { grid-template-columns: 1fr; } .ax-msg { max-width: 92%; }
}
