/* =========================================================================
   WV DUNA — Integrated App (post-login experience)
   The DUNAVERSE, continued. One app, two modes:
     • Active Mode  — Chat · Vibe · Seek · Vote · Earn   (formerly Kiduna Club)
     • Builder Mode — Studio: Agents/Inform/Instruct/Empower/Align + economy
   Consumes colors_and_type.css + styles.css (load those FIRST), then this.
   One accent only (Old Gold). Mode + level are signalled by label/icon/lock,
   never by a second brand color.
   ========================================================================= */

:root {
  --appbar-h: 60px;
  --rail-w: 252px;
  --rail-w-collapsed: 76px;
  --thread-max: 760px;
}

* { box-sizing: border-box; }
/* The hidden attribute must always win over component display rules
   (.app/.auth-wrap/.rail/.install-banner all set display via their class). */
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg-deep); color: var(--fg); overflow: hidden; }
button { font-family: var(--font-sans); }
::selection { background: var(--wv-gold-soft); }

/* Scrollbars — quiet, on-brand */
.scroll, .main-scroll, .chatlist, .thread-scroll { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.scroll::-webkit-scrollbar, .main-scroll::-webkit-scrollbar, .chatlist::-webkit-scrollbar, .thread-scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.scroll::-webkit-scrollbar-thumb, .main-scroll::-webkit-scrollbar-thumb, .chatlist::-webkit-scrollbar-thumb, .thread-scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }

/* =========================================================================
   APP FRAME
   ========================================================================= */
.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  background:
    radial-gradient(1100px 480px at 92% -12%, rgba(234,170,0,0.10), transparent 60%),
    radial-gradient(760px 520px at -8% 8%, rgba(3,204,217,0.07), transparent 60%),
    var(--bg-deep);
}
.app[hidden] { display: none; }

/* ---------- App bar ---------- */
.appbar {
  display: flex; align-items: center; gap: 14px;
  height: var(--appbar-h); padding: 0 16px;
  background: rgba(9,7,58,0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: relative; z-index: 50;
}
.appbar .brand-lockup { display: flex; align-items: center; gap: 9px; }
.appbar .brand-logo { height: 26px; width: auto; }
.appbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.appbar-spacer { flex: 1; }
.appbar-right { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 38px; height: 38px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: transparent; border: 1px solid transparent; border-radius: var(--radius-md);
  color: var(--fg-muted); cursor: pointer; transition: 140ms; position: relative;
}
.icon-btn:hover { color: var(--fg); background: var(--surface-muted); border-color: var(--border); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn .dot-badge { position: absolute; top: 7px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px rgba(9,7,58,0.9); }
.hamburger { display: none; }

/* DUNA / workspace switcher */
.ws-switch {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 6px 8px; border-radius: var(--radius-pill);
  background: var(--surface); border: 1px solid var(--border); cursor: pointer; transition: 140ms; min-width: 0;
}
.ws-switch:hover { border-color: var(--border-strong); }
.ws-coin { width: 28px; height: 28px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center; font-family: var(--font-display); font-size: 0.72rem; color: var(--on-accent); background: var(--accent); }
.ws-meta { min-width: 0; line-height: 1.05; }
.ws-name { font-weight: 700; font-size: 0.86rem; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.ws-sub { font-size: 0.66rem; color: var(--fg-soft); white-space: nowrap; }
.ws-switch .chev { color: var(--fg-soft); }

/* Mode toggle (segmented Active | Builder) */
.mode-toggle { display: inline-flex; background: var(--bg-deep); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 3px; gap: 2px; }
.mode-toggle button { display: inline-flex; align-items: center; gap: 7px; border: 0; background: transparent; color: var(--fg-muted); font-weight: 700; font-size: 0.82rem; padding: 7px 14px; border-radius: var(--radius-pill); cursor: pointer; transition: 140ms; white-space: nowrap; }
.mode-toggle button svg { width: 16px; height: 16px; }
.mode-toggle button:hover { color: var(--fg); }
.mode-toggle button.active { background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-sm); }

/* Level badge + avatar */
.level-badge { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 8px; border-radius: var(--radius-pill); background: var(--wv-gold-soft); border: 1px solid rgba(234,170,0,0.42); cursor: pointer; transition: 140ms; }
.level-badge:hover { border-color: var(--accent); }
.level-badge .pips { display: inline-flex; gap: 3px; }
.level-badge .pips i { width: 5px; height: 5px; border-radius: 50%; background: rgba(255,255,255,0.22); }
.level-badge .pips i.on { background: var(--accent); }
.level-badge .lvl-name { font-family: var(--font-display); font-size: 0.92rem; color: var(--accent); line-height: 1; }
.avatar-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border-strong); background: radial-gradient(circle at 50% 30%, var(--surface-elev), var(--bg)); color: var(--fg); font-family: var(--font-display); display: grid; place-items: center; cursor: pointer; flex: 0 0 auto; }
.avatar-btn:hover { border-color: var(--accent); }

/* =========================================================================
   BODY: rail + main
   ========================================================================= */
.app-body { flex: 1 1 auto; display: grid; grid-template-columns: var(--rail-w) 1fr; min-height: 0; }
/* Builder rail as slide-over drawer on mobile */
.rail.as-drawer { display: flex; position: fixed; top: var(--appbar-h); left: 0; bottom: 0; width: 264px; z-index: 210; background: var(--bg); box-shadow: var(--shadow-lg); padding: 14px 12px; align-items: stretch; }
.rail.as-drawer .nav-group-label { font-size: 0.6rem; }
.rail.as-drawer .nav-group-label::after { display: none; }
.rail.as-drawer .navitem { justify-content: flex-start; padding: 9px 12px; }
.rail.as-drawer .navitem span.nv-label { display: inline; }

