:root {
  color-scheme: dark;
  --background: #010402;
  --panel: #050d08;
  --ink: #f3efe2;
  --title: #f6dfae;
  --muted: #a9b3a5;
  --line: #22342a;
  --gold: #d7ad62;
  --gold-deep: #9a7230;
  --glow: #c88a2c;
  --mint: #4ff09a;
  --mint-soft: #8be8b4;
  --loss: #ff6f68;
  --serif: "Cinzel", "Trajan Pro", "Optima", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Avenir Next", "Segoe UI", Inter, system-ui, sans-serif;
  font-family: var(--sans);
  font-weight: 300;
  color: var(--ink);
  background: var(--background);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; position: relative; overflow-x: hidden; background: radial-gradient(ellipse 60% 45% at 50% 32%, #07311a, #020905 62%, var(--background)) fixed; }
.ambient { position: fixed; inset: auto 0 0; height: 30vh; pointer-events: none; z-index: -1; background: radial-gradient(ellipse 70% 100% at 30% 100%, #0b3a1f88, transparent 70%), radial-gradient(ellipse 60% 90% at 80% 100%, #0a2e1966, transparent 70%); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { opacity: .6; cursor: wait; }
:focus-visible { outline: 2px solid var(--mint); outline-offset: 4px; }
a { color: inherit; text-decoration: none; }
p { color: var(--muted); line-height: 1.55; margin: .7rem 0 1rem; }
h1, h2 { margin: 0; font-weight: 400; }
h1 { font: 400 clamp(2.1rem, 4.6vw, 3.6rem)/1.1 var(--serif); letter-spacing: .02em; color: var(--title); text-shadow: 0 0 28px #c88a2c55; text-wrap: balance; }
.shell { width: min(1480px, 95%); margin-inline: auto; }

/* ---------- Masthead ---------- */
.masthead { position: relative; }
.masthead::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--gold-deep) 15%, #f6dfae 50%, var(--gold-deep) 85%, transparent); box-shadow: 0 0 12px var(--glow); }
.masthead-inner { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1.5rem; padding: 1.2rem 0 1.1rem; }
.masthead-left { display: flex; align-items: center; gap: 1.1rem; }
.emblem { width: 58px; height: 58px; flex: none; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle, #3a2a0e, #0b0803 70%); box-shadow: 0 0 22px #c88a2c66, inset 0 0 12px #f6dfae33; }
.emblem svg { width: 50px; height: 50px; fill: none; stroke: #e7c07a; stroke-width: 1; }
.disciplines { list-style: none; margin: 0; padding: 0 0 0 1.1rem; border-left: 1px solid var(--gold-deep); font-size: .72rem; letter-spacing: .3em; text-transform: uppercase; color: var(--ink); line-height: 1.75; }
.brand { display: flex; flex-direction: column; align-items: center; text-align: center; }
.brand-title { display: flex; align-items: center; gap: 1.2rem; font: 400 clamp(2.4rem, 5.6vw, 4.4rem)/1 var(--serif); letter-spacing: .12em; color: transparent; background: linear-gradient(180deg, #fff3d6 10%, #e0b46a 55%, #a3762d 95%); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 0 14px #c88a2c88); white-space: nowrap; }
.brand-title i { display: block; width: clamp(2rem, 9vw, 9rem); height: 2px; background: linear-gradient(90deg, transparent, #e7c07a); box-shadow: 0 0 8px var(--glow); }
.brand-title i:last-child { transform: scaleX(-1); }
.brand-sub { margin-top: .55rem; font-size: clamp(.7rem, 1.4vw, 1rem); letter-spacing: .55em; text-transform: uppercase; color: var(--ink); padding-left: .55em; }
.masthead-right { display: grid; grid-template-columns: auto auto; justify-content: end; align-items: center; column-gap: 1.6rem; row-gap: .4rem; }
.statuses { list-style: none; margin: 0; padding: 0; font-size: .7rem; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); line-height: 1.95; }
.statuses li { display: flex; align-items: center; gap: .7rem; }
.statuses .lead { color: var(--mint); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #d8e3c5; }
.lead .dot { background: var(--mint); box-shadow: 0 0 10px var(--mint); animation: blink 2.4s ease-in-out infinite; }
.ticker { display: flex; align-items: flex-end; gap: 4px; height: 46px; }
.ticker i { width: 2px; background: linear-gradient(#5cf5a2, #5cf5a200); animation: tick 3.2s ease-in-out infinite; }
.ticker i:nth-child(1) { height: 30%; animation-delay: -.2s; } .ticker i:nth-child(2) { height: 45%; animation-delay: -.9s; }
.ticker i:nth-child(3) { height: 35%; animation-delay: -1.4s; } .ticker i:nth-child(4) { height: 60%; animation-delay: -.5s; }
.ticker i:nth-child(5) { height: 50%; animation-delay: -2.1s; } .ticker i:nth-child(6) { height: 72%; animation-delay: -1.1s; }
.ticker i:nth-child(7) { height: 58%; animation-delay: -2.6s; } .ticker i:nth-child(8) { height: 80%; animation-delay: -.3s; }
.ticker i:nth-child(9) { height: 66%; animation-delay: -1.7s; } .ticker i:nth-child(10) { height: 90%; animation-delay: -.7s; }
.ticker i:nth-child(11) { height: 76%; animation-delay: -2.3s; } .ticker i:nth-child(12) { height: 100%; animation-delay: -1.3s; }
.masthead nav { grid-column: 1 / -1; justify-self: end; }
nav { display: flex; align-items: center; gap: 1rem; font-size: .78rem; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); }
nav a:hover, .quiet:hover { color: var(--title); }
nav .quiet { color: var(--gold); letter-spacing: .18em; text-transform: uppercase; font-size: .78rem; }
@keyframes blink { 50% { opacity: .35; } }
@keyframes tick { 50% { transform: scaleY(.55); } }
.ticker i { transform-origin: bottom; }

main { flex: 1; padding-block: clamp(1.5rem, 3vw, 2.5rem) 3rem; }
#loading { text-align: center; padding-top: 4rem; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); }

/* ---------- Panels ---------- */
.panel { position: relative; border: 1px solid #b08a4766; border-radius: 6px; background: linear-gradient(170deg, #07130cee, #020604f2); box-shadow: 0 0 0 1px #00000080, 0 0 24px #c88a2c1c, inset 0 0 30px #00000066; padding: 1.15rem 1.4rem 1.3rem; }
.panel::before { content: ""; position: absolute; top: -1px; left: 12%; right: 12%; height: 1px; background: linear-gradient(90deg, transparent, #ffdca0, transparent); box-shadow: 0 0 10px #e0a54a; }
.panel-title { font: 400 .9rem/1.2 var(--sans); letter-spacing: .3em; text-transform: uppercase; color: var(--title); padding-bottom: .75rem; margin-bottom: .9rem; border-bottom: 1px solid #b08a4740; }

/* ---------- Auth ---------- */
.auth-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr); align-items: center; gap: clamp(1.5rem, 5vw, 4.5rem); }
.intro { text-align: center; }
.intro .brain-stage { height: clamp(260px, 38vw, 440px); }
.intro p { max-width: 32rem; margin: 1.1rem auto 0; font-size: 1.02rem; }
.eyebrow { display: block; color: var(--gold); font-size: .75rem; font-weight: 500; letter-spacing: .38em; text-transform: uppercase; margin-bottom: .9rem; }
.auth-card { padding: clamp(1.4rem, 3.5vw, 2.2rem); }
.switcher { display: grid; grid-template-columns: 1fr 1fr; gap: .25rem; padding: .25rem; border: 1px solid var(--line); border-radius: 6px; background: #030a06; margin-bottom: 1.5rem; }
.switcher button { border: 0; border-radius: 4px; padding: .6rem .35rem; background: transparent; color: var(--muted); font-size: .85rem; }
.switcher button[aria-pressed="true"] { background: #13281b; color: var(--title); }
form { display: grid; gap: .6rem; }
label { display: block; color: var(--muted); font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; }
input { width: 100%; border-radius: 4px; border: 1px solid #2f4637; background: #020805; color: var(--ink); min-height: 48px; padding: .75rem; font-weight: 400; }
input:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px #c88a2c33; }
input::placeholder { color: #6f8277; }
#auth-form label:not(:first-child) { margin-top: .35rem; }
.field-hint { font-size: .85rem; margin: .8rem 0 0; }
.password-field { position: relative; }
.password-field input { padding-right: 5.25rem; }
.password-field button { position: absolute; right: .65rem; top: 50%; transform: translateY(-50%); }
.primary, .secondary { border-radius: 4px; padding: .8rem 1.3rem; min-height: 46px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; font-size: .8rem; }
.primary { border: 1px solid #f6dfae55; background: linear-gradient(180deg, #ecc87f, #b48439); color: #150f05; box-shadow: 0 0 18px #c88a2c55; }
.primary:hover:not(:disabled) { background: linear-gradient(180deg, #f8dc9e, #c6974a); }
.secondary { color: var(--title); background: #04100a; border: 1px solid #b08a4766; }
.secondary:hover { border-color: var(--gold); box-shadow: 0 0 14px #c88a2c44; }
.quiet { background: transparent; color: var(--muted); border: 0; padding: .45rem; font-size: .85rem; }
.feedback { margin: .15rem 0; color: var(--mint); font-size: .9rem; }
.feedback:empty { display: none; }
.feedback.problem, .loss { color: var(--loss) !important; }
.gain { color: var(--mint) !important; }

/* ---------- Dashboard ---------- */
.dashboard { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr) minmax(0, 1fr); gap: 1.2rem; align-items: stretch; }
.column { display: grid; gap: 1.2rem; align-content: start; }
.overview { margin: 0; display: grid; gap: .55rem; }
.overview div { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.overview dt { font-size: clamp(1.05rem, 1.6vw, 1.35rem); color: var(--ink); }
.overview dd { margin: 0; font-size: clamp(1.05rem, 1.6vw, 1.35rem); font-variant-numeric: tabular-nums; color: var(--ink); overflow-wrap: anywhere; text-align: right; }
.overview dd.gain { color: var(--mint); }
.performance-body { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: end; gap: 1rem; }
.performance-body strong { display: block; font: 400 clamp(1.8rem, 3vw, 2.5rem)/1 var(--sans); color: var(--ink); font-variant-numeric: tabular-nums; }
.performance-body strong.gain { color: var(--title) !important; text-shadow: 0 0 16px #c88a2c66; }
.performance-body span { display: block; margin-top: .45rem; font-size: .85rem; color: var(--muted); }
#performance-chart { width: 100%; height: 96px; overflow: visible; filter: drop-shadow(0 0 6px #36e58a66); }

.core { position: relative; display: flex; flex-direction: column; align-items: center; min-height: 420px; }
.brain-stage { position: relative; width: 100%; height: clamp(300px, 30vw, 430px); }
.brain-stage::before { content: ""; position: absolute; inset: 8% 15% 20%; border-radius: 50%; background: radial-gradient(circle, #17b55e40, transparent 65%); filter: blur(10px); }
.brain { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.core-readout { text-align: center; margin-top: -1.2rem; }
.core-readout span { font-size: .75rem; letter-spacing: .4em; text-transform: uppercase; color: var(--gold); padding-left: .4em; }
.core-readout strong { display: block; margin-top: .45rem; font: 400 clamp(2.1rem, 4.2vw, 3.4rem)/1.05 var(--serif); letter-spacing: .03em; color: transparent; background: linear-gradient(180deg, #fff3d6, #d9a957 80%); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 0 14px #c88a2c77); font-variant-numeric: tabular-nums; }
.core-readout p { margin: .5rem 0 0; font-size: .85rem; letter-spacing: .08em; overflow-wrap: anywhere; }

.activity { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }
.activity li { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr) auto; align-items: center; gap: .9rem; padding: .48rem 0; font-size: 1rem; }
.activity svg { width: 1.3rem; height: 1.3rem; fill: none; stroke: #e9e2cf; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.activity b { font-weight: 400; color: var(--mint); text-shadow: 0 0 10px #4ff09a55; }

.empty { margin: 1.2rem auto 0; max-width: 40rem; text-align: center; }
.timestamp { margin: 1.3rem 0 .4rem; font-size: .8rem; text-align: center; letter-spacing: .2em; text-transform: uppercase; }
.timestamp:empty { display: none; }
#portfolio > .feedback { text-align: center; }
#refresh { display: block; margin: 1.2rem auto 0; }

/* ---------- Admin ---------- */
.heading { margin-bottom: 1.8rem; text-align: center; }
.heading p { overflow-wrap: anywhere; }
.invite-card { margin-bottom: 1.2rem; }
.invite-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .65rem; }
.invite-result { display: grid; gap: .5rem; margin-top: 1rem; }
input[readonly] { color: var(--muted); }
.admin-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr); gap: 1.2rem; align-items: start; }
.listing label { margin: .4rem 0 .45rem; }
.listing ul { list-style: none; margin: .8rem 0 .3rem; padding: 0; max-height: 26rem; overflow: auto; }
.listing li + li { margin-top: .3rem; }
.client-option { text-align: left; border-radius: 4px; border: 1px solid transparent; background: transparent; width: 100%; padding: .7rem; overflow-wrap: anywhere; color: var(--ink); }
.client-option:hover { background: #0c1d13; }
.client-option[aria-pressed="true"] { border-color: #b08a4799; background: #10261a; }
.client-option small { display: block; color: var(--gold); margin-top: .25rem; font-variant-numeric: tabular-nums; }
.editor form { gap: 1rem; }
.account { overflow-wrap: anywhere; margin: 0; color: var(--title); }
.amounts, .calculation { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.amounts label { margin-bottom: .45rem; }
.calculation { border-block: 1px solid var(--line); padding: 1rem 0; }
.calculation span { color: var(--muted); font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; }
.calculation strong { display: block; margin-top: .45rem; font-size: 1.4rem; font-weight: 400; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.demo-settings { margin-top: 1.6rem; padding-top: 1.35rem; border-top: 1px solid var(--line); }
.demo-settings .panel-title { border: 0; padding: 0; margin-bottom: .2rem; }

footer { position: relative; letter-spacing: .25em; text-transform: uppercase; padding-block: 1.2rem; display: flex; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: .7rem; }
footer::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--gold-deep), #f6dfae, var(--gold-deep), transparent); box-shadow: 0 0 10px var(--glow); }

@media (max-width: 1100px) {
  .masthead-inner { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: .9rem; }
  .masthead-left { order: 2; }
  .masthead-right { order: 3; justify-content: center; }
  .masthead nav { justify-self: center; }
  .dashboard { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .core { grid-column: 1 / -1; order: -1; min-height: 0; }
}
@media (max-width: 780px) {
  .auth-layout, .admin-layout, .dashboard { grid-template-columns: 1fr; }
  .masthead-left, .ticker { display: none; }
  .brand-title i { width: 1.5rem; }
  .brand-sub { letter-spacing: .35em; }
}
@media (max-width: 450px) {
  .shell { width: calc(100% - 28px); }
  .panel { padding: 1rem; }
  .amounts, .calculation, .invite-controls { grid-template-columns: 1fr; }
  .performance-body { grid-template-columns: 1fr; }
  footer { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  .dot, .ticker i { animation: none !important; }
}
