/* QUILLHOUSE — the office (/app). Uses tokens from ui.css. */

/* ---------- header on the app page: brand + wallet only ---------- */
body[data-app] { overflow: hidden; }
body[data-app] .hdr { background: rgba(19, 20, 29, .96); border-bottom-color: var(--line); }
body[data-app] .hdr .nav, body[data-app] .hdr .menu, body[data-app] .hdr__end > a.btn[href="/app"] { display: none !important; }
body[data-app] .hdr__end .hide-m { display: flex; }
body[data-app] .hdr__end { margin-left: auto; }

/* ---------- frame ---------- */
.appx { position: fixed; inset: var(--hdr) 0 0 0; display: grid; grid-template-columns: 268px minmax(0, 1fr); background: var(--night); }
.side { display: flex; flex-direction: column; gap: 18px; padding: 22px 16px 16px; border-right: 1px solid var(--line); background: linear-gradient(180deg, #181926, #14151f); overflow-y: auto; min-height: 0; }
.side__office { display: flex; align-items: center; gap: 12px; padding: 4px 8px 14px; border-bottom: 1px solid var(--line); }
.side__mark { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(150deg, #3a3f66, #23253a); border: 1px solid var(--line-2); color: var(--ink); flex: none; }
.side__mark svg { width: 22px; height: 22px; }
.side__oname { min-width: 0; display: flex; flex-direction: column; }
.side__oname b { font: 500 15px/1.25 var(--sans); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side__oname small { font: 400 12px/1.4 var(--mono); color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side__nav { display: grid; gap: 3px; }
.side__nav a { display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 12px; border-radius: var(--r-sm); color: var(--ink-2); font: 400 14.5px/1 var(--sans); transition: background .15s, color .15s; }
.side__nav a svg { width: 16px; height: 16px; opacity: .8; flex: none; }
.side__nav a em { margin-left: auto; font: 400 11.5px/1 var(--mono); font-style: normal; color: var(--mute); }
.side__nav a:hover { background: rgba(236, 235, 250, .05); color: var(--ink); }
.side__nav a[aria-current="page"] { background: var(--panel-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.side__nav a[aria-current="page"] svg { opacity: 1; color: var(--peri-2); }
.side__threads { min-height: 0; flex: 1; display: flex; flex-direction: column; }
.side__h { display: flex; align-items: center; justify-content: space-between; padding: 0 10px 8px; font: 400 11px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--dim); }
.side__new { font: 500 12px/1 var(--sans); letter-spacing: 0; text-transform: none; color: var(--peri-2); padding: 6px 8px; border-radius: 6px; }
.side__new:hover { background: var(--peri-dim); }
.tlist { overflow-y: auto; display: grid; gap: 1px; min-height: 0; }
.tlist li { display: flex; align-items: center; border-radius: var(--r-sm); }
.tlist li:hover { background: rgba(236, 235, 250, .04); }
.tlist li.is-on { background: rgba(142, 149, 232, .1); }
.tlist button.t { flex: 1; min-width: 0; text-align: left; padding: 8px 10px; font-size: 13.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tlist li.is-on button.t { color: var(--ink); }
.tlist button.x { width: 26px; height: 26px; margin-right: 4px; border-radius: 6px; color: var(--dim); opacity: 0; font-size: 12px; }
.tlist li:hover button.x, .tlist button.x:focus-visible { opacity: 1; }
.tlist button.x:hover { color: var(--bad); background: var(--bad-dim); }
.tlist .empty { padding: 6px 10px; font-size: 13px; color: var(--dim); }
.side__allow { padding: 12px 12px 10px; border: 1px solid var(--line); border-radius: var(--r); background: rgba(255, 255, 255, .02); }
.meter__top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 12.5px; color: var(--mute); }
.meter__top b { font: 500 13px/1 var(--mono); color: var(--ink); }
.meter { height: 6px; border-radius: 99px; background: rgba(236, 235, 250, .08); margin-top: 9px; overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--peri), var(--peri-2)); transition: width .5s var(--ease); }
.meter.is-warn i { background: linear-gradient(90deg, #d9a24a, var(--warn)); }
.meter.is-full i { background: var(--bad); }
.side__who { border-top: 1px solid var(--line); padding: 14px 6px 2px; }
.who2 { display: flex; align-items: center; gap: 11px; }
.who2__av { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; font: 500 13px/1 var(--sans); color: #fff; background: linear-gradient(140deg, #6b72c9, #3a3e6d); border: 1px solid var(--line-2); }
.who2__av img { width: 20px; height: 20px; border-radius: 5px; }
.who2__t { min-width: 0; flex: 1; }
.who2__t b { display: block; font: 500 13.5px/1.3 var(--mono); }
.who2__t small { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--mute); }
.who2__t small i { width: 6px; height: 6px; border-radius: 50%; background: var(--good); }
.who2__t small i.is-wrong { background: var(--warn); }
.who2__acts { display: flex; gap: 8px; margin-top: 12px; }
.who2__acts .btn { flex: 1; }
.btn--out { background: transparent; color: var(--ink-2); border: 1px solid var(--line-2); box-shadow: none; }
.btn--out:hover { color: var(--bad); border-color: rgba(240, 128, 111, .5); background: var(--bad-dim); transform: none; }

/* ---------- stage ---------- */
.stage { position: relative; min-width: 0; min-height: 0; overflow-y: auto; overflow-x: hidden; background: radial-gradient(1200px 520px at 60% -12%, rgba(105, 112, 190, .16), transparent 70%), var(--night); }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 14px; height: 58px; padding: 0 32px; border-bottom: 1px solid var(--line); background: rgba(19, 20, 29, .92); }
.topbar__l { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar__l b { font: 400 18px/1 var(--serif); letter-spacing: -.005em; white-space: nowrap; }
.topbar__r { display: none; align-items: center; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 7px; height: 24px; padding: 0 10px; border-radius: 99px; font: 400 11.5px/1 var(--sans); color: var(--ink-2); background: rgba(236, 235, 250, .05); border: 1px solid var(--line); white-space: nowrap; }
.pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--peri); box-shadow: 0 0 0 3px var(--peri-dim); }
.pill--room { color: var(--peri-2); border-color: rgba(142, 149, 232, .4); background: var(--peri-dim); max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.pill--room button { margin-left: 4px; color: var(--ink-2); }
.netbar { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px 16px; padding: 10px 20px; background: rgba(235, 195, 109, .12); border-bottom: 1px solid rgba(235, 195, 109, .3); color: var(--warn); font-size: 14px; text-align: center; }
.pane { min-height: calc(100% - 58px); }
.pane__in { max-width: 1120px; margin: 0 auto; padding: 38px 32px 80px; }
.pane__in--narrow { max-width: 820px; }
.phd { margin-bottom: 30px; }
.phd--row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.phd--row > div:first-child { max-width: 680px; }
.phd__h { margin-top: 12px; font: 400 clamp(30px, 3.2vw, 42px)/1.08 var(--serif); letter-spacing: -.018em; }
.phd__h em { font-style: italic; font-weight: 300; }
.phd__p { margin-top: 12px; color: var(--mute); font-size: 15.5px; line-height: 1.6; max-width: 70ch; }
.phd__acts { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- workspace ---------- */
.ws { max-width: 860px; margin: 0 auto; padding: 0 32px; display: flex; flex-direction: column; min-height: calc(100vh - var(--hdr) - 58px); }
.ws__hello { text-align: center; padding: 64px 0 30px; }
.ws__mark { width: 52px; height: 52px; margin: 0 auto 18px; display: grid; place-items: center; color: var(--ink); }
.ws__mark svg { width: 44px; height: 44px; filter: drop-shadow(0 6px 24px rgba(142, 149, 232, .45)); }
.ws__h { margin-top: 14px; font: 500 clamp(30px, 3.4vw, 42px)/1.1 var(--sans); letter-spacing: -.025em; }
.ws__sub { margin-top: 10px; color: var(--mute); font-size: 15.5px; }
.ws.has-thread .ws__hello, .ws.has-thread .ws__below, .ws.has-thread .chips { display: none; }
.ws.has-thread .composer { position: sticky; bottom: 0; margin-top: auto; padding: 18px 0 18px; background: linear-gradient(180deg, rgba(19, 20, 29, 0), var(--night) 26%); }
.composer { z-index: 5; }
.cmp { border: 1px solid var(--line-2); border-radius: 16px; background: linear-gradient(180deg, #24263b, #1f2133); box-shadow: 0 24px 60px -30px rgba(0, 0, 0, .8), inset 0 1px 0 rgba(255, 255, 255, .04); transition: border-color .2s, box-shadow .2s; }
.cmp:focus-within { border-color: rgba(142, 149, 232, .55); box-shadow: 0 0 0 4px rgba(142, 149, 232, .12), 0 24px 60px -30px rgba(0, 0, 0, .8); }
.cmp textarea { display: block; width: 100%; min-height: 64px; max-height: 260px; resize: none; padding: 18px 20px 6px; background: none; border: 0; outline: none; font-size: 16px; line-height: 1.55; color: var(--ink); }
.cmp textarea::placeholder { color: var(--dim); }
.cmp__row { display: flex; align-items: center; gap: 8px; padding: 8px 10px 10px 12px; flex-wrap: wrap; }
.cmp__icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: var(--mute); }
.cmp__icon:hover { color: var(--ink); background: rgba(236, 235, 250, .07); }
.cmp__icon svg { width: 18px; height: 18px; }
.cmp__toggle { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 11px; border-radius: 99px; border: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.cmp__toggle svg { width: 14px; height: 14px; }
.cmp__toggle:hover { border-color: var(--line-2); color: var(--ink); }
.cmp__toggle[aria-pressed="true"] { border-color: rgba(142, 149, 232, .6); background: var(--peri-dim); color: var(--peri-2); }
.cmp__priv { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; font-size: 12.5px; color: var(--mute); }
.cmp__priv svg { width: 13px; height: 13px; }
.cmp__send, .cmp__stop { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(150deg, #a3a9f3, #7b82dc); color: #12132a; box-shadow: 0 6px 18px -6px rgba(142, 149, 232, .7); transition: transform .15s, opacity .2s; flex: none; }
.cmp__send svg, .cmp__stop svg { width: 17px; height: 17px; }
.cmp__send:hover { transform: translateY(-1px); }
.cmp__send[disabled] { opacity: .4; pointer-events: none; }
.cmp__stop { background: var(--cream); }
.cmp__files { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 16px 0; }
.fchip { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 6px 0 10px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); font: 400 12.5px/1 var(--mono); color: var(--ink-2); max-width: 100%; }
.fchip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fchip button { width: 20px; height: 20px; border-radius: 5px; color: var(--mute); }
.fchip button:hover { color: var(--ink); background: rgba(255, 255, 255, .08); }
.cmp__note { margin-top: 12px; text-align: center; font-size: 12.5px; color: var(--dim); }
.ws.has-thread .cmp__note { margin-top: 8px; }

/* model picker */
.mpick { position: relative; }
.mpick__btn { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line); background: rgba(236, 235, 250, .03); font-size: 13px; color: var(--ink-2); max-width: 260px; }
.mpick__btn:hover { border-color: var(--line-2); color: var(--ink); }
.mpick__btn .spark { color: var(--peri-2); }
.mpick__btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mpick__btn svg { width: 10px; height: 10px; flex: none; }
.mpick__menu { position: absolute; left: 0; bottom: calc(100% + 8px); z-index: 40; width: 300px; max-height: 380px; overflow-y: auto; padding: 6px; border-radius: var(--r); background: #1c1d2c; border: 1px solid var(--line-2); box-shadow: 0 24px 60px -16px rgba(0, 0, 0, .8); }
.ws:not(.has-thread) .mpick__menu { bottom: auto; top: calc(100% + 8px); }
.mpick__menu p { padding: 8px 10px 6px; font: 400 11px/1.3 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.mopt { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: var(--r-sm); text-align: left; }
.mopt:hover, .mopt:focus-visible { background: rgba(236, 235, 250, .06); }
.mopt b { display: block; font: 500 14px/1.25 var(--sans); }
.mopt small { display: block; font-size: 12px; color: var(--mute); }
.mopt .ck { margin-left: auto; width: 18px; height: 18px; border-radius: 5px; border: 1px solid var(--line-2); display: grid; place-items: center; color: transparent; flex: none; }
.mopt[aria-checked="true"] .ck { background: var(--peri); border-color: var(--peri); color: #12132a; }
.mopt .ck svg { width: 12px; height: 12px; }
.mpick__hint { padding: 8px 10px 4px; font-size: 12px; color: var(--mute); border-top: 1px solid var(--line); margin-top: 4px; }

/* quick chips */
.chips { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.chips button { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line); background: rgba(236, 235, 250, .02); font-size: 13.5px; color: var(--ink-2); transition: border-color .15s, color .15s, background .15s; }
.chips button svg { width: 14px; height: 14px; color: var(--peri-2); }
.chips button:hover { border-color: var(--line-2); color: var(--ink); background: rgba(236, 235, 250, .05); }

/* below the composer */
.ws__below { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin: 46px 0 60px; }
.wsb__h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.wsb__all { font-size: 12px; color: var(--mute); }
.wsb__all:hover { color: var(--ink); }
.wsb__list li > a, .wsb__list li > button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 4px; border-bottom: 1px solid var(--line); font-size: 14.5px; color: var(--ink-2); text-align: left; }
.wsb__list li > a:hover, .wsb__list li > button:hover { color: var(--ink); }
.wsb__list .dia { width: 8px; height: 8px; border: 1.3px solid var(--mute); transform: rotate(45deg); flex: none; }
.wsb__list small { margin-left: auto; font: 400 11.5px/1 var(--mono); color: var(--dim); }
.wsb__empty { padding: 12px 4px; font-size: 13.5px; color: var(--dim); border-bottom: 1px solid var(--line); }
.clerkmini { display: flex; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.clerkmini svg { width: 16px; height: 16px; color: var(--peri-2); flex: none; margin-top: 2px; }
.clerkmini b { font-weight: 500; font-size: 14.5px; }
.clerkmini small { display: block; font-size: 12.5px; color: var(--mute); margin-top: 2px; }
.clerkmini .on { margin-left: auto; width: 7px; height: 7px; border-radius: 50%; background: var(--good); margin-top: 7px; flex: none; }
.clerkmini .on.is-off { background: var(--dim); }
.reportmini { display: flex; align-items: center; gap: 12px; margin-top: 10px; padding: 14px; border-radius: var(--r-sm); background: var(--panel-2); border: 1px solid var(--line); font-size: 14px; width: 100%; text-align: left; }
.reportmini span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reportmini em { font-style: normal; font-size: 12px; color: var(--mute); }

/* ---------- thread ---------- */
.thread { display: flex; flex-direction: column; gap: 26px; padding-top: 30px; }
.thread:empty { display: none; }
.msg { min-width: 0; }
.msg--user { align-self: flex-end; max-width: min(78%, 640px); padding: 13px 17px; border-radius: 16px 16px 4px 16px; background: var(--panel-2); border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15.5px; line-height: 1.55; }
.msg--user .ufiles { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; white-space: normal; }
.msg--ai { position: relative; padding-left: 44px; }
.msg__av { position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(150deg, #3a3f66, #23253a); border: 1px solid var(--line-2); color: var(--ink); }
.msg__av svg { width: 17px; height: 17px; }
.msg__who { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; font: 400 12px/1 var(--mono); letter-spacing: .06em; color: var(--mute); }
.msg__who b { font-weight: 500; color: var(--ink-2); letter-spacing: .02em; }
.msg__meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 14px; margin-top: 12px; font: 400 11.5px/1 var(--mono); color: var(--dim); }
.msg__meta button { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 8px; border-radius: 6px; font: 400 12px/1 var(--sans); color: var(--mute); }
.msg__meta button:hover { background: rgba(236, 235, 250, .06); color: var(--ink); }
.msg__meta button svg { width: 13px; height: 13px; }
.msg__err { margin-top: 8px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--bad-dim); border: 1px solid rgba(240, 128, 111, .35); color: #ffc9c0; font-size: 14px; }
.think { margin-bottom: 10px; }
.think summary { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; font-size: 13px; color: var(--mute); padding: 4px 10px; border-radius: 99px; border: 1px solid var(--line); }
.think summary::-webkit-details-marker { display: none; }
.think summary::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--peri); }
.think.is-live summary::before { animation: pulse 1s ease-in-out infinite; }
.think div { margin-top: 10px; padding: 10px 14px; border-left: 2px solid var(--line-2); color: var(--mute); font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; max-height: 260px; overflow-y: auto; }
@keyframes pulse { 50% { opacity: .25; } }
.caret { display: inline-block; width: 8px; height: 17px; vertical-align: -3px; background: var(--peri-2); border-radius: 2px; animation: pulse .9s steps(2) infinite; margin-left: 2px; }
.typing { display: inline-flex; gap: 5px; padding: 8px 0; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--mute); animation: pulse 1s ease-in-out infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
.cmpgrid { display: grid; grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr)); gap: 14px; }
.cmpcol { min-width: 0; border: 1px solid var(--line); border-radius: var(--r); background: rgba(255, 255, 255, .02); padding: 14px 16px; }
.cmpcol .msg__who { margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.cmpcol .md { font-size: 14.5px; }

/* ---------- markdown ---------- */
.md { font-size: 15.5px; line-height: 1.65; color: var(--ink); overflow-wrap: anywhere; }
.md > * + * { margin-top: .75em; }
.md h1, .md h2, .md h3, .md h4 { font-family: var(--sans); font-weight: 600; letter-spacing: -.01em; line-height: 1.3; margin-top: 1.2em; }
.md h1 { font-size: 1.32em; } .md h2 { font-size: 1.2em; } .md h3 { font-size: 1.08em; } .md h4 { font-size: 1em; }
.md > :first-child { margin-top: 0; }
.md ul, .md ol { padding-left: 1.35em; }
.md ul { list-style: disc; } .md ol { list-style: decimal; }
.md li + li { margin-top: .3em; }
.md li::marker { color: var(--mute); }
.md a { color: var(--peri-2); text-decoration: underline; text-underline-offset: 3px; }
.md strong { font-weight: 600; color: #fff; }
.md code { font: 400 .88em/1.4 var(--mono); padding: .12em .38em; border-radius: 5px; background: rgba(236, 235, 250, .08); }
.md blockquote { border-left: 2px solid var(--peri); padding: 2px 0 2px 14px; color: var(--ink-2); }
.md hr { border: 0; border-top: 1px solid var(--line); }
.md .tbl { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-sm); }
.md table { border-collapse: collapse; width: 100%; font-size: .93em; }
.md th, .md td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.md th { font-weight: 500; color: var(--ink-2); background: rgba(255, 255, 255, .03); white-space: nowrap; }
.md tr:last-child td { border-bottom: 0; }
.codeb { border: 1px solid var(--line); border-radius: var(--r-sm); background: #0f1018; overflow: hidden; }
.codeb__h { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px 6px 14px; border-bottom: 1px solid var(--line); font: 400 11.5px/1 var(--mono); color: var(--dim); }
.codeb__h button { font: 400 12px/1 var(--sans); color: var(--mute); padding: 5px 8px; border-radius: 5px; }
.codeb__h button:hover { color: var(--ink); background: rgba(255, 255, 255, .07); }
.codeb pre { margin: 0; padding: 14px; overflow-x: auto; font: 400 13px/1.55 var(--mono); color: #d9d8ef; }
.codeb pre code { padding: 0; background: none; font-size: inherit; }

/* ---------- cards / overview ---------- */
.ovg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.card { min-width: 0; border: 1px solid var(--line); border-radius: var(--r-lg); background: linear-gradient(180deg, rgba(43, 46, 71, .55), rgba(30, 32, 48, .55)); padding: 22px; }
.card--wide { grid-column: span 3; }
.card--wallet { grid-column: span 1; grid-row: span 2; display: flex; flex-direction: column; }
.quick { display: grid; gap: 8px; }
.quick a, .quick button { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid var(--line); background: rgba(255, 255, 255, .02); font-size: 14px; color: var(--ink-2); text-align: left; width: 100%; }
.quick a:hover, .quick button:hover { border-color: var(--line-2); color: var(--ink); }
.quick svg { width: 16px; height: 16px; color: var(--peri-2); flex: none; }
.quick span { flex: 1; }
.quick em { font-style: normal; color: var(--dim); }
.card__h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.card__h h3 { font: 400 11.5px/1.3 var(--mono); letter-spacing: .18em; text-transform: uppercase; color: var(--mute); }
.card__h a, .card__h button { font-size: 12.5px; color: var(--mute); }
.card__h a:hover, .card__h button:hover { color: var(--ink); }
.big { font: 400 34px/1.05 var(--serif); letter-spacing: -.01em; }
.big small { font: 400 13px/1 var(--mono); color: var(--mute); margin-left: 6px; letter-spacing: 0; }
.kv { display: grid; gap: 0; margin-top: 14px; }
.kv > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.kv > div span { color: var(--mute); }
.kv > div b { font: 500 13.5px/1.3 var(--mono); text-align: right; overflow-wrap: anywhere; }
.addrline { display: flex; align-items: center; gap: 8px; font: 400 13px/1.3 var(--mono); color: var(--ink-2); flex-wrap: wrap; }
.addrline button, .addrline a { font: 400 12px/1 var(--sans); color: var(--peri-2); padding: 5px 8px; border-radius: 6px; border: 1px solid rgba(142, 149, 232, .3); }
.addrline button:hover, .addrline a:hover { background: var(--peri-dim); }
.cardlist li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; min-width: 0; }
.cardlist li > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cardlist li small { margin-left: auto; font: 400 12px/1 var(--mono); color: var(--dim); white-space: nowrap; }
.empty { padding: 18px 0 4px; color: var(--dim); font-size: 14px; line-height: 1.55; }
.errbox { padding: 14px; border-radius: var(--r-sm); border: 1px solid rgba(240, 128, 111, .35); background: var(--bad-dim); color: #ffd0c8; font-size: 14px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.errbox .btn { margin-left: auto; }
.acttbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.acttbl th, .acttbl td { padding: 10px 8px; border-top: 1px solid var(--line); text-align: left; white-space: nowrap; }
.acttbl th { font: 400 11px/1.2 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--dim); border-top: 0; }
.acttbl td.m { font-family: var(--mono); font-size: 12.5px; }
.acttbl a { color: var(--peri-2); }
.tscroll { overflow-x: auto; }
.ok { color: var(--good); } .bad { color: var(--bad); } .warn { color: var(--warn); }

/* ---------- rooms ---------- */
.rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.roomc { position: relative; display: flex; flex-direction: column; gap: 12px; min-height: 176px; padding: 20px; border-radius: var(--r-lg); border: 1px solid var(--line); background: radial-gradient(260px 160px at 85% 0%, rgba(142, 149, 232, .16), transparent 70%), linear-gradient(180deg, #25283f, #1d1f30); text-align: left; transition: border-color .2s, transform .2s var(--ease); }
.roomc:hover { border-color: var(--line-2); transform: translateY(-2px); }
.roomc__ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: rgba(236, 235, 250, .06); border: 1px solid var(--line); color: var(--peri-2); }
.roomc__ic svg { width: 17px; height: 17px; }
.roomc b { font: 400 22px/1.15 var(--serif); }
.roomc small { color: var(--mute); font-size: 13px; }
.roomc .tag { position: absolute; right: 16px; top: 18px; }
.roomc--new { align-items: center; justify-content: center; border-style: dashed; background: transparent; color: var(--mute); text-align: center; }
.roomc--new:hover { color: var(--ink); }
.roomc--new span { font-size: 28px; line-height: 1; }
.roomv { margin-top: 26px; border: 1px solid var(--line-2); border-radius: var(--r-lg); background: linear-gradient(180deg, #22243a, #1b1d2d); overflow: hidden; }
.roomv__h { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.roomv__h h3 { font: 400 26px/1.1 var(--serif); }
.roomv__h .acts { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.roomv__g { display: grid; grid-template-columns: 1.1fr 1fr; gap: 0; }
.roomv__g > div { padding: 20px 22px; min-width: 0; }
.roomv__g > div + div { border-left: 1px solid var(--line); }
.roomv textarea { width: 100%; min-height: 220px; resize: vertical; padding: 14px; border-radius: var(--r-sm); border: 1px solid var(--line); background: rgba(0, 0, 0, .18); color: var(--ink); line-height: 1.6; font-size: 14.5px; outline: none; }
.roomv textarea:focus { border-color: rgba(142, 149, 232, .5); }
.saved { font: 400 11.5px/1 var(--mono); color: var(--dim); }

/* ---------- forms ---------- */
.form > * + * { margin-top: 14px; }
.fld label, .fld .lbl { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 7px; }
.fld input, .fld textarea, .fld select { width: 100%; height: 44px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: rgba(0, 0, 0, .2); color: var(--ink); outline: none; font-size: 15px; }
.fld textarea { height: auto; min-height: 96px; padding: 12px 14px; line-height: 1.55; resize: vertical; }
.fld input:focus, .fld textarea:focus, .fld select:focus { border-color: rgba(142, 149, 232, .6); box-shadow: 0 0 0 3px rgba(142, 149, 232, .12); }
.fld input.mono { font-family: var(--mono); font-size: 14px; }
.fld small { display: block; margin-top: 6px; font-size: 12.5px; color: var(--mute); line-height: 1.45; }
.fld select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--mute) 50%), linear-gradient(135deg, var(--mute) 50%, transparent 50%); background-position: calc(100% - 18px) 19px, calc(100% - 13px) 19px; background-size: 5px 5px; background-repeat: no-repeat; }
.fld select option { background: #1c1d2c; }
.frow { display: flex; gap: 10px; flex-wrap: wrap; }
.frow > .btn { flex: none; }
.ferr { color: var(--bad); font-size: 13.5px; min-height: 1em; }
.strength { height: 4px; border-radius: 99px; background: rgba(236, 235, 250, .08); margin-top: 8px; overflow: hidden; }
.strength i { display: block; height: 100%; width: 0; transition: width .3s, background .3s; }
.switch { position: relative; width: 40px; height: 23px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: rgba(236, 235, 250, .16); transition: background .2s; pointer-events: none; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); }
.switch input:checked + span { background: var(--peri); }
.switch input:checked + span::after { transform: translateX(17px); }
.switch input:disabled + span { opacity: .55; }
.setrow { display: flex; align-items: center; gap: 16px; padding: 16px 0; border-top: 1px solid var(--line); }
.setrow > div { flex: 1; min-width: 0; }
.setrow b { font-weight: 500; font-size: 15px; }
.setrow p { color: var(--mute); font-size: 13.5px; margin-top: 3px; line-height: 1.5; }
.setsec { margin-top: 34px; }
.setsec > h3 { font: 400 24px/1.2 var(--serif); margin-bottom: 8px; }
.setsec > p { color: var(--mute); font-size: 14px; margin-bottom: 8px; }

/* ---------- guard / ask dialogs ---------- */
.gfind { display: grid; gap: 8px; }
.gfind li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid var(--line); background: rgba(255, 255, 255, .02); font-size: 14px; line-height: 1.5; }
.gfind li.is-block { border-color: rgba(240, 128, 111, .45); background: var(--bad-dim); }
.gfind li.is-warn { border-color: rgba(235, 195, 109, .4); background: var(--warn-dim); }
.gfind li b { display: block; font-weight: 500; }
.gfind li code { font: 400 12px/1.4 var(--mono); color: var(--mute); }
.gacts { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.asklist { display: grid; gap: 6px; margin: 4px 0 2px; }
.asklist li { position: relative; padding-left: 18px; font-size: 14px; color: var(--ink-2); line-height: 1.5; }
.asklist li::before { content: ''; position: absolute; left: 2px; top: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--peri); }

/* ---------- clerks ---------- */
.clerks { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.clerkc { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: var(--r); border: 1px solid var(--line); background: linear-gradient(180deg, #23253a, #1c1e2e); text-align: left; transition: border-color .2s, background .2s; min-width: 0; }
.clerkc:hover { border-color: var(--line-2); }
.clerkc[aria-pressed="true"] { border-color: rgba(142, 149, 232, .65); background: linear-gradient(180deg, #2b2f4c, #20223a); box-shadow: 0 0 0 3px rgba(142, 149, 232, .1); }
.clerkc__top { display: flex; align-items: center; justify-content: space-between; }
.clerkc__ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: rgba(142, 149, 232, .12); color: var(--peri-2); }
.clerkc__ic svg { width: 16px; height: 16px; }
.clerkc b { font-weight: 500; font-size: 15px; }
.clerkc small { font-size: 12.5px; color: var(--mute); line-height: 1.4; }
.clerkc .dotst { width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px var(--good-dim); }
.clerkc .dotst.is-off { background: var(--dim); box-shadow: none; }
.clerkc__use { font: 400 11.5px/1 var(--mono); color: var(--dim); margin-top: auto; }
.clerkv { margin-top: 22px; display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 18px; align-items: start; }
.cpanel { border: 1px solid var(--line); border-radius: var(--r-lg); background: rgba(255, 255, 255, .02); padding: 20px; min-width: 0; }
.cpanel > h3 { font: 400 26px/1.15 var(--serif); }
.cpanel > h3 + p { margin-top: 6px; color: var(--mute); font-size: 14px; line-height: 1.55; }
.cpanel .fld textarea { min-height: 130px; font-size: 13.5px; }
.cpanel--run { padding: 22px; }
.runout { margin-top: 18px; display: grid; gap: 16px; }
.facts { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.facts__h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; background: rgba(255, 255, 255, .03); border-bottom: 1px solid var(--line); }
.facts__h b { font-weight: 500; font-size: 14.5px; }
.facts__g { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.facts__g > div { padding: 12px 16px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; }
.facts__g span { display: block; font: 400 11px/1.3 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }
.facts__g b { display: block; margin-top: 6px; font: 500 15px/1.3 var(--sans); overflow-wrap: anywhere; }
.facts .tscroll { border-top: 0; }
.facts .acttbl td, .facts .acttbl th { padding: 9px 16px; }
.report { border: 1px solid var(--line-2); border-radius: var(--r); background: linear-gradient(180deg, #24273e, #1e2033); padding: 20px 22px; }
.report__h { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.report__h b { font: 400 21px/1.2 var(--serif); }
.report__acts { display: flex; gap: 8px; flex-wrap: wrap; }
.runs li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.runs li button { flex: 1; min-width: 0; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.runs li button:hover { color: var(--ink); }
.runs li small { font: 400 11.5px/1 var(--mono); color: var(--dim); }

/* ---------- ledger ---------- */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.tile { border: 1px solid var(--line); border-radius: var(--r); padding: 18px; background: rgba(255, 255, 255, .02); min-width: 0; }
.tile span { display: block; font: 400 11px/1.3 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.tile b { display: block; margin-top: 10px; font: 400 30px/1 var(--serif); }
.tile small { display: block; margin-top: 8px; font-size: 12.5px; color: var(--mute); }
.lgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.bars li { display: grid; grid-template-columns: 130px minmax(0, 1fr) 56px; align-items: center; gap: 12px; padding: 7px 0; font-size: 13px; }
.bars li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.bars li i { display: block; height: 8px; border-radius: 99px; background: linear-gradient(90deg, var(--peri), var(--peri-2)); min-width: 3px; }
.bars li em { font: 400 12px/1 var(--mono); font-style: normal; color: var(--mute); text-align: right; }
.lfilters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 22px 0 12px; }
.lfilters select { height: 36px; padding: 0 30px 0 12px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: rgba(0, 0, 0, .2); color: var(--ink); font-size: 13.5px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--mute) 50%), linear-gradient(135deg, var(--mute) 50%, transparent 50%); background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px; background-size: 5px 5px; background-repeat: no-repeat; }
.lfilters select option { background: #1c1d2c; }
.lfilters .sp { flex: 1; }
.ltable { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.ltable .acttbl th, .ltable .acttbl td { padding: 10px 14px; }
.ltable .acttbl td.h { font-family: var(--mono); font-size: 12px; color: var(--dim); }
.stmt { border: 1px solid var(--line); border-radius: var(--r-sm); background: #0f1018; padding: 14px; font: 400 12.5px/1.6 var(--mono); color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 240px; overflow-y: auto; }
.vres { padding: 14px 16px; border-radius: var(--r-sm); font-size: 14.5px; line-height: 1.55; }
.vres.is-ok { border: 1px solid rgba(127, 211, 169, .45); background: var(--good-dim); color: #c8f2dc; }
.vres.is-bad { border: 1px solid rgba(240, 128, 111, .45); background: var(--bad-dim); color: #ffd0c8; }
.vres code { font: 400 12.5px/1.5 var(--mono); overflow-wrap: anywhere; }

/* ---------- welcome ---------- */
.modal__box--welcome { max-width: 860px; display: grid; grid-template-columns: 1fr 1.15fr; }
.wel__art { min-height: 440px; background: linear-gradient(180deg, rgba(19, 20, 29, 0) 40%, rgba(19, 20, 29, .7)), url('/assets/img/hero-1024.webp') 72% 50% / cover no-repeat, #24263b; }
.wel__body { padding: 38px 36px 34px; display: flex; flex-direction: column; gap: 14px; }
.wel__h { font: 400 40px/1.05 var(--serif); letter-spacing: -.02em; }
.wel__h em { font-style: italic; font-weight: 300; }
.wel__list { display: grid; gap: 9px; margin: 6px 0 4px; }
.wel__list li { display: grid; grid-template-columns: 92px minmax(0, 1fr); align-items: baseline; font-size: 14px; color: var(--ink-2); }
.wel__list b { display: block; font: 500 11.5px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--peri-2); }
.wel__acts { display: grid; gap: 10px; margin-top: auto; }

/* ---------- mobile tab bar ---------- */
.tabbar { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .clerks { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .clerkv { grid-template-columns: minmax(0, 1fr); }
  .ovg { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card--wide { grid-column: span 2; }
  .card--wallet { grid-row: span 1; }
}
@media (max-width: 1080px) {
  body[data-app] .hdr__end .hide-m { display: none; }
  .appx { grid-template-columns: minmax(0, 1fr); bottom: calc(64px + env(safe-area-inset-bottom)); }
  .side { display: none; }
  .topbar { padding: 0 16px; height: 54px; }
  .topbar__r { display: flex; }
  .topbar .pill:not(.pill--room) { display: none; }
  .tabbar { display: grid; grid-template-columns: repeat(6, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; height: calc(64px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: rgba(22, 23, 34, .97); border-top: 1px solid var(--line); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11px; color: var(--mute); }
  .tabbar a svg { width: 19px; height: 19px; }
  .tabbar a[aria-current="page"] { color: var(--ink); }
  .tabbar a[aria-current="page"] svg { color: var(--peri-2); }
  .ws.has-thread .composer { bottom: 0; }
  .ws { min-height: calc(100dvh - var(--hdr) - 54px - 64px); }
  .roomv__g { grid-template-columns: minmax(0, 1fr); }
  .roomv__g > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lgrid { grid-template-columns: minmax(0, 1fr); }
  .modal__box--welcome { grid-template-columns: minmax(0, 1fr); max-width: 520px; }
  .wel__art { min-height: 160px; }
}
@media (max-width: 720px) {
  .ws { padding: 0 16px; }
  .ws__hello { padding: 36px 0 22px; }
  .ws__below { grid-template-columns: minmax(0, 1fr); gap: 22px; margin-top: 32px; }
  .pane__in { padding: 26px 16px 60px; }
  .ovg { grid-template-columns: minmax(0, 1fr); }
  .card--wide { grid-column: span 1; }
  .clerks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .msg--ai { padding-left: 0; }
  .msg__av { display: none; }
  .msg--user { max-width: 92%; }
  .cmpgrid { grid-template-columns: minmax(0, 1fr); }
  .cmp__priv span, .cmp__priv { font-size: 0; gap: 0; }
  .cmp__priv svg { width: 15px; height: 15px; }
  .cmp__row { flex-wrap: nowrap; gap: 6px; padding: 8px 8px 10px 8px; }
  .mpick { flex: 1 1 auto; min-width: 0; }
  .mpick__btn { max-width: 100%; width: 100%; }
  .cmp__toggle { padding: 0 10px; flex: none; }
  .cmp__toggle span { display: none; }
  .cmp__priv { margin-left: 0; flex: none; }
  .cmp__icon { flex: none; }
  .mpick__menu { width: min(300px, calc(100vw - 40px)); }
  .chips button { font-size: 13px; padding: 0 12px; }
  .bars li { grid-template-columns: 96px minmax(0, 1fr) 48px; }
  .wel__body { padding: 26px 22px; }
  .wel__h { font-size: 32px; }
  .phd__acts { width: 100%; }
  .phd__acts .btn { flex: 1; }
  .card { padding: 18px; }
  .tile b { font-size: 26px; }
}
@media (max-width: 380px) {
  .topbar__l b { font-size: 16px; }
  .clerks { grid-template-columns: minmax(0, 1fr); }
  .tiles { grid-template-columns: minmax(0, 1fr); }
}