/* ---------- Side rail ---------- */
.rail { border-right: 1px solid var(--border); background: rgba(3,1,27,0.34); display: flex; flex-direction: column; min-height: 0; overflow-y: auto; padding: 14px 12px 18px; }
.rail-scroll { display: flex; flex-direction: column; gap: 2px; }
.nav-group-label { font-size: 0.6rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--fg-dim); padding: 16px 12px 6px; }
.nav-group-label:first-child { padding-top: 4px; }
.navitem { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--radius-md); color: var(--fg-muted); font-weight: 600; font-size: 0.92rem; cursor: pointer; border: 1px solid transparent; transition: 120ms; position: relative; text-align: left; background: transparent; width: 100%; }
.navitem svg { width: 19px; height: 19px; flex: 0 0 auto; opacity: 0.92; }
.navitem:hover { color: var(--fg); background: var(--surface-muted); }
.navitem.active { color: var(--fg); background: var(--wv-gold-soft); border-color: rgba(234,170,0,0.32); }
.navitem.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 999px; background: var(--accent); }
.navitem .count { margin-left: auto; font-size: 0.66rem; font-weight: 700; color: var(--fg-soft); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 1px 7px; }
.navitem .lock { margin-left: auto; color: var(--fg-dim); width: 15px; height: 15px; }
.navitem.locked { opacity: 0.55; }
.navitem.locked:hover { opacity: 0.8; }

.rail-foot { margin-top: auto; padding-top: 14px; }
.upgrade-mini { display: block; padding: 12px 14px; border-radius: var(--radius-md); border: 1px solid rgba(234,170,0,0.3); background: linear-gradient(180deg, rgba(234,170,0,0.12), transparent); }
.upgrade-mini .t { font-family: var(--font-display); font-size: 1rem; color: var(--fg); }
.upgrade-mini .s { font-size: 0.76rem; color: var(--fg-soft); margin: 3px 0 9px; }

/* ---------- Main ---------- */
.main { min-width: 0; min-height: 0; position: relative; display: flex; flex-direction: column; }
.main-scroll { overflow-y: auto; flex: 1; min-height: 0; }
.view { display: none; }
.view.is-active { display: block; }
.page { max-width: 1080px; margin: 0 auto; padding: 30px 30px 80px; }
.page-wide { max-width: 1240px; }

/* Page header */
.pg-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.pg-title { font-family: var(--font-display); font-weight: 400; font-size: 2.1rem; line-height: 1; margin: 0; }
.pg-sub { color: var(--fg-soft); font-size: 0.9rem; margin: 6px 0 0; }
.pg-eyebrow { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--kin-skyblue); margin-bottom: 8px; }

/* Buttons reused: .btn .btn-gold .btn-ghost from styles.css; add small/icon */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-family: var(--font-sans); font-weight: 700; font-size: 0.92rem; padding: 0.7rem 1.25rem; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer; transition: 140ms; text-align: center; line-height: 1; }
.btn svg { width: 16px; height: 16px; }
.btn-gold { background: var(--accent); color: var(--on-accent); }
.btn-gold:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--fg); border-color: var(--border-strong); }
.btn-ghost:hover { border-color: var(--fg); }
.btn-soft { background: var(--surface); color: var(--fg); border-color: var(--border); }
.btn-soft:hover { border-color: var(--border-strong); }
.btn-sm { font-size: 0.8rem; padding: 0.48rem 0.9rem; }
.btn-block { width: 100%; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.chip { font-family: var(--font-sans); font-weight: 700; font-size: 0.82rem; padding: 0.46rem 0.95rem; border-radius: var(--radius-pill); background: var(--surface); border: 1px solid var(--border); color: var(--fg-muted); cursor: pointer; transition: 120ms; display: inline-flex; align-items: center; gap: 7px; }
.chip:hover { border-color: var(--border-strong); color: var(--fg); }
.chip.active { background: var(--wv-gold-soft); border-color: rgba(234,170,0,0.5); color: var(--accent); }
.chip .n { font-size: 0.7rem; opacity: 0.8; }

/* Generic grids */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }

/* Cards (app flavor of .acard) */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; transition: 140ms; }
.card.hover:hover, a.card:hover, button.card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.card .kicker { font-size: 0.64rem; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 700; color: var(--accent); }
.card h3 { font-family: var(--font-display); font-weight: 400; font-size: 1.3rem; margin: 6px 0 6px; line-height: 1.1; color: var(--fg); }
.card p { color: var(--fg-muted); font-size: 0.92rem; margin: 0; }
.tile-ico { width: 44px; height: 44px; border-radius: var(--radius-md); display: grid; place-items: center; background: var(--surface-elev); border: 1px solid var(--border); color: var(--accent); margin-bottom: 12px; }
.tile-ico svg { width: 22px; height: 22px; }

