:root {
  color-scheme: dark;
  --studio-bg: #10121b;
  --studio-panel: #191c29;
  --studio-line: #303549;
  --studio-ink: #f1f0fb;
  --studio-muted: #b4b6ce;
  --studio-violet: #c4b5fd;
}
body { background: var(--studio-bg); color: var(--studio-ink); font-size: 1rem; }
aside#site-nav { background: #151724; border-color: var(--studio-line); width: 220px; padding: 1rem .8rem; }
aside#site-nav .brand { display: flex; text-decoration: none; }
aside#site-nav .brandmark { background: linear-gradient(140deg,#c4b5fd,#8b5cf6); color: #171127; }
.navlink { min-height: 2.5rem; font-size: .93rem; color: var(--studio-muted); }
.navlink:hover, .navlink.active { background: #302945; color: #f5edff; }
main { min-width: 0; }
main > header { background: #151724; border-color: var(--studio-line); gap: .5rem; }
.content { max-width: 1300px; padding: clamp(1rem, 3vw, 2.5rem); }
.panel, .card { background: var(--studio-panel); border: 1px solid var(--studio-line); border-radius: 1rem; }
.panel h2, .card h3 { margin-block: .2rem .7rem; }
.card p, .muted { color: var(--studio-muted); }
.grid { gap: 1rem; }
.studio-hero {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: end;
  justify-content: space-between;
  padding: clamp(1.25rem, 4vw, 3rem);
  margin-bottom: 2rem;
  border: 1px solid #5e497d;
  border-radius: 1.25rem;
  background: radial-gradient(ellipse at 85% 0,#553c77,transparent 58%), #231f39;
}
.studio-hero h1 { margin: 0; font-size: clamp(1.8rem, 4vw, 3.4rem); line-height: 1.16; }
.studio-hero p { color: #ded5f4; margin: .8rem 0 0; }
.action, button { background: #c4b5fd; color: #201632; border-color: #b39be9; }
.action:hover, button:hover { background: #d8ccff; color: #201632; }
input, select, textarea { background: #11141f; border-color: #434963; }
input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, button:focus-visible {
  outline: 2px solid var(--studio-violet); outline-offset: 3px;
}
a { color: var(--studio-violet); overflow-wrap: anywhere; }
#menu-toggle { display: none; }
#invite-qr { display: block; width: min(100%,180px); height: auto; margin-top: 1rem; border-radius: .5rem; }

@media (max-width: 760px) {
  body { display: block; }
  #menu-toggle { display: inline-flex; align-items: center; justify-content: center; width: 2.5rem; min-height: 2.5rem; padding: 0; }
  aside#site-nav { display: none; position: fixed; top: 3.75rem; left: 0; height: calc(100dvh - 3.75rem); z-index: 15; width: min(18rem,85vw); box-shadow: 12px 0 32px #0008; }
  aside#site-nav.menu-open { display: block; }
  main > header { padding: .45rem .75rem; min-height: 3.75rem; position: sticky; top: 0; z-index: 16; }
  .headright { gap: .25rem; font-size: .85rem; }
  .headright .mini-btn { display: none; }
  .content { padding: 1rem .8rem; }
  .table-wrap { max-width: 100%; overflow-x: auto; }
}
.panel.savings-records {
    box-sizing: border-box;
    width: 100%;
    max-width: none;
}

.savings-records .table-wrap {
    overflow: visible;
}

.savings-records table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

.savings-records th,
.savings-records td {
    padding: 0.65rem 0.45rem;
    white-space: normal;
    overflow-wrap: anywhere;
}

.savings-records td:last-child button {
    max-width: 100%;
    white-space: normal;
}
main:has(.savings-records),
main .content:has(.savings-records) {
    max-width: none;
    min-width: 0;
}

main .content:has(.savings-records) {
    width: 100%;
    box-sizing: border-box;
}

.savings-records > .table-wrap > table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

.savings-records > .table-wrap th,
.savings-records > .table-wrap td {
    white-space: normal;
    overflow-wrap: anywhere;
}
#my-investments {
    max-width: none;
}

.investment-table-wrap {
    border: 1px solid #303346;
    border-radius: 10px;
}

.investment-table-wrap:focus-visible {
    outline: 2px solid #c9b1ff;
    outline-offset: 2px;
}

.investment-table th,
.investment-table td {
    white-space: nowrap;
    vertical-align: middle;
}

.investment-table thead {
    background: #202336;
}

.investment-table tbody tr:nth-child(even) {
    background: #1c1f2e;
}

.investment-table tbody tr:last-child > * {
    border-bottom: 0;
}

.investment-table .investment-name {
    white-space: normal;
    overflow-wrap: anywhere;
    min-width: 10rem;
}

.investment-table .investment-amount {
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.investment-actions {
    display: flex;
    gap: .5rem;
}

.investment-actions button {
    margin: 0;
}

.member-heading {
    max-width: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: .5rem 1rem;
}
.member-heading h1 { margin-top: 0; }
.member-heading p { margin: .45rem 0; }
.member-balances { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,14rem),1fr)); gap: 1rem; }
.member-balances .panel { max-width: none; margin: 0; }
.member-balances h3 { margin: 0; }
.member-amount { font-size: 1.4rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ledger-panel { max-width: none; }
.ledger-panel td, .ledger-panel th { white-space: nowrap; }

.fund-flow-diagram { display: grid; gap: 1rem; }
.fund-flow-lane { max-width: none; margin: 0; }
.fund-flow-lane h2 { margin-top: 0; }
.fund-flow-steps {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0,1fr);
    gap: 1.65rem;
    list-style: none;
    padding: 0;
}
.fund-flow-steps li {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 4rem;
    padding: .7rem;
    border: 1px solid #48415f;
    border-radius: .6rem;
    background: #211d30;
    text-align: center;
}
.fund-flow-steps li:not(:last-child)::after {
    content: '';
    position: absolute;
    right: -1.1rem;
    width: .55rem;
    height: .55rem;
    border: solid #c9b1ff;
    border-width: 0 2px 2px 0;
    transform: rotate(-45deg);
}
.fund-flow-links { display: flex; flex-wrap: wrap; gap: .6rem; }
.fund-flow-branch { color: #e1d4ff; }
.fund-flow-note { color: #c8bfd7; margin: .8rem 0 0; }
@media (max-width: 760px) {
    .fund-flow-steps { grid-auto-flow: row; grid-auto-columns: auto; gap: 1.3rem; }
    .fund-flow-steps li { min-height: 3rem; }
    .fund-flow-steps li:not(:last-child)::after { right: auto; bottom: -.9rem; transform: rotate(45deg); }
}

.registration-phone { border: 0; padding: 0; margin: 0 0 1rem; min-width: 0; }
.registration-phone legend { padding: 0 0 .4rem; }
.registration-phone-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: .75rem; }
.registration-phone-fields label { min-width: 0; }
@media (max-width: 540px) {
    .registration-phone-fields { grid-template-columns: 1fr; gap: 0; }
}

.site-brand-logo { flex: 0 0 40px; object-fit: contain; border-radius: 9px; }
.site-brand-preview { display: block; object-fit: contain; margin-bottom: 1rem; border-radius: 18px; }

.dashboard-table td,
.dashboard-table th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.dashboard-table .dashboard-group th { background: #221e32; color: #e1d4ff; font-weight: 700; }
.dashboard-table th[scope="row"] { white-space: normal; }

.fiat-settings-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 30rem), 1fr));
    max-width: 76rem;
}
.fiat-settings-grid fieldset { margin: 0 0 1rem; min-width: 0; }
.fiat-settings-grid details { margin-top: 1rem; }
.fiat-settings-grid summary { cursor: pointer; }

.language-switcher { display:flex; flex-wrap:wrap; gap:.35rem; align-items:center; }
.language-switcher [aria-current] { outline:2px solid #c3a4ff; outline-offset:1px; }
@media(max-width: 720px) { header:has(.language-switcher) { flex-wrap:wrap; } }

.recharge-choice-actions {
    display: grid;
    gap: 1rem;
}

.recharge-choice-button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 3rem;
    padding: .7rem 1rem;
    border: 1px solid #ac75f2;
    border-radius: .85rem;
    background: linear-gradient(180deg, #8345c5, #502186);
    box-shadow: inset 0 1px 0 #ffffff50, 0 4px 0 #291345, 0 7px 15px #09041366;
    color: #fff;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    transition: filter .15s ease, transform .15s ease, box-shadow .15s ease;
}

.recharge-choice-button--usdt {
    border-color: #4bdbba;
    background: linear-gradient(180deg, #167f70, #105548);
    box-shadow: inset 0 1px 0 #ffffff50, 0 4px 0 #0a322b, 0 7px 15px #09041366;
}

.recharge-choice-button:hover {
    filter: brightness(1.1);
    color: #fff;
}

.recharge-choice-button:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

.recharge-choice-button:active {
    transform: translateY(3px);
    box-shadow: inset 0 1px 0 #ffffff35, 0 1px 0 #20102f;
}

@media (prefers-reduced-motion: reduce) {
    .recharge-choice-button { transition: none; }
}
