/* Borro's new app: the parts the real app adds to the Robinhood-style page (rh.css), in its own tokens (pro.css,
   rh.css; dark.css redefines them): the order card's fields, the Portfolio's positions and claims, the wallet picker,
   the account menu and the terms step. Light first, then dark under :root[data-theme="dark"]. */

/* What is hidden stays hidden, whatever display a part has. */
.order [hidden], #pf [hidden], .wallets [hidden], #engine { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ------------------------------------------------------------------ the Connect pill, once connected */
body.connected #connect { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); font-variant-numeric: tabular-nums; }
body.connected #connect:hover { box-shadow: inset 0 0 0 1px var(--ink); filter: none; }

/* ------------------------------------------------------------------ the order card's fields */
.omode { display: flex; gap: 4px; margin: 14px 0 2px; padding: 4px; border-radius: 12px; background: var(--sunk); }
.omode button { flex: 1; min-height: 34px; padding: 6px 8px; border: 0; border-radius: 8px; background: none; font: 600 13px/1.25 var(--ui); color: var(--text-2); cursor: pointer; }
.omode button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(13, 13, 15, .08), 0 0 0 1px var(--line); }
.omode button:disabled { cursor: default; opacity: .6; }
.opay { margin-top: 10px; }
.order.reviewing #o-mode, .order.done #o-mode { display: none; }