/* Tag pills (Ally type tags etc.) */
.tag { font-size: 0.58rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; padding: 3px 8px; border-radius: var(--radius-pill); border: 1px solid var(--border); color: var(--fg-soft); }
.tag.gold { color: var(--accent); border-color: rgba(234,170,0,0.5); background: var(--wv-gold-soft); }
.tag.sky { color: #9beef4; border-color: rgba(3,204,217,0.5); background: rgba(3,204,217,0.12); }
.tag.green { color: var(--success); border-color: rgba(0,235,117,0.4); background: rgba(0,235,117,0.1); }

/* =========================================================================
   CHAT (Active Mode default + first-run)
   ========================================================================= */
.chat-layout { display: grid; grid-template-columns: 320px 1fr; height: 100%; min-height: 0; }
.chat-aside { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.chat-aside-head { padding: 16px 16px 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.chat-aside-head h2 { font-family: var(--font-display); font-weight: 400; font-size: 1.5rem; margin: 0; }
.chat-search { padding: 0 16px 12px; }
.input-ico { position: relative; }
.input-ico svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--fg-soft); pointer-events: none; }
.input-ico input { width: 100%; padding: 0.6rem 0.8rem 0.6rem 2.2rem; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); color: var(--fg); font-family: var(--font-sans); font-size: 0.9rem; }
.input-ico input:focus { outline: none; border-color: var(--accent); }
.chatlist { overflow-y: auto; flex: 1; padding: 4px 10px 16px; display: flex; flex-direction: column; gap: 4px; }
.chat-item { display: grid; grid-template-columns: 44px 1fr auto; gap: 11px; align-items: center; padding: 10px; border-radius: var(--radius-md); cursor: pointer; border: 1px solid transparent; transition: 120ms; text-align: left; background: transparent; width: 100%; }
.chat-item:hover { background: var(--surface-muted); }
.chat-item.active { background: var(--wv-gold-soft); border-color: rgba(234,170,0,0.3); }
.chat-ava { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-display); color: var(--on-accent); background: var(--accent); font-size: 1rem; position: relative; }
.chat-ava.sky { background: var(--kin-skyblue); }
.chat-ava.violet { background: var(--kin-accent-purple); color: #fff; }
.chat-ava.host::after { content: "★"; position: absolute; bottom: -2px; right: -2px; font-size: 0.7rem; color: var(--accent); background: var(--bg-deep); border-radius: 50%; width: 16px; height: 16px; display: grid; place-items: center; border: 1px solid var(--border); }
.chat-item .ci-name { font-weight: 700; font-size: 0.9rem; color: var(--fg); }
.chat-item .ci-snip { font-size: 0.78rem; color: var(--fg-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.chat-item .ci-time { font-family: var(--font-mono); font-size: 0.62rem; color: var(--fg-dim); }

.thread { display: flex; flex-direction: column; min-height: 0; }
.thread-head { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.thread-head .back { display: none; }
.thread-head .t-ava { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-display); color: var(--on-accent); background: var(--accent); font-size: 0.9rem; }
.thread-head .t-name { font-weight: 700; font-size: 0.98rem; }
.thread-head .t-tag { font-size: 0.68rem; color: var(--fg-soft); }
.model-pill { margin-left: auto; display: inline-flex; align-items: center; gap: 7px; font-size: 0.78rem; font-weight: 700; color: var(--fg-muted); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 6px 12px; cursor: pointer; }
.model-pill .swatch { width: 12px; height: 12px; border-radius: 3px; background: linear-gradient(135deg, #03CCD9, #6536BB); }
.model-pill:hover { border-color: var(--border-strong); color: var(--fg); }

.thread-scroll { overflow-y: auto; flex: 1; min-height: 0; padding: 26px 18px; }
.thread-inner { max-width: var(--thread-max); margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.msg { display: flex; gap: 12px; max-width: 86%; }
.msg .bubble { padding: 13px 16px; border-radius: 16px; font-size: 0.95rem; line-height: 1.5; }
.msg.ally { align-self: flex-start; }
.msg.ally .bubble { background: var(--surface); border: 1px solid var(--border); border-top-left-radius: 5px; color: var(--fg); }
.msg.me { align-self: flex-end; flex-direction: row-reverse; }
.msg.me .bubble { background: var(--accent); color: var(--on-accent); border-top-right-radius: 5px; font-weight: 500; }
.msg .m-ava { width: 30px; height: 30px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center; font-family: var(--font-display); font-size: 0.74rem; }
.msg.ally .m-ava { background: var(--surface-elev); color: var(--accent); border: 1px solid var(--border); }
.chips-inline { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.chips-inline button { font-size: 0.82rem; font-weight: 600; color: var(--fg); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 7px 13px; cursor: pointer; transition: 120ms; }
.chips-inline button:hover { border-color: var(--accent); color: var(--accent); }

.composer { border-top: 1px solid var(--border); padding: 14px 18px 18px; }
.composer-inner { max-width: var(--thread-max); margin: 0 auto; display: flex; align-items: flex-end; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 8px 8px 8px 14px; }
.composer-inner:focus-within { border-color: var(--accent); }
.composer textarea { flex: 1; resize: none; border: 0; background: transparent; color: var(--fg); font-family: var(--font-sans); font-size: 0.95rem; line-height: 1.45; max-height: 140px; padding: 7px 0; }
.composer textarea:focus { outline: none; }
.composer .c-btn { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; border: 0; cursor: pointer; flex: 0 0 auto; }
.composer .mic { background: var(--surface-elev); color: var(--fg-muted); border: 1px solid var(--border); }
.composer .send { background: var(--accent); color: var(--on-accent); }
.composer .send:hover { background: var(--accent-hover); }
.composer-hint { max-width: var(--thread-max); margin: 8px auto 0; font-size: 0.72rem; color: var(--fg-dim); text-align: center; }

/* =========================================================================
   FIRST-RUN
   ========================================================================= */
.firstrun-banner { max-width: var(--thread-max); margin: 0 auto 6px; background: linear-gradient(160deg, rgba(234,170,0,0.14), transparent 70%), var(--surface); border: 1px solid rgba(234,170,0,0.32); border-radius: var(--radius-lg); padding: 18px 20px; display: flex; gap: 16px; align-items: center; }
.firstrun-banner .fr-ico { width: 46px; height: 46px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; flex: 0 0 auto; }
.firstrun-banner h3 { font-family: var(--font-display); font-weight: 400; font-size: 1.2rem; margin: 0 0 2px; }
.firstrun-banner p { margin: 0; font-size: 0.86rem; color: var(--fg-muted); }
.firstrun-banner .x { margin-left: auto; background: none; border: 0; color: var(--fg-soft); cursor: pointer; font-size: 1.2rem; align-self: flex-start; }
.firstrun-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* =========================================================================
   WALLET (Earn)
   ========================================================================= */
.balance-hero { background: linear-gradient(160deg, var(--surface-elev), var(--surface)); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px; text-align: center; position: relative; overflow: hidden; }
.balance-hero .lab { font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--fg-soft); font-weight: 700; }
.balance-hero .amt { font-family: var(--font-display); font-size: 3rem; line-height: 1; margin: 8px 0; }
.balance-hero .sub { color: var(--fg-soft); font-size: 0.86rem; }
.wallet-breakdown { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin: 16px 0; }
.wb { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px 16px; }
.wb .k { font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-soft); font-weight: 700; display: flex; align-items: center; gap: 6px; }
.wb .k i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.wb .v { font-family: var(--font-display); font-size: 1.4rem; margin-top: 4px; }
.txn { display: grid; grid-template-columns: 40px 1fr auto auto; gap: 14px; align-items: center; padding: 13px 14px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); margin-bottom: 8px; }
.txn .t-ico { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-elev); border: 1px solid var(--border); color: var(--accent); }
.txn .t-main { font-weight: 600; font-size: 0.9rem; }
.txn .t-bal { font-size: 0.74rem; color: var(--fg-soft); }
.txn .t-time { font-family: var(--font-mono); font-size: 0.7rem; color: var(--fg-dim); }
.date-sep { font-size: 0.72rem; color: var(--fg-soft); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; margin: 18px 0 10px; text-align: center; }

/* Level meter (wallet + profile) */
.level-meter { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.level-track { display: flex; align-items: center; gap: 0; margin: 18px 0 8px; }
.level-node { flex: 1; text-align: center; position: relative; }
.level-node .dot { width: 16px; height: 16px; border-radius: 50%; background: var(--surface-elev); border: 2px solid var(--border); margin: 0 auto; position: relative; z-index: 2; }
.level-node.done .dot { background: var(--accent); border-color: var(--accent); }
.level-node.current .dot { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 5px var(--wv-gold-soft); }
.level-node .lbl { font-size: 0.62rem; color: var(--fg-soft); margin-top: 7px; font-weight: 700; letter-spacing: 0.04em; }
.level-node.current .lbl { color: var(--accent); }
.level-node::before { content: ""; position: absolute; top: 8px; left: -50%; width: 100%; height: 2px; background: var(--border); z-index: 1; }
.level-node:first-child::before { display: none; }
.level-node.done::before, .level-node.current::before { background: var(--accent); }

/* =========================================================================
   VOTE (governance + store)
   ========================================================================= */
.prop { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; margin-bottom: 14px; }
.prop-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.prop-status { font-size: 0.6rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; }
.prop-status.open { color: var(--accent); background: var(--wv-gold-soft); border: 1px solid rgba(234,170,0,0.5); }
.prop-status.passed { color: var(--success); background: rgba(0,235,117,0.1); border: 1px solid rgba(0,235,117,0.4); }
.prop h3 { font-family: var(--font-display); font-weight: 400; font-size: 1.25rem; margin: 0 0 4px; }
.prop .by { font-size: 0.76rem; color: var(--fg-soft); }
.vote-bar { height: 8px; border-radius: 999px; background: var(--surface-elev); overflow: hidden; display: flex; margin: 12px 0 6px; }
.vote-bar .for { background: var(--success); height: 100%; }
.vote-bar .against { background: var(--danger); height: 100%; }
.vote-figures { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--fg-muted); }
.vote-ctas { display: flex; gap: 8px; margin-top: 14px; }
.vote-ctas .btn { flex: 1; }

.store-feature { background: linear-gradient(135deg, var(--kin-accent-purple-scn), var(--kin-accent-purple)); border-radius: var(--radius-lg); padding: 24px; margin-bottom: 18px; position: relative; overflow: hidden; }
.store-feature .lab { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255,255,255,0.8); }
.store-feature h3 { font-family: var(--font-display); font-weight: 400; font-size: 1.7rem; color: #fff; margin: 8px 0 14px; max-width: 22ch; }
.store-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; display: flex; flex-direction: column; gap: 4px; transition: 140ms; }
.store-item:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.store-item .si-ico { width: 42px; height: 42px; border-radius: var(--radius-md); display: grid; place-items: center; background: var(--surface-elev); color: var(--accent); margin-bottom: 8px; }
.store-item .si-name { font-weight: 700; }
.store-item .si-sub { font-size: 0.8rem; color: var(--fg-soft); flex: 1; }
.store-item .si-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.store-item .si-price { font-family: var(--font-display); font-size: 1.1rem; color: var(--accent); }

/* =========================================================================
   BUILDER MODE
   ========================================================================= */
.studio-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; transition: 140ms; cursor: pointer; display: flex; flex-direction: column; gap: 8px; position: relative; }
.studio-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.studio-card .sc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.studio-card .sc-ico { width: 42px; height: 42px; border-radius: var(--radius-md); display: grid; place-items: center; background: var(--surface-elev); border: 1px solid var(--border); color: var(--accent); }
.studio-card .sc-tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.studio-card h3 { font-family: var(--font-display); font-weight: 400; font-size: 1.3rem; margin: 4px 0 0; line-height: 1.05; }
.studio-card .handle { font-family: var(--font-mono); font-size: 0.78rem; color: var(--fg-soft); }
.studio-card .quote { font-style: italic; color: var(--fg-muted); font-size: 0.88rem; }
.studio-card p { color: var(--fg-muted); font-size: 0.88rem; margin: 0; }
.studio-card .sc-foot { display: flex; align-items: center; gap: 12px; margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 0.72rem; color: var(--fg-soft); }
.studio-card .sc-foot .mono { font-family: var(--font-mono); }

/* List rows (integrations, skills, approve) */
.row-list { display: flex; flex-direction: column; gap: 10px; }
.list-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); }
.list-row .lr-ico { width: 40px; height: 40px; border-radius: var(--radius-md); display: grid; place-items: center; background: var(--surface-elev); border: 1px solid var(--border); color: var(--accent); flex: 0 0 auto; }
.list-row .lr-main { min-width: 0; flex: 1; }
.list-row .lr-name { font-weight: 700; font-size: 0.94rem; }
.list-row .lr-sub { font-size: 0.8rem; color: var(--fg-soft); }
.list-row .lr-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.toggle { width: 42px; height: 24px; border-radius: 999px; background: var(--surface-elev); border: 1px solid var(--border); position: relative; cursor: pointer; flex: 0 0 auto; transition: 140ms; }
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--fg-soft); transition: 140ms; }
.toggle.on { background: var(--wv-gold-soft); border-color: rgba(234,170,0,0.5); }
.toggle.on::after { left: 20px; background: var(--accent); }

