/* Client portal — compact, task-first layout on the Superchat visual system. */
.client-page { background: #f5f3ee; }
.client-page [hidden] { display: none !important; }
.client-page .nav { color: var(--ink); }
.client-page .nav--stuck { background: rgba(251, 250, 247, .84); }
.client-main { min-height: calc(100svh - var(--nav-h)); padding: calc(var(--nav-h) + clamp(2rem, 6vh, 4.5rem)) var(--gut) clamp(3.5rem, 7vh, 6rem); }
.client-main a { color: var(--violet); }
.client-auth,
.client-dashboard { width: 100%; max-width: 1180px; margin-inline: auto; }

.client-auth {
  min-height: calc(100svh - var(--nav-h) - clamp(5rem, 12vh, 9rem));
  display: grid;
  align-items: center;
  gap: clamp(2rem, 7vw, 7rem);
}
.client-auth__story { max-width: 590px; }
.client-auth__story > .eyebrow { margin-bottom: 1.15rem; }
.client-auth__story .h1 { max-width: 12ch; line-height: 1.08; }
.client-auth__story > .lead { max-width: 48ch; margin-top: 1.5rem; }
.client-trust { display: grid; margin-top: clamp(2rem, 5vh, 3.4rem); border-top: 1px solid var(--rule); }
.client-trust li { display: grid; grid-template-columns: 2.25rem 1fr; gap: .8rem; padding-block: 1rem; border-bottom: 1px solid var(--rule); }
.client-trust li > span { padding-top: .14rem; color: var(--violet); font: .68rem/1 var(--mono); }
.client-trust b { display: block; font-size: .92rem; }
.client-trust p { margin-top: .2rem; color: var(--fg-mid); font-size: .82rem; }

.client-auth__card {
  width: 100%; max-width: 455px; justify-self: end;
  padding: clamp(1.5rem, 4vw, 2.4rem);
  border: 1px solid rgba(10, 11, 16, .1);
  border-radius: 24px;
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 26px 90px rgba(30, 25, 50, .11);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}
.client-auth__mark { width: 2.75rem; height: 2.75rem; display: grid; place-items: center; margin-bottom: 2rem; border-radius: 13px; background: var(--ink); color: #fff; }
.client-auth__card > .eyebrow { margin-bottom: .55rem; }
.client-auth__card > .client-muted { margin-top: .5rem; }
.client-auth__card form { display: grid; gap: 1rem; margin-top: 1.65rem; }
.client-field { display: grid; gap: .42rem; min-width: 0; }
.client-field label { font-size: .75rem; font-weight: 650; color: #444854; }
.client-field input,
.client-field textarea,
.client-field select {
  width: 100%; min-height: 2.9rem; padding: .72rem .82rem;
  border: 1px solid #d9d6ce; border-radius: 10px; outline: 0;
  background: #fff; color: var(--ink); font-size: .91rem;
  transition: border-color .2s, box-shadow .2s;
}
.client-field textarea { resize: vertical; }
.client-field input:focus,
.client-field textarea:focus,
.client-field select:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(122, 43, 245, .1); }
.client-labelrow { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.client-textbtn { padding: 0; color: var(--violet); font-size: .72rem; font-weight: 650; }
.client-primary,
.client-secondary,
.client-danger {
  min-height: 2.75rem; display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .68rem 1.05rem; border-radius: 999px; font-size: .82rem; font-weight: 650;
  transition: transform .2s var(--ease), opacity .2s, border-color .2s;
}
.client-primary { border: 1px solid transparent; background: var(--grad); color: #fff; }
.client-secondary { border: 1px solid #cdc9c0; background: rgba(255, 255, 255, .75); color: var(--ink); }
.client-danger { min-height: 2.15rem; padding: .42rem .72rem; border: 1px solid rgba(176, 35, 35, .25); color: #a82525; background: #fffafa; }
.client-primary:hover,
.client-secondary:hover,
.client-danger:hover { transform: translateY(-1px); }
.client-primary:disabled,
.client-secondary:disabled { opacity: .52; cursor: wait; }
.client-message { min-height: 1.25rem; color: #a82525; font-size: .79rem; }
.client-message.is-good { color: #187548; }
.client-switch { margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--rule); color: var(--fg-mid); font-size: .82rem; text-align: center; }
.client-switch button { color: var(--violet); font-weight: 650; }
.client-fine { margin-top: 1.25rem; color: var(--fg-dim); font-size: .69rem; text-align: center; }
.client-muted { color: var(--fg-mid); font-size: .84rem; }

.client-dashboard { display: grid; gap: clamp(1.5rem, 4vh, 2.4rem); }
.client-dashhead { display: flex; align-items: end; justify-content: space-between; gap: 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--rule); }
.client-dashhead .eyebrow { margin-bottom: .6rem; }
.client-dashhead .client-muted { margin-top: .55rem; }
.client-actions { display: flex; gap: .65rem; flex-wrap: wrap; }
.client-tabs { position: sticky; z-index: 20; top: calc(var(--nav-h) + .6rem); display: flex; gap: .35rem; overflow-x: auto; padding: .45rem; border: 1px solid var(--rule); border-radius: 999px; background: rgba(251, 250, 247, .9); box-shadow: 0 10px 35px rgba(20, 20, 30, .06); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); scrollbar-width: none; }
.client-tabs::-webkit-scrollbar { display: none; }
.client-tabs button { flex: 0 0 auto; padding: .65rem .95rem; border-radius: 999px; color: var(--fg-mid); font-size: .76rem; font-weight: 650; }
.client-tabs button[aria-selected="true"] { background: var(--ink); color: #fff; }
.client-alert { padding: .8rem 1rem; border: 1px solid rgba(122, 43, 245, .2); border-radius: 10px; background: rgba(122, 43, 245, .06); color: #4f247f; font-size: .83rem; }
.client-alert.is-error { border-color: rgba(176, 35, 35, .2); background: #fff1f0; color: #9a2323; }
.client-tabpanel { min-height: 22rem; }
.client-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; }
.client-metrics article { min-width: 0; padding: 1.35rem; border: 1px solid var(--rule); border-radius: 16px; background: rgba(255, 255, 255, .7); }
.client-metrics span,
.client-metrics small { display: block; color: var(--fg-mid); font-size: .7rem; }
.client-metrics b { display: block; margin-block: .45rem .35rem; font-size: clamp(1.55rem, 3vw, 2.35rem); line-height: 1; letter-spacing: -.04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client-sectionhead { display: flex; align-items: end; justify-content: space-between; gap: 1.5rem; margin: clamp(2rem, 5vh, 3.6rem) 0 1.25rem; }
.client-sectionhead .eyebrow { margin-bottom: .55rem; }
.client-products { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; }
.client-product { position: relative; overflow: hidden; min-height: 12rem; display: flex; flex-direction: column; padding: 1.3rem; border: 1px solid var(--rule); border-radius: 16px; background: #fff; }
.client-product::before { content: ""; position: absolute; width: 9rem; height: 9rem; inset: -4rem -3rem auto auto; border-radius: 50%; background: radial-gradient(circle, rgba(122, 43, 245, .16), transparent 68%); }
.client-product span { color: var(--violet); font: .64rem/1.3 var(--mono); text-transform: uppercase; letter-spacing: .09em; }
.client-product h3 { margin-top: .8rem; font-size: 1.05rem; }
.client-product p { margin-top: .5rem; color: var(--fg-mid); font-size: .78rem; }
.client-product b { margin-top: auto; padding-top: 1.4rem; font-size: 1.35rem; letter-spacing: -.03em; }
.client-inlineform { display: flex; align-items: end; gap: .75rem; padding: 1.1rem; border: 1px solid var(--rule); border-radius: 16px; background: rgba(255, 255, 255, .68); }
.client-inlineform > .client-field { min-width: 12rem; }
.client-inlineform--small { padding: 0; border: 0; background: none; margin: 1rem 0 1.25rem; }
.client-grow { flex: 1; }
.client-cardlist { display: grid; gap: .8rem; margin-top: 1rem; }
.client-empty { padding: 2rem; border: 1px dashed #cbc7bd; border-radius: 14px; color: var(--fg-mid); text-align: center; }
.client-assistant,
.client-conversation { padding: 1.25rem; border: 1px solid var(--rule); border-radius: 16px; background: #fff; }
.client-assistant__top { display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
.client-assistant__top h3 { font-size: 1rem; }
.client-assistant__url { display: block; max-width: 64ch; margin-top: .3rem; color: var(--fg-mid); font-size: .75rem; word-break: break-all; }
.client-status { padding: .28rem .55rem; border-radius: 999px; background: #f0eee8; font: .64rem/1 var(--mono); text-transform: uppercase; }
.client-status.ready { background: #e7f5ed; color: #17623e; }
.client-status.scanning { background: #f1eafa; color: #6626a2; }
.client-status.error { background: #fff0ee; color: #a82525; }
.client-assistant__meta { margin-top: .8rem; color: var(--fg-mid); font-size: .76rem; }
.client-codebox { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: .9rem; padding: .75rem .85rem; border-radius: 10px; background: #11131a; color: #eae8e1; }
.client-codebox code { min-width: 0; overflow: hidden; text-overflow: ellipsis; font: .69rem/1.5 var(--mono); white-space: nowrap; }
.client-codebox button { flex: 0 0 auto; color: #c7a7ff; font-size: .72rem; }
.client-cardactions { display: flex; gap: .55rem; flex-wrap: wrap; margin-top: .9rem; }
.client-docs { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--rule); }
.client-docs h4 { font-size: .8rem; }
.client-docrow { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding-block: .55rem; border-bottom: 1px solid var(--rule-2); font-size: .74rem; }
.client-docrow span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.client-callout { padding: 1.2rem; border: 1px solid rgba(122, 43, 245, .2); border-radius: 16px; background: linear-gradient(140deg, rgba(122, 43, 245, .07), rgba(242, 98, 31, .05)); }
.client-callout__row { display: flex; align-items: center; justify-content: space-between; gap: .8rem; }
.client-callout code { display: block; min-width: 0; margin-top: .35rem; color: #30275d; font: .72rem/1.5 var(--mono); word-break: break-all; }
.client-splitcards { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(17rem, .75fr); gap: .8rem; margin-top: .8rem; }
.client-panelcard { padding: 1.25rem; border: 1px solid var(--rule); border-radius: 16px; background: rgba(255, 255, 255, .76); }
.client-panelcard > .client-muted { margin-top: .45rem; }
.client-panelcard > .client-field { margin-top: 1rem; }
.client-tablewrap { width: 100%; overflow-x: auto; }
.client-table { width: 100%; border-collapse: collapse; font-size: .76rem; }
.client-table th { padding: .65rem .55rem; border-bottom: 1px solid var(--rule); color: var(--fg-mid); font-size: .65rem; font-weight: 650; text-align: left; text-transform: uppercase; letter-spacing: .06em; }
.client-table td { max-width: 25rem; padding: .75rem .55rem; border-bottom: 1px solid var(--rule-2); vertical-align: top; }
.client-table code { font: .68rem/1.5 var(--mono); }
.client-table button { color: var(--violet); font-size: .7rem; font-weight: 650; }
.client-balance { margin-top: .65rem; font-size: clamp(2.3rem, 5vw, 4rem); font-weight: 700; letter-spacing: -.05em; line-height: 1; }
.client-check { display: flex; align-items: center; gap: .65rem; margin-top: 1.15rem; font-size: .82rem; }
.client-check input { width: 1rem; height: 1rem; accent-color: var(--violet); }
.client-dual { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; margin-block: 1rem; }
.client-ledger { margin-top: .8rem; }
.client-ledger__row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: .7rem; border-bottom: 1px solid var(--rule-2); font-size: .78rem; }
.client-ledger__row small { display: block; color: var(--fg-mid); }
.client-ledger__row b { color: #187548; }
.client-search { max-width: 30rem; margin-bottom: 1rem; }
.client-conversation { display: grid; grid-template-columns: 10rem 1fr auto; gap: 1rem; align-items: start; }
.client-conversation time { color: var(--fg-mid); font-size: .72rem; }
.client-conversation h3 { font-size: .88rem; }
.client-conversation p { margin-top: .3rem; color: var(--fg-mid); font-size: .75rem; }

/* --- Analytics ---------------------------------------------------------- */
.client-range { display: flex; align-items: end; flex-wrap: wrap; gap: .75rem; padding: 1.1rem; border: 1px solid var(--rule); border-radius: 16px; background: rgba(255, 255, 255, .68); }
.client-range > .client-field { width: 11rem; }
.client-presets { display: flex; align-items: center; gap: .9rem; margin-left: auto; padding-bottom: .5rem; }
.client-lines { display: flex; gap: .35rem; overflow-x: auto; margin-top: .8rem; padding: .35rem; border: 1px solid var(--rule); border-radius: 999px; background: rgba(255, 255, 255, .68); scrollbar-width: none; }
.client-lines::-webkit-scrollbar { display: none; }
.client-lines button { flex: 0 0 auto; padding: .55rem .9rem; border-radius: 999px; color: var(--fg-mid); font-size: .75rem; font-weight: 650; }
.client-lines button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.client-linecard { margin-top: .8rem; }
.client-linehead { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.client-linehead .client-muted { font: .72rem/1 var(--mono); }
.client-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .8rem; }
.client-tiles article { min-width: 0; padding: 1.1rem; border: 1px solid var(--rule); border-radius: 14px; background: #fff; }
.client-tiles span { display: block; color: var(--fg-mid); font-size: .68rem; }
.client-tiles b { display: block; margin-top: .4rem; font-size: clamp(1.4rem, 2.6vw, 2rem); line-height: 1; letter-spacing: -.04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client-chart:empty { display: none; }
.client-chart { margin-top: 1.1rem; }
.client-chart svg { display: block; width: 100%; height: clamp(130px, 20vh, 210px); overflow: visible; }
.client-chart rect { fill: var(--violet); fill-opacity: .78; }
.client-chart rect:hover { fill-opacity: 1; }
.client-chart figcaption { margin-top: .6rem; color: var(--fg-mid); font-size: .72rem; }
.client-summary { min-height: 1.2rem; margin-top: 1rem; font-size: .88rem; line-height: 1.6; }
.client-summary:empty { display: none; }
.client-summarymeta { text-align: left; }
.client-summarymeta:empty { display: none; }

/* --- Conversations: totals + country split, and the leads filter row ----- */
.client-filters { display: flex; align-items: end; gap: .8rem; flex-wrap: wrap; margin-bottom: 1rem; }
.client-filters .client-search { margin-bottom: 0; }
.client-filters .client-field { min-width: 12rem; }
#convTotals:empty, #convCountries:empty { display: none; }
#convTotals { margin-bottom: 1rem; }
.client-countries { margin-bottom: 1.25rem; }
.client-countries h4, .client-countries .h4 { margin-bottom: .6rem; font-size: .8rem; }
.client-countrylist { display: flex; flex-wrap: wrap; gap: .45rem; }
.client-country {
  display: inline-flex; align-items: baseline; gap: .45rem;
  padding: .35rem .7rem; border: 1px solid var(--rule); border-radius: 999px;
  background: rgba(255, 255, 255, .7); font-size: .76rem;
}
.client-country b { font-size: .8rem; }
@media (max-width: 720px) {
  .client-filters { flex-direction: column; align-items: stretch; }
  .client-filters .client-field { width: 100%; min-width: 0; }
}

.client-product { cursor: pointer; }
.client-product:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
.client-drawer { margin-top: .8rem; padding: 1.25rem; border: 1px solid var(--rule); border-radius: 16px; background: rgba(255, 255, 255, .8); }
.client-pager { display: flex; align-items: center; gap: .9rem; margin-top: 1rem; }
.client-pager:empty { display: none; }

.client-footer { padding-block: 1.2rem; border-top: 1px solid rgba(10, 11, 16, .1); background: #f5f3ee; color: #686b76; font-size: .72rem; }
.client-footer .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.client-footer nav { display: flex; gap: 1rem; }

@media (min-width: 880px) {
  .client-auth { grid-template-columns: minmax(0, 1.08fr) minmax(360px, .78fr); }
}
@media (max-width: 980px) {
  .client-metrics,
  .client-products { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .client-splitcards { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .client-main { padding-inline: 1rem; padding-top: calc(var(--nav-h) + 1.5rem); }
  .client-range { align-items: stretch; }
  .client-range > .client-field { width: 100%; }
  .client-presets { margin-left: 0; padding-bottom: 0; justify-content: space-between; }
  .client-auth { align-items: start; }
  .client-auth__story .h1 { font-size: clamp(2rem, 11vw, 3.2rem); }
  .client-trust { display: none; }
  .client-auth__card { justify-self: stretch; max-width: none; }
  .client-dashhead { align-items: start; flex-direction: column; }
  .client-tabs { border-radius: 14px; }
  .client-inlineform { align-items: stretch; flex-direction: column; }
  .client-inlineform > .client-field { width: 100%; min-width: 0; }
  .client-inlineform > button { width: 100%; }
  .client-sectionhead { align-items: start; flex-direction: column; }
  .client-callout__row { align-items: start; flex-direction: column; }
  .client-conversation { grid-template-columns: 1fr; }
}
@media (max-width: 460px) {
  .client-metrics,
  .client-products { grid-template-columns: 1fr; }
  .client-auth__story > .lead { font-size: 1rem; }
  .client-dual { grid-template-columns: 1fr; }
  .client-footer .wrap { align-items: start; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  .client-primary,
  .client-secondary,
  .client-danger { transition: none; }
}

/* -- Partner console overview tiles --------------------------------------- *
   partner.js renders six stat tiles into #pOverview as
   .client-cards > .client-card > .client-card__label/__value/__sub.
   None of those five classes had a rule anywhere, so the console showed
   eighteen unstyled paragraphs stacked down the page. Matched to
   .client-assistant / .client-conversation above — the card idiom already in
   this file — so the partner console reads as the same product as the client
   portal rather than a second design.
   ------------------------------------------------------------------------ */
.client-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr));
  gap: .8rem;
  margin-top: 1rem;
}
/* All six tiles on ONE line once there is room for them.
   auto-fit alone could not do this: .client-dashboard caps the console at
   1180px, and at that width a comfortable-looking 13.5rem track fits only five
   tracks, so the sixth tile dropped to a second row. Pinning the count is the
   only way to guarantee one line; the tiles are then 186px each, which is what
   the value font-size below is sized against. */
@media (min-width: 900px) {
  .client-cards { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
.client-card {
  padding: 1rem;
  border: 1px solid var(--rule);
  border-radius: 16px;
  background: #fff;
}
.client-card__label {
  margin: 0;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--fg-dim);
}
.client-card__value {
  margin: .45rem 0 0;
  /* Capped so the widest real value ("13,900,121") fits a 186px tile without
     spilling past the card. Measured, not guessed — see the overflow check. */
  font-size: clamp(1.2rem, 1.7vw, 1.6rem);
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.05;
  /* Tabular figures: six currency tiles side by side otherwise shift width as
     the numbers refresh. */
  font-variant-numeric: tabular-nums;
}
.client-card__sub {
  margin: .3rem 0 0;
  font-size: .78rem;
  line-height: 1.45;
  color: var(--fg-mid);
}

/* -- Partner console: panels and row actions ------------------------------ *
   partner.php was written against class names that near-miss the ones this
   file defines — .client-panel vs the existing .client-panelcard, .client-cards
   vs .client-cardlist — so three more of its classes had no rule at all.
   The visible symptom was the account table's action cell: Fund, Price and
   Suspend are three separate <button>s in one <td>, and with no rule on their
   container they ran together as "FundPriceSuspend".
   ------------------------------------------------------------------------ */

/* Section card. Same treatment as .client-panelcard above; padding is declared
   with the border and radius in the same rule, which is the trap .price and
   .ratecard fell into. Vertical spacing comes from .client-dashboard's grid gap,
   so no margin is set here. */
.client-panel {
  padding: 1.25rem;
  border: 1px solid var(--rule);
  border-radius: 16px;
  background: rgba(255, 255, 255, .76);
}

/* Panel heading beside its own action, e.g. "Your accounts" + "+ Add account".
   Mirrors .client-dashhead without the rule underneath, which would double up
   against the card border. */
.client-panelhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: .35rem;
}

/* The fix for "FundPriceSuspend": three text buttons in one table cell with
   nothing separating them. Same idiom as .client-actions, tighter gap because
   this sits inside a table row. column-gap carries the separation, so the
   buttons stay readable as three controls even when the cell wraps. */
.client-rowactions {
  display: flex;
  align-items: center;
  gap: .3rem .85rem;
  flex-wrap: wrap;
}