.orow.oin > label, .orow > span:first-child { color: var(--ink); font-weight: 500; font-size: 15px; }
.ofield { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); transition: border-color .15s, box-shadow .15s; max-width: 210px; }
.ofield:focus-within { border-color: var(--act); box-shadow: 0 0 0 3px rgba(220, 106, 53, .15); }
.ofield input { width: 120px; height: 100%; padding: 0; border: 0; background: none; text-align: right; font: 650 16px var(--ui); color: var(--ink); outline: 0; box-shadow: none; font-variant-numeric: tabular-nums; }
.orow .ofield input:focus { box-shadow: none; border: 0; }
.ofield input:disabled { color: var(--text-3); }
.opre, .osuf { font: 650 15px var(--ui); color: var(--text-3); }
.olab { display: inline-flex; align-items: center; gap: 8px; }
.olab label { color: var(--ink); font-weight: 500; font-size: 15px; }
.olong { height: 30px; margin-left: 0; padding: 0 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--sunk); font: 650 13px var(--ui); color: var(--ink); }
.obal { display: flex; justify-content: flex-end; align-items: center; gap: 10px; min-height: 30px; padding: 4px 0 8px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.omax { padding: 3px 9px; border: 1px solid var(--act); border-radius: 999px; background: none; font: 650 12px var(--ui); color: var(--act-ink); cursor: pointer; }
.omax:hover { background: color-mix(in srgb, var(--act) 10%, transparent); }
.omax:disabled { opacity: .5; cursor: default; }
.oslide { padding: 14px 0 6px; border-bottom: 1px solid var(--line); }
.oslide input[type="range"] { width: 100%; accent-color: var(--act); }
.omarks { display: flex; justify-content: space-between; margin-top: 2px; font-size: 12px; color: var(--text-3); }
.orow b small { display: block; text-align: right; font-size: 12px; font-weight: 500; color: var(--text-3); }
/* A row whose label stays on one line and whose value's note wraps under it (the Buy tab's price per share). */
.orow.keep > span { flex: none; }
.orow.keep b { min-width: 0; text-align: right; }
.olines { margin-top: 10px; }
.olines p { font-size: 13px; line-height: 1.5; color: var(--text-2); }
.olines p + p { margin-top: 4px; }
.olines p.warn, .onote.warn, .oerr { color: var(--down); }
.onote { margin-top: 10px; font-size: 14px; line-height: 1.5; color: var(--text-2); }
.oerr { margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--down) 8%, transparent); font-size: 14px; line-height: 1.5; }
.owait { margin-top: 10px; text-align: center; font-size: 14px; color: var(--text-2); }
.order.pending #o-submit { position: relative; }
.order.pending #o-submit::before { content: ""; width: 14px; height: 14px; margin-right: 10px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; animation: ospin .8s linear infinite; }
@keyframes ospin { to { transform: rotate(360deg); } }
/* The Buy tab (app-order.js): no review, so its own button carries the wallet's wait. */
.order.pending.direct #o-review { position: relative; }
.order.pending.direct #o-review::before, #o-lendgo.going::before { content: ""; width: 14px; height: 14px; margin-right: 10px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; animation: ospin .8s linear infinite; }
/* Quick amounts under the Buy tab's amount: one row of pills, always one line. */
.oquick { display: flex; gap: 6px; padding: 10px 0 2px; }
.oquick button { flex: 1 1 0; min-width: 0; min-height: 32px; padding: 0 6px; border: 1px solid var(--line-2); border-radius: 999px; background: none; font: 650 13px var(--ui); color: var(--ink); white-space: nowrap; cursor: pointer; font-variant-numeric: tabular-nums; }
.oquick button:hover { border-color: var(--act); color: var(--act-ink); }
.oquick button:disabled { opacity: .5; cursor: default; }
/* Lend it too: a switch row under the Buy tab's numbers. */
.olendtoo { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; font-size: 14px; line-height: 1.4; color: var(--ink); cursor: pointer; }
.olendtoo[hidden] { display: none; }
.olendtoo input { flex: none; appearance: none; -webkit-appearance: none; position: relative; width: 38px; height: 22px; margin: 0; border-radius: 999px; background: var(--line-2); cursor: pointer; transition: background .15s; }
.olendtoo input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(13, 13, 15, .25); transition: transform .15s; }
.olendtoo input:checked { background: var(--act); }
.olendtoo input:checked::after { transform: translateX(16px); }
.olendtoo input:focus-visible { outline: 2px solid var(--act); outline-offset: 2px; }
.olendtoo input:disabled { opacity: .6; cursor: default; }
.success .olend p.warn { color: var(--down); }
.pill-btn:disabled { opacity: .45; cursor: default; filter: none; transform: none; }
.pill-btn.sm { height: 34px; padding: 0 16px; font-size: 14px; }
.olink { display: inline-block; margin-top: 10px; font-weight: 650; font-size: 14px; color: var(--act-ink); text-decoration: none; }
.olink:hover { text-decoration: underline; }
.success #o-dt { word-break: break-word; }
/* After a buy, the offer to lend the shares (app-order.js): the card's main button, Done a quiet one under it. */
.success .olend { margin-top: 18px; padding: 14px 14px 0; border: 1px solid var(--line); border-radius: 14px; text-align: left; }
.success .olend p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--ink); }
.success .olend .pill-btn.block { margin-top: 12px; margin-bottom: 14px; }
.success.lendable #o-done { height: 40px; margin-top: 6px; background: none; color: var(--text-2); }
.success.lendable #o-done:hover { color: var(--ink); filter: none; }