/* Skill (WHEN -> DO) recipe */
.skill { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; margin-bottom: 12px; }
.skill-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.skill-head .s-name { font-weight: 700; }
.skill-head .s-state { font-size: 0.72rem; color: var(--success); display: inline-flex; align-items: center; gap: 5px; }
.skill-head .s-state i { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.recipe-line { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; color: var(--fg); margin: 5px 0; flex-wrap: wrap; }
.kw { font-family: var(--font-sans); font-size: 0.62rem; font-weight: 800; letter-spacing: 0.08em; padding: 3px 9px; border-radius: 6px; }
.kw.when { background: rgba(3,204,217,0.16); color: #9beef4; }
.kw.do { background: var(--wv-gold-soft); color: var(--accent); }
.tool-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; font-weight: 600; background: var(--surface-elev); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; }

/* =========================================================================
   SETUP WIZARD (personal Ally)
   ========================================================================= */
.wizard { max-width: 760px; margin: 0 auto; }
.wiz-steps { display: flex; gap: 8px; margin-bottom: 26px; }
.wiz-step { flex: 1; text-align: center; }
.wiz-step .bar { height: 4px; border-radius: 999px; background: var(--surface-elev); margin-bottom: 8px; }
.wiz-step.done .bar, .wiz-step.current .bar { background: var(--accent); }
.wiz-step .nm { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-soft); }
.wiz-step.current .nm, .wiz-step.done .nm { color: var(--accent); }
.wiz-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 30px; }
.wiz-panel .step-no { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--kin-skyblue); }
.wiz-panel h2 { font-family: var(--font-display); font-weight: 400; font-size: 1.9rem; margin: 6px 0 6px; }
.wiz-panel .lead { color: var(--fg-muted); margin: 0 0 22px; }
.wiz-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 24px; gap: 12px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 0.86rem; margin-bottom: 6px; }
.field input, .field textarea, .field select { width: 100%; padding: 0.72rem 0.9rem; border-radius: var(--radius-sm); background: var(--bg-deep); border: 1px solid var(--border); color: var(--fg); font-family: var(--font-sans); font-size: 0.95rem; }
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--accent); }
.opt-card { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-md); cursor: pointer; transition: 120ms; background: var(--bg-deep); }
.opt-card:hover { border-color: var(--border-strong); }
.opt-card.sel { border-color: var(--accent); background: var(--wv-gold-soft); }
.opt-card .o-ico { width: 36px; height: 36px; border-radius: var(--radius-md); display: grid; place-items: center; background: var(--surface-elev); color: var(--accent); flex: 0 0 auto; }
.opt-card .o-name { font-weight: 700; font-size: 0.92rem; }
.opt-card .o-sub { font-size: 0.8rem; color: var(--fg-soft); }