/* The engine's own blocks, in the card: the bookrunner's lines and an agent credit line's limits. */
.oref .dk-ref { margin-top: 12px; text-align: center; font-size: 13px; line-height: 1.5; color: var(--text-2); }
.oref .dk-ref b { color: var(--ink); }
.oref .dk-ref a { margin-left: 8px; font-weight: 650; color: var(--act-ink); text-decoration: none; }
.oslot .dk-credit { margin-top: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 12px; }
.dk-credit .cr-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; }
.dk-credit .cr-head a { font-size: 13px; font-weight: 650; color: var(--act-ink); text-decoration: none; }
.dk-credit .cr-field { display: grid; gap: 6px; font-size: 13px; color: var(--text-2); }
.dk-credit .cr-field > label, .dk-credit .cr-lab { font-weight: 600; color: var(--ink); }
.dk-credit input:not([type="checkbox"]) { width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); font: 500 14px var(--ui); color: var(--ink); outline: 0; }
.dk-credit input:focus { border-color: var(--act); }
.dk-credit input.bad { border-color: var(--down); }
.dk-credit .cr-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dk-credit .cr-chip { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 999px; overflow: hidden; }
.dk-credit .cr-chip button { border: 0; background: none; padding: 4px 10px; font: 600 13px var(--ui); color: var(--text-2); cursor: pointer; }
.dk-credit .cr-chip .cr-pick[aria-pressed="true"] { background: var(--act); color: #fff; }
.dk-credit .cr-add { display: flex; gap: 6px; }
.dk-credit .cr-add .btn { height: 36px; }
.dk-credit .cr-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dk-credit .cr-in { display: flex; align-items: center; gap: 6px; }
.dk-credit .seg { display: flex; gap: 4px; }
.dk-credit .seg button { flex: 1; height: 32px; border: 1px solid var(--line-2); border-radius: 8px; background: none; font: 600 13px var(--ui); cursor: pointer; }
.dk-credit .seg button[aria-pressed="true"] { border-color: var(--act); color: var(--act-ink); }
.dk-credit .cr-check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.dk-credit .cr-note { font-size: 13px; color: var(--text-3); line-height: 1.5; }

/* The pinned Trade button (phones) steps aside while the card is on screen. */
body.rh.order-shown .mtrade { display: none !important; }

/* ------------------------------------------------------------------ the watchlist: what the wallet holds */
.wrow small.held { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ the position cards on a stock */
.pcard div b a, .pc-connect { color: var(--act-ink); text-decoration: none; font-weight: 650; }

/* ------------------------------------------------------------------ the Portfolio */
.pf-lead { margin-top: 10px; max-width: 34em; font-size: 16px; line-height: 1.55; color: var(--text-2); }
#pf-connect { margin-top: 20px; }
.big.est { opacity: .7; }
.pf-none { padding: 18px 0; color: var(--text-2); font-size: 15px; border-bottom: 1px solid var(--line); }
.pf-fine { padding-top: 12px; font-size: 13px; color: var(--text-3); line-height: 1.5; }
/* Share (site/share-card.js): a row button at the head's right, out of the flow so nothing moves when it shows. */
.pf-head { position: relative; padding-right: 104px; }
.pf-head .pf-share { position: absolute; top: 50%; right: 0; display: inline-flex; align-items: center; gap: 6px; transform: translateY(-50%); }
.pf-head .pf-share svg { width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.pgroup h2 { margin-bottom: 0; }
.prow { padding: 16px 0; border-bottom: 1px solid var(--line); }
.prow-top { display: grid; grid-template-columns: minmax(150px, 1.1fr) minmax(0, 3fr) auto; align-items: center; gap: 18px; }
.pwho { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pwho img, .plogo { width: 36px; height: 36px; flex: none; border-radius: 50%; border: 1px solid var(--line); }
.plogo { background: var(--sunk); }
.pwho b { display: block; font-weight: 650; font-size: 16px; }
.pwho small { display: block; font-size: 13px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcols { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 6px 16px; }
.pcols dt { font-size: 12px; color: var(--text-3); }
.pcols dd { margin-top: 2px; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pcols dd small { display: block; font-size: 12px; font-weight: 500; color: var(--text-3); }
.pcols dd.up { color: var(--up); }
.pcols dd.down { color: var(--down); }
.pcols dd.est, .pcols dd.wait { opacity: .6; }
.pacts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.pbtn { height: 32px; padding: 0 13px; border: 1px solid var(--line-2); border-radius: 999px; background: none; font: 650 13px var(--ui); color: var(--ink); cursor: pointer; white-space: nowrap; transition: border-color .15s, color .15s; }
.pbtn:hover { border-color: var(--act); color: var(--act-ink); }
.pbtn.danger:hover { border-color: var(--down); color: var(--down); }
.pbtn:disabled { opacity: .45; cursor: default; border-color: var(--line-2); color: var(--ink); }
.phealth { display: flex; align-items: center; gap: 12px; margin: 12px 0 0 48px; font-size: 13px; color: var(--text-2); }
.phealth i { position: relative; flex: none; width: 120px; height: 6px; border-radius: 6px; background: var(--sunk); overflow: hidden; }
.phealth i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); border-radius: 6px; background: var(--up); }
.phealth.warn i::after { background: #D99A2B; }
.phealth.bad i::after { background: var(--down); }
.phealth span { font-variant-numeric: tabular-nums; }
.phealth small { margin-left: 10px; color: var(--text-3); }
.pnote { margin: 8px 0 0 48px; font-size: 13px; color: var(--text-2); }
.pask { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 0 48px; }
.pask .ofield { max-width: 240px; }
.pask-note { font-size: 13px; color: var(--down); }
.claim { display: grid; grid-template-columns: minmax(0, 1fr) auto 96px; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.claim .cname b { display: block; font-weight: 650; font-size: 15px; }
.claim .cname small { display: block; margin-top: 2px; font-size: 13px; color: var(--text-3); }
.claim .camt { font-weight: 650; font-size: 15px; font-variant-numeric: tabular-nums; text-align: right; }
.claim .camt.yes { color: var(--act-ink); }
.claim .camt.none { color: var(--text-3); font-weight: 500; }
.claim .camt.wait { opacity: .6; }
.claim .pill-btn { justify-self: end; }
.acts { display: grid; }
.act { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.act img { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); }
.act b { display: block; font-weight: 600; font-size: 15px; }
.act small { display: block; font-size: 13px; color: var(--text-3); }
.act .when { font-size: 13px; color: var(--text-3); white-space: nowrap; }
.act:hover b { color: var(--act-ink); }

@media (max-width: 1100px) {
  .prow-top { grid-template-columns: minmax(0, 1fr) auto; }
  .pcols { grid-column: 1 / -1; grid-row: 2; }
  .pacts { grid-column: 2; grid-row: 1; }
}
@media (max-width: 640px) {
  .prow-top { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .pacts { grid-column: 1; grid-row: 3; justify-content: flex-start; }
  .pcols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .phealth, .pnote, .pask { margin-left: 0; }
  .phealth { flex-wrap: wrap; }
  .claim { grid-template-columns: minmax(0, 1fr) auto; }
  .claim .pill-btn, .claim > span:last-child { grid-column: 1 / -1; justify-self: stretch; }
  .ofield { max-width: 190px; }
  .ofield input { width: 100px; }
}

/* ------------------------------------------------------------------ the wallet picker */
dialog.wallets, dialog.consent { width: min(420px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px -30px rgba(13, 13, 15, .45); overflow: auto; }
dialog.wallets::backdrop, dialog.consent::backdrop { background: rgba(13, 13, 15, .42); backdrop-filter: blur(3px); }
.wallets .w-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 10px 22px; }
.wallets h2 { font: 650 19px var(--ui); letter-spacing: -.01em; }
.wallets .w-x { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 999px; background: var(--sunk); cursor: pointer; }
.wallets .w-x svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.wallets .w-list { display: grid; gap: 4px; padding: 4px 12px; }
.wallets .w-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; padding: 10px; border: 0; border-radius: 12px; background: none; text-align: left; color: inherit; text-decoration: none; cursor: pointer; font: 600 15px var(--ui); }
.wallets .w-row:hover, .wallets .w-row:focus-visible { background: var(--sunk); }
.wallets .w-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; overflow: hidden; background: var(--sunk); }
.wallets .w-icon img { width: 32px; height: 32px; border-radius: 8px; }
.wallets .w-letter { font-weight: 700; color: var(--text-2); }
.wallets .w-tag { font-size: 12px; font-weight: 600; color: var(--text-3); }
.wallets .w-tag.on { color: var(--up); }
.wallets .w-tag.recent { color: var(--act-ink); }
.wallets .w-get { padding: 4px 12px; border: 1px solid var(--act); border-radius: 999px; font-size: 13px; font-weight: 650; color: var(--act-ink); }
.wallets .w-none { padding: 4px 22px 8px; font-size: 14px; color: var(--text-2); line-height: 1.5; }
.wallets .w-none p + p { margin-top: 6px; }
.wallets .w-more { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--line); }
.wallets .w-sub { padding: 10px 22px 4px; font: 600 13px var(--ui); color: var(--text-3); }
.wallets .w-foot { padding: 12px 22px 18px; font-size: 13px; line-height: 1.5; color: var(--text-3); }

/* ------------------------------------------------------------------ the account menu (the address, once connected) */
.acct-menu { position: fixed; z-index: 60; min-width: 230px; padding: 6px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 24px 50px -20px rgba(13, 13, 15, .35); }
.acct-menu .acct-head { padding: 10px 12px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.acct-menu .acct-head b { display: block; font-weight: 650; font-variant-numeric: tabular-nums; }
.acct-menu .acct-head small { display: block; font-size: 13px; color: var(--text-3); }
.acct-menu .acct-row { display: block; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px; background: none; text-align: left; font: 600 14px var(--ui); color: var(--ink); text-decoration: none; cursor: pointer; }
.acct-menu .acct-row:hover, .acct-menu .acct-row:focus-visible { background: var(--sunk); }
.acct-menu .acct-out { color: var(--down); }

/* ------------------------------------------------------------------ the terms step, before the first transaction */
.consent .cs-head { padding: 22px 22px 8px; }
.consent .cs-stripe { display: flex; gap: 4px; margin-bottom: 14px; }
.consent .cs-stripe i { width: 28px; height: 4px; border-radius: 2px; background: var(--act); }
.consent .cs-stripe i:nth-child(2) { background: #EDB25A; }
.consent .cs-stripe i:nth-child(3) { background: var(--down); }
.consent h2 { font: 650 19px var(--ui); letter-spacing: -.01em; }
.consent #consentLead { margin-top: 6px; font-size: 14px; color: var(--text-2); line-height: 1.5; }
.consent .cs-list { display: grid; gap: 12px; padding: 12px 22px; }
.consent .cs-list li { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start; }
.consent .cs-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--sunk); }
.consent .cs-icon svg { width: 18px; height: 18px; fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.consent .cs-list b { display: block; font-weight: 650; font-size: 15px; }
.consent .cs-list span span { display: block; font-size: 13px; color: var(--text-2); line-height: 1.45; }
.consent .cs-agree { display: flex; gap: 10px; align-items: flex-start; margin: 6px 22px 0; padding: 12px; border-radius: 12px; background: var(--sunk); font-size: 14px; line-height: 1.45; cursor: pointer; }
.consent .cs-agree input { margin-top: 3px; accent-color: var(--act); }
.consent .cs-agree a { color: var(--act-ink); font-weight: 600; }
.consent .cs-btns { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 22px 20px; }
.consent .cs-btns .btn { border-radius: 999px; }
.consent .cs-btns .btn:not(.line) { background: var(--act); border-color: var(--act); color: #fff; }
.consent .cs-btns .btn:disabled { opacity: .45; cursor: default; }

/* ------------------------------------------------------------------ dark */
:root[data-theme="dark"] .ofield, :root[data-theme="dark"] .dk-credit input:not([type="checkbox"]) { background: var(--surface); }
:root[data-theme="dark"] .omode button[aria-pressed="true"] { background: #232328; box-shadow: 0 0 0 1px var(--line-2); }
:root[data-theme="dark"] .olong { background: var(--sunk); }
:root[data-theme="dark"] dialog.wallets, :root[data-theme="dark"] dialog.consent, :root[data-theme="dark"] .acct-menu { box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .9); }
:root[data-theme="dark"] dialog.wallets::backdrop, :root[data-theme="dark"] dialog.consent::backdrop { background: rgba(0, 0, 0, .6); }
:root[data-theme="dark"] .phealth.warn i::after { background: #E6AE4A; }
:root[data-theme="dark"] body.connected #connect { color: var(--ink); }
:root[data-theme="dark"] .order.pending #o-submit::before { border-color: rgba(255, 255, 255, .35); border-top-color: #fff; }

@media (prefers-reduced-motion: reduce) {
  .order.pending #o-submit::before { animation: none; }
}