/* =========================================================================
   LOCKS + UPGRADE
   ========================================================================= */
.lock-veil { position: relative; }
.locked-card { position: relative; border-style: dashed; }
.lock-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-soft); background: var(--surface-elev); border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px; }
.lock-pill svg { width: 13px; height: 13px; }
.upgrade-note { display: flex; align-items: center; gap: 14px; background: linear-gradient(160deg, rgba(234,170,0,0.12), transparent 70%); border: 1px solid rgba(234,170,0,0.32); border-radius: var(--radius-lg); padding: 18px 20px; margin-bottom: 20px; }
.upgrade-note .un-ico { width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; flex: 0 0 auto; }
.upgrade-note h4 { font-family: var(--font-display); font-weight: 400; margin: 0 0 2px; font-size: 1.15rem; }
.upgrade-note p { margin: 0; font-size: 0.84rem; color: var(--fg-muted); }
.upgrade-note .btn { margin-left: auto; }

/* Empty / placeholder states (for designed-but-light screens) */
.empty { border: 1px dashed var(--border); border-radius: var(--radius-lg); padding: 48px 32px; text-align: center; color: var(--fg-soft); }
.empty .e-ico { width: 56px; height: 56px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border); display: grid; place-items: center; margin: 0 auto 14px; color: var(--accent); }
.empty h3 { font-family: var(--font-display); font-weight: 400; color: var(--fg); margin: 0 0 6px; }
.preview-flag { display: inline-block; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); background: var(--wv-gold-soft); border: 1px solid rgba(234,170,0,0.4); border-radius: 999px; padding: 3px 9px; margin-top: 10px; }

/* =========================================================================
   LOGIN / SPLASH (continues from site)
   ========================================================================= */
.auth-wrap { height: 100dvh; display: grid; grid-template-columns: 1.05fr 0.95fr; }
.auth-art { position: relative; overflow: hidden; padding: 56px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(1000px 500px at 80% -10%, rgba(234,170,0,0.26), transparent 55%), radial-gradient(700px 500px at -10% 70%, rgba(3,204,217,0.14), transparent 60%), linear-gradient(135deg, #100E59, #09073A 80%); }
.auth-art .ridge { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; opacity: 0.85; pointer-events: none; }
.auth-art .brand-logo { height: 30px; position: relative; z-index: 2; }
.auth-art .pitch { position: relative; z-index: 2; }
.auth-art .pitch h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(2rem, 3.2vw, 3rem); line-height: 1.02; margin: 0 0 14px; max-width: 16ch; }
.auth-art .pitch p { color: var(--fg-muted); max-width: 42ch; }
.auth-foot { position: relative; z-index: 2; font-size: 0.78rem; color: var(--fg-soft); }
.auth-panel { display: grid; place-items: center; padding: 32px; background: var(--bg-deep); overflow-y: auto; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h2 { font-family: var(--font-display); font-weight: 400; font-size: 1.9rem; margin: 0 0 4px; }
.auth-card .sub { color: var(--fg-muted); font-size: 0.9rem; margin: 0 0 22px; }
.auth-card .field { margin-bottom: 14px; }
.auth-divider { display: flex; align-items: center; gap: 12px; color: var(--fg-dim); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; margin: 18px 0; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.reader-note { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px; font-size: 0.84rem; color: var(--fg-muted); }
.reader-note b { color: var(--fg); }

/* Install banner (web → installed) */
.install-banner { display: flex; align-items: center; gap: 12px; background: var(--surface-elev); border-bottom: 1px solid var(--border); padding: 10px 16px; font-size: 0.85rem; }
.install-banner .ib-ico { width: 30px; height: 30px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); display: grid; place-items: center; color: var(--accent); flex: 0 0 auto; }
.install-banner .ib-text { flex: 1; min-width: 0; }
.install-banner .ib-text b { color: var(--fg); }
.install-banner .x { background: none; border: 0; color: var(--fg-soft); cursor: pointer; font-size: 1.1rem; }
.install-banner[hidden] { display: none; }

/* =========================================================================
   PROTOTYPE CONTROL PANEL (demo only — flip level/platform/first-run/mode)
   ========================================================================= */
.proto-fab { position: fixed; right: 18px; bottom: 18px; z-index: 300; width: 48px; height: 48px; border-radius: 50%; background: var(--kin-skyblue); color: #002; border: 0; display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow-lg); }
.proto-fab svg { width: 22px; height: 22px; }
.proto-panel { position: fixed; right: 18px; bottom: 78px; z-index: 300; width: 312px; max-width: calc(100vw - 36px); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 16px; display: none; }
.proto-panel.open { display: block; }
.proto-panel h4 { font-family: var(--font-display); font-weight: 400; font-size: 1.1rem; margin: 0 0 2px; }
.proto-panel .pp-sub { font-size: 0.72rem; color: var(--fg-soft); margin: 0 0 14px; }
.proto-group { margin-bottom: 14px; }
.proto-group > .pg-lab { font-size: 0.64rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--fg-soft); margin-bottom: 7px; display: block; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { font-size: 0.74rem; font-weight: 700; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-deep); color: var(--fg-muted); cursor: pointer; transition: 120ms; }
.seg button:hover { border-color: var(--border-strong); color: var(--fg); }
.seg button.active { background: var(--wv-gold-soft); border-color: rgba(234,170,0,0.5); color: var(--accent); }
.proto-panel .pp-foot { font-size: 0.68rem; color: var(--fg-dim); border-top: 1px solid var(--border); padding-top: 10px; margin-top: 6px; }

/* =========================================================================
   MENUS / SHEETS
   ========================================================================= */
.scrim { position: fixed; inset: 0; background: rgba(3,1,27,0.6); backdrop-filter: blur(3px); z-index: 200; display: none; }
.scrim.open { display: block; }
.sheet { position: fixed; z-index: 210; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 8px; min-width: 240px; display: none; }
.sheet.open { display: block; }
.sheet .sh-item { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: var(--radius-md); cursor: pointer; color: var(--fg-muted); font-size: 0.9rem; font-weight: 600; }
.sheet .sh-item:hover { background: var(--surface-muted); color: var(--fg); }
.sheet .sh-item svg { width: 17px; height: 17px; }
.sheet .sh-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.sheet .sh-head { padding: 10px 12px 6px; font-size: 0.64rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--fg-dim); font-weight: 700; }

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
.only-mobile { display: none; }

@media (max-width: 1080px) {
  :root { --rail-w: 220px; }
  .chat-layout { grid-template-columns: 280px 1fr; }
}

/* Tablet: collapse rail to icons */
@media (max-width: 860px) {
  :root { --rail-w: var(--rail-w-collapsed); }
  .rail { padding: 12px 8px; align-items: center; }
  .nav-group-label { font-size: 0; padding: 12px 0 4px; }
  .nav-group-label::after { content: ""; display: block; width: 22px; height: 1px; background: var(--border); margin: 0 auto; }
  .navitem { justify-content: center; padding: 11px; }
  .navitem span.nv-label { display: none; }
  .navitem .count, .navitem .lock { display: none; }
  .navitem.active::before { display: none; }
  .rail-foot { display: none; }
  .ws-switch .ws-meta { display: none; }
  .mode-toggle button span { display: none; }
  .mode-toggle button { padding: 7px 11px; }
}

/* Mobile: bottom nav, hide rail, drawer for builder */
@media (max-width: 680px) {
  :root { --appbar-h: 56px; }
  .app-body { grid-template-columns: 1fr; }
  .rail { display: none; }
  .app { grid-template-rows: var(--appbar-h) 1fr auto; }
  .hamburger { display: grid; }
  .level-badge .lvl-name { display: none; }
  .ws-switch, .mobile-hide { display: none; }
  .appbar { gap: 6px; padding: 0 8px; }
  .appbar .brand-logo { height: 22px; }
  .page { padding: 20px 16px 96px; }
  .pg-title { font-size: 1.7rem; }
  .g3, .g4, .g2 { grid-template-columns: 1fr; }
  .wallet-breakdown { grid-template-columns: 1fr; }

  /* Chat becomes single column with slide-over thread */
  .chat-layout { grid-template-columns: 1fr; position: relative; }
  .chat-aside { width: 100%; }
  .thread { position: absolute; inset: 0; background: var(--bg-deep); transform: translateX(100%); transition: transform 0.24s ease; z-index: 5; }
  .chat-layout.show-thread .thread { transform: none; }
  .chat-layout.show-thread .chat-aside { display: none; }
  .thread-head .back { display: grid; }

  #bottom-nav { display: flex; }
  /* keep the prototype FAB clear of the bottom tab bar */
  .proto-fab { bottom: calc(70px + env(safe-area-inset-bottom)); }
  .proto-panel { bottom: calc(128px + env(safe-area-inset-bottom)); }
  .only-mobile { display: revert; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .wiz-step .nm { font-size: 0.6rem; }
  .firstrun-banner { flex-wrap: wrap; }
}

/* Bottom nav (mobile, Active mode tabs) */
.bottom-nav { display: none; align-items: stretch; border-top: 1px solid var(--border); background: rgba(9,7,58,0.92); backdrop-filter: blur(12px); }
.bottom-nav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0 calc(9px + env(safe-area-inset-bottom)); background: none; border: 0; color: var(--fg-soft); font-size: 0.62rem; font-weight: 700; cursor: pointer; }
.bottom-nav button svg { width: 21px; height: 21px; }
.bottom-nav button.active { color: var(--accent); }

/* Device preview frame (prototype: simulate tablet/phone on a desktop screen) */
body.sim-tablet, body.sim-phone { overflow: auto; background: #05030f; display: grid; place-items: center; padding: 24px; }
body.sim-tablet .app, body.sim-phone .app { height: 900px; border: 14px solid #15131f; border-radius: 42px; box-shadow: var(--shadow-lg); overflow: hidden; }
body.sim-tablet .app { width: 834px; }
body.sim-phone .app { width: 390px; height: 820px; }
body.sim-tablet .proto-fab, body.sim-phone .proto-fab, body.sim-tablet .proto-panel, body.sim-phone .proto-panel { position: fixed; }

/* =========================================================================
   v2 ADDITIONS — multi-DUNA themes, contextual chat dock, Coins/Wallet,
   Codes/Claims, Directory, Team, host page
   ========================================================================= */

/* ---- Per-DUNA themes (switching DUNA re-skins the one accent) ---------- */
#app[data-duna="mesh"] {
  --accent: #2FC5A8; --accent-hover: #54E0C5; --accent-soft: rgba(47,197,168,0.15);
  --wv-gold-soft: rgba(47,197,168,0.15); --on-accent: #042620;
}
#app[data-duna="cc"] {
  --accent: #EC008C; --accent-hover: #FF3FAE; --accent-soft: rgba(236,0,140,0.15);
  --wv-gold-soft: rgba(236,0,140,0.15); --on-accent: #FFFFFF;
}
/* coin chip colors per duna (selector + lists) */
.ws-coin.duna-wv { background: #EAAA00; color: #09073A; }
.ws-coin.duna-mesh { background: #2FC5A8; color: #042620; }
.ws-coin.duna-cc { background: #EC008C; color: #fff; }

/* ---- Selector: Genesis tag + Home controls ---------------------------- */
.ws-tag { font-size: 0.56rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--wv-gold); margin-left: 2px; }
.home-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-soft); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 4px 10px; margin-left: 8px; white-space: nowrap; }
.home-pill.is-home { color: var(--accent); border-color: rgba(255,255,255,0.001); background: var(--accent-soft); }
.set-home-btn { margin-left: 8px; }

/* ---- Account button (between profile and bell) ------------------------ */
/* uses .icon-btn; nothing extra */

/* ---- Buy Coins / Membership boxes ------------------------------------- */
.tier-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
@media (max-width: 1100px) { .tier-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px) { .tier-grid { grid-template-columns: 1fr; } }
.tierbox { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 16px; cursor: pointer; transition: 140ms; display: flex; flex-direction: column; gap: 4px; }
.tierbox:hover { border-color: var(--border-strong); }
.tierbox.sel { border-color: var(--accent); background: linear-gradient(180deg, var(--accent-soft), transparent 70%), var(--surface); box-shadow: var(--shadow-glow-accent); }
.tierbox .tb-name { font-family: var(--font-display); font-size: 1.4rem; }
.tierbox .tb-price { font-family: var(--font-display); font-size: 1.7rem; color: var(--accent); line-height: 1; margin: 2px 0 8px; }
.tierbox .tb-price small { display:block; font-family: var(--font-sans); font-size: 0.68rem; color: var(--fg-soft); font-weight: 700; letter-spacing: 0.04em; }
.tierbox .tb-line { display: flex; justify-content: space-between; font-size: 0.82rem; color: var(--fg-muted); padding: 3px 0; }
.tierbox .tb-line b { color: var(--fg); }
.tierbox .tb-total { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 8px; font-weight: 700; color: var(--fg); }
.tierbox .tb-ribbon { position: absolute; top: -9px; left: 14px; font-size: 0.58rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--on-accent); background: var(--accent); border-radius: 999px; padding: 3px 9px; }
.tierbox .tb-check { position: absolute; top: 12px; right: 12px; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--border-strong); display: grid; place-items: center; color: var(--on-accent); }
.tierbox.sel .tb-check { background: var(--accent); border-color: var(--accent); }
.tierbox.sel .tb-check::after { content: "✓"; font-size: 0.72rem; font-weight: 700; }
.fineprint { font-size: 0.8rem; color: var(--fg-soft); margin-top: 14px; line-height: 1.5; }
.fineprint b { color: var(--fg-muted); }
.pay-summary { background: var(--surface-elev); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 18px; }
.pay-summary .ps-fig { font-family: var(--font-display); font-size: 1.5rem; }
.stripe-row { display: inline-flex; align-items: center; gap: 8px; font-size: 0.78rem; color: var(--fg-soft); }

/* ---- On-ramps / wallet load ------------------------------------------- */
.ramp { display: flex; align-items: center; gap: 14px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); cursor: pointer; transition: 140ms; }
.ramp:hover { border-color: var(--accent); }
.ramp .r-logo { width: 42px; height: 42px; border-radius: var(--radius-md); display: grid; place-items: center; font-family: var(--font-display); background: var(--surface-elev); border: 1px solid var(--border); color: var(--accent); }
.addr-box { display: flex; align-items: center; gap: 10px; font-family: var(--font-mono); font-size: 0.82rem; background: var(--bg-deep); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; word-break: break-all; }

/* ---- Codes / Claims ---------------------------------------------------- */
.code-hero { background: linear-gradient(160deg, var(--surface-elev), var(--surface)); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 26px; }
.code-value { font-family: var(--font-display); font-size: 2.2rem; letter-spacing: 0.06em; margin: 8px 0; }
.code-tabs { display: flex; gap: 6px; background: var(--bg-deep); padding: 4px; border-radius: var(--radius-pill); margin-bottom: 18px; width: fit-content; }
.code-tabs button { border: 0; background: transparent; color: var(--fg-muted); font-weight: 700; font-size: 0.86rem; padding: 7px 16px; border-radius: var(--radius-pill); cursor: pointer; }
.code-tabs button.active { background: var(--accent); color: var(--on-accent); }
.claims-toggle { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; color: var(--link); font-weight: 700; font-size: 0.86rem; cursor: pointer; padding: 6px 0; }
.claims-toggle .chev2 { transition: 160ms; }
.claims-toggle.open .chev2 { transform: rotate(180deg); }
.claims-panel { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; }
.claims-panel.open { max-height: 1400px; }
.claims-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.claims-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; font-size: 0.86rem; }
.claims-table td:first-child { font-family: var(--font-mono); color: var(--accent); white-space: nowrap; width: 120px; }
.claims-table td:nth-child(2) { color: var(--fg); }
.claims-table .c-desc { display: block; color: var(--fg-soft); font-size: 0.78rem; margin-top: 2px; }

/* ---- Directory --------------------------------------------------------- */
.dir-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius-lg); overflow: hidden; transition: 140ms; }
.dir-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.dir-cover { height: 96px; display: flex; align-items: center; justify-content: center; position: relative; }
.dir-cover .dir-badge { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-display); color: var(--on-accent); background: var(--accent); font-size: 1.1rem; }
.dir-card .dir-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.dir-card h3 { font-family: var(--font-display); font-weight: 400; font-size: 1.25rem; margin: 0; line-height: 1.05; }
.dir-card .dir-type { font-size: 0.6rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.dir-card p { color: var(--fg-muted); font-size: 0.86rem; margin: 0; }
.dir-card .dir-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); display: flex; gap: 8px; }
.seg-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }

/* ---- Team -------------------------------------------------------------- */
.role-row { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; align-items: center; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); margin-bottom: 8px; }
.role-row .r-name { font-weight: 700; }
.role-row .r-split { font-family: var(--font-display); color: var(--accent); font-size: 1.2rem; }

/* ---- Ally state pills -------------------------------------------------- */
.tag.draft { color: var(--fg-soft); border-color: var(--border); }
.tag.testing { color: #9beef4; border-color: rgba(3,204,217,0.5); background: rgba(3,204,217,0.12); }
.tag.published { color: var(--success); border-color: rgba(0,235,117,0.4); background: rgba(0,235,117,0.1); }
.tag.primary { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.tag.public { color: var(--success); border-color: rgba(0,235,117,0.4); background: rgba(0,235,117,0.1); }
.tag.private { color: #9beef4; border-color: rgba(3,204,217,0.5); background: rgba(3,204,217,0.12); }
.tag.secret { color: #c9b3ff; border-color: rgba(150,110,240,0.55); background: rgba(150,110,240,0.14); }
.vis-public { color: var(--success); }
.vis-private { color: #9beef4; }
.vis-secret { color: #c9b3ff; }

/* =========================================================================
   CONTEXTUAL CHAT DOCK (right side, always-open, collapsible)
   ========================================================================= */
:root { --dock-w: 340px; }
.app.dock-open { --dock-pad: var(--dock-w); }
.dock {
  position: fixed; top: var(--appbar-h); right: 0; bottom: 0; width: var(--dock-w);
  background: rgba(3,1,27,0.55); backdrop-filter: blur(8px);
  border-left: 1px solid var(--border); display: flex; flex-direction: column;
  z-index: 70; transform: translateX(100%); transition: transform 0.26s ease;
}
.app.dock-open .dock { transform: none; }
.dock-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.dock-head .d-ava { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-display); font-size: 0.78rem; background: var(--accent); color: var(--on-accent); }
.dock-head .d-name { font-weight: 700; font-size: 0.9rem; }
.dock-head .d-sub { font-size: 0.66rem; color: var(--fg-soft); }
.dock-head .d-x { margin-left: auto; background: none; border: 0; color: var(--fg-soft); cursor: pointer; }
.dock-head .d-x:hover { color: var(--fg); }
.dock-scroll { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 12px; }
.dock-msg { font-size: 0.88rem; line-height: 1.5; }
.dock-msg.ally { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; border-top-left-radius: 4px; padding: 11px 13px; color: var(--fg); }
.dock-msg.me { align-self: flex-end; background: var(--accent); color: var(--on-accent); border-radius: 12px; border-top-right-radius: 4px; padding: 11px 13px; font-weight: 500; max-width: 85%; }
.dock-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.dock-chips button { font-size: 0.78rem; font-weight: 600; color: var(--fg); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 6px 11px; cursor: pointer; text-align: left; transition: 120ms; }
.dock-chips button:hover { border-color: var(--accent); color: var(--accent); }
.dock-compose { border-top: 1px solid var(--border); padding: 10px 12px; display: flex; gap: 8px; align-items: flex-end; }
.dock-compose textarea { flex: 1; resize: none; border: 1px solid var(--border); background: var(--surface); color: var(--fg); border-radius: var(--radius-md); font-family: var(--font-sans); font-size: 0.88rem; padding: 8px 10px; max-height: 100px; }
.dock-compose textarea:focus { outline: none; border-color: var(--accent); }
.dock-compose .send { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--accent); color: var(--on-accent); cursor: pointer; flex: 0 0 auto; }

/* Dock open tab (when collapsed) */
.dock-tab { position: fixed; right: 0; top: calc(var(--appbar-h) + 16px); z-index: 69; writing-mode: vertical-rl; background: var(--accent); color: var(--on-accent); border: 0; border-radius: 10px 0 0 10px; padding: 14px 7px; font-weight: 700; font-size: 0.8rem; letter-spacing: 0.04em; cursor: pointer; box-shadow: var(--shadow-md); display: none; }
.app:not(.dock-open) .dock-tab { display: block; }

/* Push main content left when dock open (desktop only) */
@media (min-width: 1101px) {
  .app.dock-open .app-body { margin-right: var(--dock-w); }
  .app.dock-open .appbar { padding-right: calc(16px + 0); }
}
/* On tablet/mobile the dock overlays full-height as a sheet */
@media (max-width: 1100px) {
  .dock { width: min(360px, 92vw); box-shadow: var(--shadow-lg); }
  .app.dock-open .app-body { margin-right: 0; }
}
@media (max-width: 680px) {
  .dock { top: 0; width: 100vw; }
  .dock-tab { top: auto; bottom: calc(70px + env(safe-area-inset-bottom)); writing-mode: horizontal-tb; border-radius: 999px; right: 12px; padding: 10px 16px; }
}
