/* Aureo Markets — legibility and premium visual system
   Loaded last on every surface so the platform keeps one consistent hierarchy. */
:root {
  --pro-bg: #061724;
  --pro-bg-deep: #04111b;
  --pro-panel: #0a2234;
  --pro-panel-raised: #0d2a40;
  --pro-line: rgba(116, 205, 244, .22);
  --pro-line-strong: rgba(116, 205, 244, .38);
  --pro-text: #f2f9fd;
  --pro-muted: #9bb6c7;
  --pro-subtle: #7899ac;
  --pro-blue: #47c8ff;
  --pro-blue-soft: #8adeff;
  --pro-green: #45ddb0;
  --pro-red: #78aeff;
  --pro-gold: #f4c86a;
  --pro-shadow: 0 22px 70px rgba(0, 8, 18, .34);
}

html {
  font-size: 16px;
  color-scheme: dark;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body,
button,
input,
select,
textarea {
  font-family: "Segoe UI Variable Text", "Segoe UI", Inter, ui-sans-serif, system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}

body {
  font-size: 15px;
  line-height: 1.5;
}

button,
a,
input,
select,
textarea {
  transition: border-color .18s ease, background-color .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(71, 200, 255, .32);
  outline-offset: 2px;
}

/* Shared brand mark */
.candle-mark,
.aureo-symbol {
  box-shadow: inset 0 1px rgba(255, 255, 255, .12), 0 10px 30px rgba(25, 172, 232, .16);
}

/* Trading terminal */
body:not(.landing-body):not(.login-body):not(.portal-body):not([data-staff-role]) {
  background: var(--pro-bg-deep);
  color: var(--pro-text);
}

.terminal-shell {
  --bg: var(--pro-bg-deep);
  --surface: var(--pro-panel);
  --line: var(--pro-line);
  --text: var(--pro-text);
  --green: var(--pro-green);
  --red: var(--pro-red);
  gap: 10px;
  background:
    radial-gradient(circle at 12% -8%, rgba(43, 185, 245, .12), transparent 30rem),
    radial-gradient(circle at 88% 8%, rgba(74, 222, 203, .06), transparent 28rem),
    var(--pro-bg-deep);
}

.terminal-topbar,
.instrument-bar,
.panel-dark,
.market-sidebar,
.account-sidebar {
  border-color: var(--pro-line) !important;
  background-color: rgba(8, 29, 45, .96) !important;
  box-shadow: 0 10px 34px rgba(0, 8, 18, .18), inset 0 1px rgba(255, 255, 255, .025);
}

.terminal-topbar {
  min-height: 70px;
  height: 70px;
  border-radius: 17px;
  padding-left: 20px;
}

.terminal-brand b { font-size: 16px; letter-spacing: -.018em; }
.terminal-brand small { font-size: 9px; line-height: 1.35; color: var(--pro-blue-soft); letter-spacing: .13em; }

.top-metrics { height: 48px; gap: 7px; }
.top-metrics article {
  min-width: 112px;
  padding: 8px 11px;
  border-color: var(--pro-line);
  border-radius: 11px;
  background: rgba(14, 43, 64, .76);
}
.top-metrics small { font-size: 9px; line-height: 1.1; color: var(--pro-muted); letter-spacing: .08em; }
.top-metrics b { font-size: 12px; line-height: 1.25; color: var(--pro-text); }
.top-metrics span { font-size: 9px; line-height: 1.1; }
.utility-button,
.deposit-button,
.live-status { min-height: 38px; font-size: 11px; font-weight: 750; }
.top-avatar { width: 39px; height: 39px; font-size: 12px; }

.terminal-grid { grid-template-columns: 260px minmax(660px, 1fr) 270px; gap: 10px; }
.market-sidebar,
.account-sidebar { border-radius: 16px; }
.aside-title,
.account-heading { min-height: 58px; }
.aside-title b,
.account-heading b { font-size: 11px; letter-spacing: .1em; }
.aside-title span,
.account-heading small { font-size: 10px; color: var(--pro-muted); }
.market-search { min-height: 43px; border-color: var(--pro-line); background: rgba(3, 16, 26, .64); }
.market-search input { font-size: 12px; color: var(--pro-text); }
.market-search input::placeholder { color: #7898aa; }
.market-tabs { gap: 6px; }
.market-tabs button { min-height: 31px; padding: 0 10px; font-size: 10px; letter-spacing: .025em; }
.market-tabs button.active { color: #02131d; background: linear-gradient(135deg, var(--pro-blue-soft), var(--pro-blue)); }
.market-row { min-height: 62px; height: 62px; padding: 0 9px; border-radius: 11px; }
.market-row:hover,
.market-row.selected { background: rgba(71, 200, 255, .1); }
.market-row.selected { box-shadow: inset 3px 0 var(--pro-blue); }
.market-row b { font-size: 11px; line-height: 1.25; }
.market-row small { font-size: 9px; line-height: 1.25; color: var(--pro-muted); }
.asset-logo { width: 34px; height: 34px; font-size: 11px; }
.asset-logo.large { width: 44px; height: 44px; font-size: 13px; }
.aside-foot b { font-size: 9px; }
.aside-foot small { font-size: 9px; line-height: 1.45; color: var(--pro-subtle); }

.trade-workspace { gap: 10px; }
.instrument-bar { min-height: 72px; border-radius: 16px; padding: 10px 15px; }
.instrument-main h1 { font-size: 19px; line-height: 1.2; letter-spacing: -.02em; }
.instrument-main small { font-size: 10px; color: var(--pro-muted); letter-spacing: .04em; }
.instrument-quote small { font-size: 9px; color: var(--pro-muted); letter-spacing: .06em; }
.instrument-quote b { font-size: 18px; line-height: 1.25; }
.instrument-quote span { font-size: 11px; font-weight: 850; }
.round-button { font-size: 13px; }

.terminal-chart,
.positions-panel { border-radius: 16px; }
.chart-toolbar { min-height: 42px; height: 42px; padding: 0 10px; gap: 5px; }
.timeframes button,
.tool-button,
.indicator-button,
.camera-button { min-width: 29px; height: 30px; padding: 0 8px; font-size: 10px; border-radius: 8px; }
.timeframes button.active,
.indicator-button.active,
.tool-button.active { color: #03131c; background: linear-gradient(135deg, var(--pro-blue-soft), var(--pro-blue)); }
.chart-loading,
.live-price-tag { font-size: 10px; font-weight: 850; }
.quick-trade { gap: 8px; padding: 8px; }
.quote-button { min-height: 52px; border-radius: 11px; padding: 8px 13px; }
.quote-button small { font-size: 9px; letter-spacing: .06em; }
.quote-button b { font-size: 14px; }

.positions-head { min-height: 51px; padding: 0 12px; }
.table-tabs button { min-height: 32px; padding: 0 12px; font-size: 10px; letter-spacing: .03em; }
.table-tabs button span { min-width: 21px; height: 21px; font-size: 9px; }
.position-head,
.order-head { font-size: 9px !important; color: var(--pro-muted) !important; letter-spacing: .08em; }
.position-row,
.order-row { min-height: 66px; font-size: 11px !important; line-height: 1.35; }
.position-row b,
.order-row b { font-size: 11px; }
.position-row small,
.order-row small { font-size: 9px; color: var(--pro-muted); }
.side-pill,
.position-status > small { font-size: 9px !important; }
.position-close,
.position-risk,
.cancel-order { min-height: 30px; padding: 0 9px; font-size: 9px; font-weight: 800; }
.terminal-empty { font-size: 11px; color: var(--pro-muted); }

.closed-trades { width: 100%; }
.closed-trade-head,
.closed-trade-row {
  display: grid;
  grid-template-columns: 1.15fr .55fr 1.05fr .9fr 1fr;
  gap: 14px;
  align-items: center;
}
.closed-trade-head {
  min-height: 29px;
  padding: 0 10px;
  color: var(--pro-muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .08em;
}
.closed-trade-row {
  min-height: 66px;
  padding: 9px 10px;
  border-top: 1px solid rgba(116, 205, 244, .14);
  font-size: 11px;
}
.closed-main,
.closed-date,
.closed-result { display: flex; flex-direction: column; gap: 3px; }
.closed-main b,
.closed-date b { font-size: 11px; }
.closed-main small,
.closed-date small { color: var(--pro-muted); font-size: 9px; line-height: 1.35; }
.closed-prices {
  display: flex;
  gap: 6px;
  align-items: center;
}
.closed-prices b { font-size: 10px; }
.closed-prices i { color: var(--pro-muted); font-size: 9px; font-style: normal; }
.closed-result { align-items: flex-end; text-align: right; }
.closed-result small { font-size: 8px; font-weight: 900; letter-spacing: .06em; }
.closed-result b { font-size: 14px; line-height: 1.15; }
.closed-result em { font-size: 9px; font-style: normal; font-weight: 850; }
.closed-result.positive { color: var(--pro-green) !important; }
.closed-result.negative { color: var(--pro-red) !important; }
.closed-result.neutral { color: var(--pro-muted); }
.history-empty { display: flex; flex-direction: column; gap: 5px; text-align: center; }
.history-empty span { color: var(--pro-blue); font-size: 19px; }
.history-empty b { color: var(--pro-text); font-size: 12px; }
.history-empty small { max-width: 430px; font-size: 10px; line-height: 1.45; }

.mobile-app-nav { display: none; }

.profile-card { min-height: 60px; }
.profile-card > span { font-size: 11px; }
.profile-card b { font-size: 11px; }
.profile-card small { font-size: 9px; color: var(--pro-muted); }
.account-nav a { min-height: 48px; font-size: 11px; color: #bad0dc; }
.account-nav a i { font-size: 13px; color: var(--pro-blue); }
.demo-warning b { font-size: 9px; color: var(--pro-blue-soft); }
.demo-warning p { font-size: 9px; line-height: 1.5; color: var(--pro-muted); }
.reset-account,
.logout-button { min-height: 39px; font-size: 10px; font-weight: 800; }

.order-ticket { color: var(--pro-text); border-color: var(--pro-line-strong); background: #092137; box-shadow: 0 32px 100px rgba(0, 5, 12, .62); }
.order-ticket header small,
.order-asset small { font-size: 9px; color: var(--pro-blue-soft); }
.order-ticket h2 { font-size: 23px; }
.order-ticket > label,
.risk-inputs > label { font-size: 11px; color: #bfd2dc; }
.buy-sell button,
.order-types button { min-height: 38px; font-size: 11px; }
.money-input input,
.order-ticket select { font-size: 14px; }
.order-info span,
.order-ticket > p { font-size: 10px; line-height: 1.5; }
.submit-order { min-height: 47px; font-size: 12px; font-weight: 900; }
.toast { font-size: 11px; line-height: 1.45; }

/* Client portal and access */
.login-body,
.portal-body {
  --bg: var(--pro-bg-deep);
  --surface: var(--pro-panel);
  --line: var(--pro-line);
  --text: var(--pro-text);
  --green: var(--pro-green);
  --red: var(--pro-red);
  color: var(--pro-text);
  background:
    radial-gradient(circle at 8% 4%, rgba(50, 190, 248, .13), transparent 32rem),
    radial-gradient(circle at 92% 88%, rgba(42, 214, 185, .06), transparent 30rem),
    var(--pro-bg-deep);
}

.login-brand-panel,
.portal-sidebar { background: rgba(5, 22, 35, .97); border-color: var(--pro-line); }
.login-brand-panel h1 { font-size: clamp(2.65rem, 4.5vw, 4.65rem); line-height: 1.02; }
.login-brand-panel > p { font-size: 16px; line-height: 1.72; color: var(--pro-muted); }
.login-feature b { font-size: 13px; }
.login-feature small { font-size: 11px; line-height: 1.45; color: var(--pro-muted); }
.login-card {
  width: min(470px, 100%);
  padding: 40px;
  border-color: var(--pro-line-strong);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(13, 42, 63, .97), rgba(7, 27, 42, .98));
  box-shadow: var(--pro-shadow);
}
.login-card h1 { font-size: 28px; line-height: 1.18; letter-spacing: -.035em; }
.login-card > p { font-size: 13px; line-height: 1.58; color: var(--pro-muted); }
.login-card label { font-size: 12px; color: #bfd2dc; }
.login-card input { height: 49px; padding: 0 14px; border-color: var(--pro-line); border-radius: 10px; background: rgba(3, 16, 26, .72); font-size: 14px; }
.login-card input:focus { border-color: var(--pro-blue); box-shadow: 0 0 0 3px rgba(71, 200, 255, .11); }
.login-card button { min-height: 49px; font-size: 13px; font-weight: 850; }
.login-demo,
.demo-access,
.login-note { font-size: 11px !important; line-height: 1.5; }

.portal-shell { grid-template-columns: 248px minmax(0, 1fr); }
.portal-sidebar { padding: 26px 16px 16px; }
.portal-brand b { font-size: 15px; }
.portal-brand small { font-size: 9px; color: var(--pro-blue-soft); }
.portal-sidebar nav a { min-height: 47px; border-radius: 11px; font-size: 12px; color: var(--pro-muted); }
.portal-sidebar nav a:hover,
.portal-sidebar nav a.active { color: var(--pro-text); background: rgba(71, 200, 255, .11); }
.trade-link { font-size: 12px; }
.portal-top { height: 78px; border-color: var(--pro-line); }
.portal-top > div > small,
.portal-user small { font-size: 10px; color: var(--pro-muted); }
.portal-top > div > b,
.portal-user b { font-size: 12px; }
.portal-main { padding-left: clamp(18px, 3vw, 44px); padding-right: clamp(18px, 3vw, 44px); }
.portal-content { max-width: 1320px; padding-top: 38px; }
.content-heading > span,
.welcome-row > div > span { font-size: 10px; color: var(--pro-blue-soft); letter-spacing: .13em; }
.content-heading h2,
.welcome-row h1 { font-size: clamp(29px, 3vw, 42px); line-height: 1.15; }
.content-heading p,
.welcome-row p { font-size: 14px; color: var(--pro-muted); }
.terminal-cta { min-height: 46px; font-size: 12px; }

.summary-cards { gap: 14px; }
.summary-cards article,
.overview-card,
.quick-card,
.cash-card,
.movement-card,
.history-card,
.portal-form,
.settings-card,
.account-detail-card {
  border-color: var(--pro-line);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(12, 39, 59, .96), rgba(7, 27, 42, .96));
  box-shadow: 0 14px 40px rgba(0, 8, 18, .16);
}
.summary-cards article { min-height: 126px; padding: 20px; }
.summary-cards small,
.status-grid small,
.overview-card header small,
.quick-card header small,
.available-balance small { font-size: 9px; line-height: 1.35; color: var(--pro-muted); }
.summary-cards b { font-size: 23px; line-height: 1.2; }
.summary-cards span { font-size: 10px; color: var(--pro-subtle); }
.overview-card h3,
.quick-card h3,
.movement-card h3,
.history-card h3 { font-size: 18px; }
.overview-card header a { font-size: 11px; }
.portal-empty b { font-size: 13px; }
.portal-empty p,
.list-empty { font-size: 11px; color: var(--pro-muted); }
.quick-card a { min-height: 70px; }
.quick-card a b { font-size: 12px; }
.quick-card a small { font-size: 10px; line-height: 1.35; color: var(--pro-muted); }
.portal-form label,
.cash-card > label { font-size: 11px; color: #bdd0dc; }
.portal-form input,
.select-setting select { min-height: 46px; font-size: 13px; border-color: var(--pro-line); background: rgba(3, 16, 26, .7); }
.status-grid article { min-height: 205px; border-color: var(--pro-line); border-radius: 16px; background: rgba(10, 34, 52, .94); }
.status-grid h3 { font-size: 16px; }
.status-grid p { font-size: 11px; line-height: 1.62; color: var(--pro-muted); }
.account-detail-card span,
.account-detail-card b { font-size: 11px; }
.movement-list > div { min-height: 64px; }
.movement-list b,
.movement-list strong { font-size: 11px; }
.movement-list small { font-size: 9px; color: var(--pro-muted); }
.select-setting b,
.toggle-setting b { font-size: 12px; }
.select-setting small,
.toggle-setting small { font-size: 10px; color: var(--pro-muted); }
.overview-head { font-size: 9px; }
.overview-row { min-height: 55px; font-size: 11px; }
.overview-row small { font-size: 9px; }
.portal-footer { font-size: 10px; }
.portal-toast { font-size: 11px; }
.portal-mobile-sections,
.portal-mobile-nav { display: none; }

/* Agent and administration */
body[data-staff-role] {
  --staff-bg: var(--pro-bg-deep);
  --staff-panel: var(--pro-panel);
  --staff-panel-2: var(--pro-panel-raised);
  --staff-line: #20475f;
  --staff-text: var(--pro-text);
  --staff-muted: var(--pro-muted);
  --staff-blue: var(--pro-blue);
  --staff-cyan: var(--pro-blue-soft);
  --staff-green: var(--pro-green);
  --staff-red: var(--pro-red);
  font-size: 15px;
}
.staff-shell { grid-template-columns: 260px minmax(0, 1fr); }
.staff-sidebar { padding: 22px 16px; }
.staff-brand b { font-size: 16px; }
.staff-brand small { font-size: 10px; }
.staff-sidebar nav a { min-height: 48px; font-size: 13px; }
.staff-profile b { font-size: 12px; }
.staff-profile small { font-size: 10px; }
.staff-sidebar form button { font-size: 11px; }
.staff-top { height: 78px; }
.staff-top small { font-size: 10px; }
.staff-top b { font-size: 16px; }
.staff-live { font-size: 11px; }
.staff-content { padding: 34px; }
.staff-heading span,
.staff-card header small,
.staff-form header small { font-size: 10px; }
.staff-heading h1 { font-size: clamp(30px, 3vw, 44px); }
.staff-heading p { font-size: 14px; }
.staff-kpis article { min-height: 128px; padding: 20px; }
.staff-kpis small { font-size: 9px; }
.staff-kpis b { font-size: 26px; }
.staff-kpis span { font-size: 10px; }
.staff-card,
.staff-form,
.note-item { border-color: var(--pro-line); box-shadow: 0 14px 40px rgba(0, 8, 18, .17); }
.staff-card h2,
.staff-form h3 { font-size: 18px; }
.staff-card header a { font-size: 11px; }
.staff-table-head { font-size: 9px; }
.staff-row { min-height: 62px; font-size: 11px; }
.client-main b { font-size: 12px; }
.staff-row small,
.activity-list small,
.fund-row small,
.note-item small,
.note-item time,
.audit-row time,
.audit-row small,
.audit-row code { font-size: 10px; line-height: 1.4; }
.status { font-size: 9px; }
.primary,
.danger,
.ghost { min-height: 43px; font-size: 11px; }
.small { min-height: 34px; font-size: 10px; }
.row-editor label,
.staff-form label,
.note-card label { font-size: 11px; }
.row-editor select,
.staff-form input,
.staff-form select,
.staff-form textarea,
.note-card textarea { min-height: 45px; font-size: 13px; }
.activity-list strong { font-size: 11px; }
.note-item p,
.provider-card p { font-size: 12px; line-height: 1.62; }
.provider-card small { font-size: 10px; }
.staff-empty { font-size: 12px; }
.staff-toast { font-size: 11px; }

/* Public landing page */
.landing-body { color: var(--pro-text); }
.aureo-brand b { font-size: 16px; }
.aureo-brand small { font-size: 9px; }
.landing-nav nav a { font-size: 13px; }
.nav-login,
.nav-primary { font-size: 12px; }
.eyebrow,
.section-heading > span,
.discipline-section > div > span,
.crm-copy > span,
.final-cta > span { font-size: 11px; }
.hero-copy > p { font-size: 17px; color: #a2bccb; }
.hero-primary,
.hero-secondary { font-size: 13px; }
.hero-trust b { font-size: 20px; }
.hero-trust small { font-size: 11px; color: #8eabba; }
.market-strip p { font-size: 11px; }
.market-strip span { font-size: 14px; }
.section-heading p { font-size: 15px; line-height: 1.65; }
.feature-grid h3 { font-size: 19px; }
.feature-grid p { font-size: 14px; color: #91adbd; }
.discipline-section p,
.crm-copy > p { font-size: 14px; color: #98b3c3; }
.discipline-section > a,
.crm-copy > a { font-size: 12px; }
.crm-copy li { font-size: 12px; }
.final-cta p { font-size: 14px; }
.final-cta > a { font-size: 13px; }
.landing-footer > p,
.landing-footer > div a { font-size: 11px; }
.landing-footer > small { font-size: 10px; }

/* Compact layouts remain readable without making the chart excessively tall. */
@media (max-width: 1280px) {
  .terminal-grid { grid-template-columns: 230px minmax(580px, 1fr); }
  .top-metrics article { min-width: 104px; }
  .market-row { min-height: 58px; height: 58px; }
}

@media (max-width: 980px) {
  .terminal-shell { padding: 8px; }
  .terminal-topbar { min-height: 66px; height: auto; }
  .terminal-brand b { font-size: 15px; }
  .terminal-brand small { font-size: 8px; }
  .instrument-bar { min-height: 68px; }
  .instrument-main h1 { font-size: 17px; }
  .instrument-quote b { font-size: 16px; }
  .chart-toolbar { min-height: 40px; height: 40px; }
  .timeframes button,
  .tool-button,
  .indicator-button,
  .camera-button { height: 29px; font-size: 10px; }
  .portal-shell { grid-template-columns: 82px minmax(0, 1fr); }
  .portal-sidebar { padding-left: 10px; padding-right: 10px; }
  .staff-shell { grid-template-columns: 235px minmax(0, 1fr); }
}

@media (max-width: 760px) {
  .terminal-grid { grid-template-columns: minmax(0, 1fr); }
  .trade-workspace { width: 100%; min-width: 0; }

  .terminal-shell {
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
  }
  .terminal-topbar {
    position: sticky;
    top: 0;
    z-index: 70;
    backdrop-filter: blur(20px);
  }
  .trade-workspace,
  .terminal-shell.positions-collapsed .trade-workspace {
    grid-template-rows: auto minmax(330px, 54vh) minmax(310px, auto);
  }
  .positions-panel { min-height: 310px; overflow: visible; }
  .positions-panel,
  .positions-head,
  .table-view,
  .position-table,
  .position-row,
  .orders-table-inner,
  .order-history-row,
  .closed-trades,
  .closed-trade-row { min-width: 0 !important; width: 100%; max-width: 100%; }
  .positions-head {
    position: sticky;
    top: 69px;
    z-index: 12;
    padding: 7px 9px;
    background: rgba(8, 29, 45, .97);
    backdrop-filter: blur(16px);
  }
  #positionsToggle { display: none; }
  .table-tabs { width: 100%; gap: 5px; }
  .table-tabs button {
    flex: 1;
    min-width: 0;
    padding: 0 6px;
    font-size: 8px;
    white-space: nowrap;
  }
  .table-view,
  .table-view.active {
    height: auto;
    min-height: 245px;
    max-height: none;
    padding: 8px 9px 12px;
    overflow: visible;
  }
  .position-head,
  .order-history-head,
  .closed-trade-head { display: none; }
  .position-table,
  .orders-table-inner,
  .closed-trades { display: grid; gap: 9px; }
  .position-row {
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 13px 16px;
    padding: 15px;
    border: 1px solid var(--pro-line);
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(15, 48, 70, .96), rgba(7, 28, 43, .98));
    box-shadow: 0 12px 30px rgba(0, 8, 18, .18);
  }
  .position-row > span { min-width: 0; }
  .position-row > span:nth-child(1),
  .position-row > span:nth-child(2),
  .position-row > span:nth-child(3),
  .position-row > span:nth-child(4),
  .position-row > span:nth-child(5),
  .position-row > span:nth-child(6),
  .position-row > span:nth-child(7) { display: flex !important; }
  .position-row > span:nth-child(1) { flex-direction: column; gap: 3px; }
  .position-row > span:nth-child(2) { align-items: flex-start; justify-content: flex-end; }
  .position-row > span:nth-child(3),
  .position-row > span:nth-child(4),
  .position-row > span:nth-child(5),
  .position-row > span:nth-child(6) { flex-direction: column; gap: 3px; }
  .position-row > span:nth-child(4),
  .position-row > span:nth-child(6) { text-align: right; align-items: flex-end; }
  .position-row > span:nth-child(3)::before { content: "UNIDADES"; }
  .position-row > span:nth-child(4)::before { content: "ENTRADA / PROTECCIÓN"; }
  .position-row > span:nth-child(5)::before { content: "PRECIO ACTUAL"; }
  .position-row > span:nth-child(6)::before { content: "P/L"; }
  .position-row > span:nth-child(3)::before,
  .position-row > span:nth-child(4)::before,
  .position-row > span:nth-child(5)::before,
  .position-row > span:nth-child(6)::before {
    color: var(--pro-muted);
    font-size: 8px;
    font-weight: 900;
    letter-spacing: .07em;
  }
  .position-row > span:nth-child(7) {
    grid-column: 1 / -1;
    align-items: center;
    justify-content: space-between;
    padding-top: 11px;
    border-top: 1px solid rgba(116, 205, 244, .15);
  }
  .position-status > div { margin-left: auto; }
  .position-risk,
  .position-close { min-height: 35px; padding: 0 13px; font-size: 10px; }

  .order-history-row {
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px 14px;
    padding: 14px;
    border: 1px solid var(--pro-line);
    border-radius: 13px;
    background: rgba(11, 38, 57, .96);
    font-size: 11px;
  }
  .order-history-row > span:nth-child(1) { grid-column: 1; grid-row: 2; color: var(--pro-muted); }
  .order-history-row > b { grid-column: 1; grid-row: 1; font-size: 13px; }
  .order-history-row > span:nth-child(3) { grid-column: 1; grid-row: 3; }
  .order-history-row > span:nth-child(4) { grid-column: 2; grid-row: 1; }
  .order-history-row > span:nth-child(5) { grid-column: 2; grid-row: 2 / span 2; text-align: right; font-weight: 850; }

  .closed-trade-row {
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px 15px;
    padding: 15px;
    border: 1px solid var(--pro-line);
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(15, 48, 70, .97), rgba(7, 28, 43, .98));
    box-shadow: 0 12px 30px rgba(0, 8, 18, .18);
  }
  .closed-trade-row.positive { border-color: rgba(69, 221, 176, .35); }
  .closed-trade-row.negative { border-color: rgba(120,174,255, .35); }
  .closed-main b { font-size: 14px; }
  .closed-main small { font-size: 10px; }
  .closed-trade-row > span:nth-child(2) { justify-self: end; }
  .closed-prices {
    grid-column: 1 / -1;
    grid-template-columns: auto 1fr auto 1fr;
    padding: 11px 0;
    border-top: 1px solid rgba(116, 205, 244, .14);
    border-bottom: 1px solid rgba(116, 205, 244, .14);
  }
  .closed-prices b { text-align: right; }
  .closed-date { justify-content: center; }
  .closed-result b { font-size: 18px; }
  .closed-result small { font-size: 9px; }
  .history-empty { min-height: 230px; padding: 24px; }

  .mobile-app-nav {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 110;
    min-height: 64px;
    padding: 6px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    border: 1px solid rgba(116, 205, 244, .28);
    border-radius: 18px;
    background: rgba(5, 22, 35, .94);
    box-shadow: 0 18px 50px rgba(0, 5, 12, .5), inset 0 1px rgba(255, 255, 255, .04);
    backdrop-filter: blur(22px);
  }
  .mobile-app-nav button,
  .mobile-app-nav a {
    position: relative;
    min-width: 0;
    min-height: 51px;
    padding: 5px 3px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--pro-muted);
    text-decoration: none;
    cursor: pointer;
  }
  .mobile-app-nav i { font-size: 17px; line-height: 1; font-style: normal; }
  .mobile-app-nav span { font-size: 9px; font-weight: 800; }
  .mobile-app-nav button.active { color: var(--pro-text); background: rgba(71, 200, 255, .14); }
  .mobile-app-nav button.active i { color: var(--pro-blue); }
  .mobile-app-nav b {
    position: absolute;
    top: 3px;
    right: calc(50% - 20px);
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: var(--pro-red);
    color: white;
    font-size: 8px;
  }
  .mobile-app-nav b[hidden] { display: none; }

  .terminal-shell.mobile-markets-open::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 88;
    background: rgba(1, 9, 15, .68);
    backdrop-filter: blur(4px);
  }
  .terminal-shell.mobile-markets-open .market-sidebar {
    position: fixed;
    inset: 74px 10px calc(82px + env(safe-area-inset-bottom));
    z-index: 95;
    display: flex !important;
    border-radius: 18px;
    box-shadow: 0 28px 80px rgba(0, 5, 12, .66);
  }
  .terminal-shell.mobile-markets-open .market-table { flex: 1; }
  .terminal-shell.mobile-markets-open .market-row { min-height: 62px; }
}

@media (max-width: 680px) {
  html { font-size: 15px; }
  .portal-shell { grid-template-columns: minmax(0, 1fr); }
  .portal-main { width: 100%; min-width: 0; padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
  .portal-top {
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(5, 22, 35, .94);
    backdrop-filter: blur(20px);
  }
  .portal-mobile-sections {
    position: sticky;
    top: 72px;
    z-index: 29;
    padding: 8px 14px;
    display: flex;
    gap: 7px;
    overflow-x: auto;
    border-bottom: 1px solid var(--pro-line);
    background: rgba(5, 22, 35, .94);
    scrollbar-width: none;
  }
  .portal-mobile-sections::-webkit-scrollbar { display: none; }
  .portal-mobile-sections a {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 0 11px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--pro-line);
    border-radius: 999px;
    color: var(--pro-muted);
    text-decoration: none;
    font-size: 10px;
    font-weight: 800;
  }
  .portal-mobile-sections a.active { color: #03131d; border-color: transparent; background: var(--pro-blue); }
  .portal-mobile-sections i { font-style: normal; }
  .portal-mobile-nav {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 80;
    min-height: 64px;
    padding: 6px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 3px;
    border: 1px solid rgba(116, 205, 244, .28);
    border-radius: 18px;
    background: rgba(5, 22, 35, .95);
    box-shadow: 0 18px 50px rgba(0, 5, 12, .5);
    backdrop-filter: blur(22px);
  }
  .portal-mobile-nav a {
    min-width: 0;
    min-height: 51px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border-radius: 12px;
    color: var(--pro-muted);
    text-decoration: none;
  }
  .portal-mobile-nav a.active { color: var(--pro-text); background: rgba(71, 200, 255, .14); }
  .portal-mobile-nav i { color: var(--pro-blue); font-size: 16px; line-height: 1; font-style: normal; }
  .portal-mobile-nav span { font-size: 8px; font-weight: 800; }
  .terminal-shell { padding: 7px; gap: 8px; }
  .terminal-topbar { min-height: 62px; border-radius: 14px; padding: 0 13px; }
  .terminal-brand { gap: 8px; }
  .terminal-brand b { font-size: 14px; }
  .top-avatar { width: 36px; height: 36px; font-size: 11px; }
  .trade-workspace { gap: 8px; }
  .instrument-bar { min-height: 68px; padding: 9px 12px; border-radius: 14px; }
  .asset-logo.large { width: 38px; height: 38px; }
  .instrument-main h1 { font-size: 16px; }
  .instrument-main small { font-size: 9px; }
  .instrument-quote small { font-size: 8px; }
  .instrument-quote b { font-size: 15px; }
  .instrument-quote span { font-size: 9px; }
  .terminal-chart,
  .positions-panel { border-radius: 14px; }
  .chart-toolbar { min-height: 40px; height: 40px; padding: 0 7px; }
  .timeframes button,
  .tool-button,
  .indicator-button,
  .camera-button { min-width: 28px; height: 28px; padding: 0 7px; font-size: 9px; }
  .quick-trade { padding: 7px; }
  .quote-button { min-height: 48px; }
  .quote-button b { font-size: 13px; }
  .positions-head { min-height: 48px; }
  .table-tabs button { padding: 0 10px; font-size: 9px; }
  .position-row,
  .order-row { font-size: 10px !important; }
  .login-card { padding: 29px 24px; }
  .login-card h1 { font-size: 25px; }
  .portal-main { padding-left: 15px; padding-right: 15px; }
  .portal-content { padding-top: 26px; }
  .content-heading h2,
  .welcome-row h1 { font-size: 28px; }
  .summary-cards article { min-height: 112px; }
  .staff-content { padding: 22px 15px; }
  .staff-heading h1 { font-size: 30px; }
  .staff-heading p { font-size: 13px; }
  .landing-nav { height: 70px; }
  .aureo-brand b { font-size: 14px; }
  .aureo-brand small { font-size: 8px; }
  .hero-copy > p { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* Theme controls and trading semantics */
.theme-switch {
  min-height: 38px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid rgba(71, 200, 255, .42);
  border-radius: 999px;
  background: rgba(71, 200, 255, .1);
  color: var(--pro-blue-soft);
  font-size: 11px;
  font-weight: 850;
  cursor: pointer;
}
.theme-switch:hover,
.theme-switch.active { border-color: var(--pro-blue); background: rgba(71, 200, 255, .18); }
.theme-switch-floating { position: fixed; top: 18px; right: 18px; z-index: 30; }
.staff-top > .theme-switch { display: inline-flex; margin-left: auto; }
.staff-top > .theme-switch + .staff-live { margin-left: 0; }

.deposit-button,
.primary-action,
.login-submit,
.terminal-cta,
.trade-link,
.submit-order:not(.buy-action):not(.sell-action) {
  border-color: transparent !important;
  background: linear-gradient(135deg, #168eea, #0b6fc2) !important;
  color: #fff !important;
  box-shadow: 0 10px 26px rgba(14, 116, 201, .22);
}
.table-tabs button.active {
  border-color: rgba(71, 200, 255, .55) !important;
  background: rgba(71, 200, 255, .16) !important;
  color: var(--pro-text) !important;
}
.quote-button.sell,
.buy-sell button.active[data-side="sell"],
.submit-order.sell-action {
  border-color: #387ee6 !important;
  background: linear-gradient(135deg, #478aef, #1f63c9) !important;
  color: #fff !important;
  box-shadow: 0 10px 26px rgba(36,109,218, .22);
}
.quote-button.buy,
.buy-sell button.active[data-side="buy"],
.submit-order.buy-action {
  border-color: #07966c !important;
  background: linear-gradient(135deg, #14b887, #087a5a) !important;
  color: #fff !important;
  box-shadow: 0 10px 26px rgba(8, 154, 111, .22);
}
.quote-button.sell:hover,
.quote-button.buy:hover { filter: brightness(1.08); transform: translateY(-1px); }

/* Dense activity ledger: many operations remain visible at once. */
.trade-workspace { grid-template-rows: 68px minmax(225px, 1fr) 184px; }
.positions-head { min-height: 43px; height: 43px; }
.table-tabs button { min-height: 29px; }
.table-view { height: 139px; padding-bottom: 7px; overflow: auto; }
.position-head,
.position-row { grid-template-columns: 1.2fr .62fr .72fr .92fr .82fr .88fr 1.05fr; }
.position-head,
.order-history-head,
.closed-trade-head { min-height: 24px; height: 24px; }
.position-row,
.order-history-row,
.closed-trade-row { min-height: 43px; padding-top: 4px; padding-bottom: 4px; }
.position-row,
.order-history-row { font-size: 10px !important; }
.position-row small,
.order-history-row small,
.closed-trade-row small { font-size: 8px; }
.position-close,
.position-risk,
.cancel-order { min-height: 27px; padding: 0 8px; font-size: 8px; }
.closed-prices { display: flex; gap: 6px; }
.closed-result b { font-size: 12px; }

/* True white theme. Black remains the default and both choices are persisted. */
html.light-theme {
  color-scheme: light;
  --pro-bg: #f4f8fb;
  --pro-bg-deep: #edf3f7;
  --pro-panel: #ffffff;
  --pro-panel-raised: #f7fafc;
  --pro-line: rgba(24, 77, 111, .17);
  --pro-line-strong: rgba(19, 101, 156, .3);
  --pro-text: #0b1c29;
  --pro-muted: #526c7c;
  --pro-subtle: #6c8391;
  --pro-blue: #168eea;
  --pro-blue-soft: #0878c8;
  --pro-green: #07865f;
  --pro-red: #2b72dd;
  --pro-shadow: 0 22px 65px rgba(31, 69, 94, .14);
  --aureo-ink: #0b1c29;
  --aureo-muted: #5c7483;
  --aureo-navy: #f4f8fb;
  --aureo-navy-2: #edf3f7;
  --aureo-panel: #ffffff;
  --aureo-panel-soft: #f2f7fa;
  --aureo-line: rgba(24, 77, 111, .17);
  --aureo-blue: #168eea;
  --aureo-blue-strong: #0878c8;
  --aureo-blue-soft: #0878c8;
  --aureo-cyan: #0891b2;
  --aureo-green: #07865f;
  --aureo-red: #2b72dd;
}

/* Neutral night theme: black surfaces with blue reserved for actions and focus. */
html:not(.light-theme) {
  --pro-bg: #08080a;
  --pro-bg-deep: #000000;
  --pro-panel: #0b0b0e;
  --pro-panel-raised: #131318;
  --pro-line: rgba(255, 255, 255, .12);
  --pro-line-strong: rgba(71, 200, 255, .38);
  --pro-text: #f6f8fb;
  --pro-muted: #a1a9b5;
  --pro-subtle: #747e8b;
  --aureo-ink: #f6f8fb;
  --aureo-muted: #a1a9b5;
  --aureo-navy: #000000;
  --aureo-navy-2: #08080a;
  --aureo-panel: #0b0b0e;
  --aureo-panel-soft: #131318;
  --aureo-line: rgba(255, 255, 255, .12);
}
html:not(.light-theme) body,
html:not(.light-theme) .landing-body,
html:not(.light-theme) .login-body,
html:not(.light-theme) .portal-body,
html:not(.light-theme) body[data-staff-role] { background: #000 !important; }
html:not(.light-theme) .terminal-shell {
  background:
    radial-gradient(circle at 50% -18%, rgba(22, 142, 234, .08), transparent 34rem),
    #000;
}
html:not(.light-theme) .terminal-topbar,
html:not(.light-theme) .instrument-bar,
html:not(.light-theme) .panel-dark,
html:not(.light-theme) .market-sidebar,
html:not(.light-theme) .account-sidebar {
  border-color: rgba(255, 255, 255, .12) !important;
  background: rgba(10, 10, 13, .98) !important;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .38), inset 0 1px rgba(255, 255, 255, .025);
}
html:not(.light-theme) .terminal-chart { background: #030304 !important; }
html:not(.light-theme) .chart-toolbar { background: #09090b; border-color: rgba(255, 255, 255, .1); }
html:not(.light-theme) .top-metrics article,
html:not(.light-theme) .profile-card,
html:not(.light-theme) .terminal-empty,
html:not(.light-theme) .demo-warning { background: #121216; border-color: rgba(255, 255, 255, .1); }
html:not(.light-theme) .market-search,
html:not(.light-theme) .money-input,
html:not(.light-theme) .buy-sell,
html:not(.light-theme) .order-ticket select { background: #060608; border-color: rgba(255, 255, 255, .12); }
html:not(.light-theme) .market-row:hover,
html:not(.light-theme) .market-row.selected,
html:not(.light-theme) .account-nav a:hover { background: rgba(22, 142, 234, .12); }
html:not(.light-theme) .order-ticket {
  background: #0c0c0f;
  border-color: rgba(255, 255, 255, .15);
  box-shadow: 0 34px 100px rgba(0, 0, 0, .78);
}
html:not(.light-theme) .mobile-app-nav {
  background: rgba(7, 7, 9, .97);
  border-color: rgba(255, 255, 255, .13);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .62);
}
html:not(.light-theme) .positions-head { background: rgba(10, 10, 13, .98); }

html:not(.light-theme) .login-brand-panel,
html:not(.light-theme) .portal-sidebar,
html:not(.light-theme) .login-form-panel { background: #070709; border-color: rgba(255, 255, 255, .11); }
html:not(.light-theme) .login-card,
html:not(.light-theme) .summary-cards article,
html:not(.light-theme) .overview-card,
html:not(.light-theme) .quick-card,
html:not(.light-theme) .cash-card,
html:not(.light-theme) .movement-card,
html:not(.light-theme) .history-card,
html:not(.light-theme) .portal-form,
html:not(.light-theme) .settings-card,
html:not(.light-theme) .account-detail-card,
html:not(.light-theme) .status-grid article {
  background: #0d0d10;
  border-color: rgba(255, 255, 255, .11);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .35);
}
html:not(.light-theme) .summary-cards .primary-balance { background: linear-gradient(135deg, #15151a, #0c0c0f); }
html:not(.light-theme) .portal-top,
html:not(.light-theme) .portal-mobile-sections,
html:not(.light-theme) .portal-mobile-nav { background: rgba(7, 7, 9, .97); border-color: rgba(255, 255, 255, .11); }

html:not(.light-theme) body[data-staff-role] {
  --staff-bg: #000;
  --staff-panel: #0b0b0e;
  --staff-panel-2: #131318;
  --staff-line: rgba(255, 255, 255, .12);
}
html:not(.light-theme) .staff-sidebar,
html:not(.light-theme) .staff-top { background: rgba(7, 7, 9, .97); }
html:not(.light-theme) .staff-profile,
html:not(.light-theme) .staff-kpis article,
html:not(.light-theme) .staff-card,
html:not(.light-theme) .staff-form,
html:not(.light-theme) .note-item,
html:not(.light-theme) .row-editor,
html:not(.light-theme) .note-card { background: #0d0d10; border-color: rgba(255, 255, 255, .11); }

html:not(.light-theme) .landing-nav,
html:not(.light-theme) .feature-grid article,
html:not(.light-theme) .crm-section,
html:not(.light-theme) .discipline-section,
html:not(.light-theme) .final-cta,
html:not(.light-theme) .crm-visual,
html:not(.light-theme) .crm-node,
html:not(.light-theme) .floating-stat,
html:not(.light-theme) .market-strip {
  background: rgba(10, 10, 13, .96);
  border-color: rgba(255, 255, 255, .12);
  box-shadow: 0 18px 55px rgba(0, 0, 0, .38);
}

.light-theme body,
.light-theme .landing-body,
.light-theme .login-body,
.light-theme .portal-body,
.light-theme body[data-staff-role] {
  background: #f4f8fb !important;
  color: var(--pro-text);
}
.light-theme .terminal-shell {
  background: radial-gradient(circle at 10% -8%, rgba(22, 142, 234, .1), transparent 29rem), #edf3f7;
}
.light-theme .terminal-topbar,
.light-theme .instrument-bar,
.light-theme .panel-dark,
.light-theme .market-sidebar,
.light-theme .account-sidebar {
  border-color: var(--pro-line) !important;
  background: rgba(255, 255, 255, .97) !important;
  box-shadow: 0 9px 28px rgba(34, 72, 97, .08), inset 0 1px #fff;
}
.light-theme .terminal-brand,
.light-theme .market-row,
.light-theme .instrument-main h1,
.light-theme .instrument-quote b,
.light-theme .profile-card b,
.light-theme .account-nav a:hover { color: var(--pro-text); }
.light-theme .top-metrics article,
.light-theme .profile-card,
.light-theme .terminal-empty,
.light-theme .demo-warning { background: #f5f8fb; border-color: var(--pro-line); }
.light-theme .market-search,
.light-theme .money-input,
.light-theme .buy-sell,
.light-theme .order-ticket select { background: #f4f8fb; border-color: var(--pro-line); color: var(--pro-text); }
.light-theme .market-search input,
.light-theme .money-input input { color: var(--pro-text); }
.light-theme .market-tabs button,
.light-theme .table-tabs button,
.light-theme .timeframes button,
.light-theme .tool-button,
.light-theme .indicator-button,
.light-theme .camera-button,
.light-theme .order-types button,
.light-theme .round-button,
.light-theme .utility-button,
.light-theme .live-status { color: #3f5b6d; background: #f3f7fa; border-color: var(--pro-line); }
.light-theme .order-types button.active { color: #fff; background: linear-gradient(135deg, #168eea, #0b6fc2); border-color: transparent; }
.light-theme .market-row:hover,
.light-theme .market-row.selected,
.light-theme .account-nav a:hover { background: #e9f4fb; }
.light-theme .terminal-chart { background: #fff !important; }
.light-theme .chart-toolbar { border-color: #dbe6ed; background: #f8fafc; }
.light-theme .tool-separator { background: #d4e1e9; }
.light-theme .position-row,
.light-theme .order-history-row,
.light-theme .closed-trade-row { color: #183347; border-color: #dfe8ee; background: #fff; }
.light-theme .position-head,
.light-theme .order-history-head,
.light-theme .closed-trade-head { color: #647d8c !important; }
.light-theme .position-status > small { color: var(--pro-green); }
.light-theme .order-ticket {
  color: var(--pro-text);
  border-color: var(--pro-line-strong);
  background: #fff;
  box-shadow: 0 30px 90px rgba(31, 69, 94, .2);
}
.light-theme .modal-backdrop { background: rgba(28, 49, 63, .44); }
.light-theme .close-modal { color: #3f5969; background: #eef4f7; }
.light-theme .order-info b { color: var(--pro-text); }
.light-theme .mobile-app-nav { background: rgba(255, 255, 255, .96); border-color: var(--pro-line); box-shadow: 0 15px 42px rgba(31, 69, 94, .18); }

.light-theme .login-body,
.light-theme .portal-body { --bg: #f4f8fb; --surface: #fff; --surface2: #f4f8fb; --line: var(--pro-line); --text: var(--pro-text); }
.light-theme .login-brand-panel,
.light-theme .portal-sidebar,
.light-theme .login-form-panel { background: #fff; border-color: var(--pro-line); }
.light-theme .login-brand,
.light-theme .portal-brand,
.light-theme .portal-sidebar nav a:hover,
.light-theme .portal-sidebar nav a.active,
.light-theme .quick-card a { color: var(--pro-text); }
.light-theme .login-card,
.light-theme .summary-cards article,
.light-theme .overview-card,
.light-theme .quick-card,
.light-theme .cash-card,
.light-theme .movement-card,
.light-theme .history-card,
.light-theme .portal-form,
.light-theme .settings-card,
.light-theme .account-detail-card,
.light-theme .status-grid article {
  color: var(--pro-text);
  background: #fff;
  border-color: var(--pro-line);
  box-shadow: 0 12px 36px rgba(31, 69, 94, .08);
}
.light-theme .summary-cards .primary-balance { background: linear-gradient(135deg, #e9f5fd, #f8fbfd); }
.light-theme .login-card input,
.light-theme .portal-form input,
.light-theme .select-setting select,
.light-theme .cash-input { color: var(--pro-text); background: #f4f8fb; border-color: var(--pro-line); }
.light-theme .portal-top { background: rgba(244, 248, 251, .92); }
.light-theme .portal-mobile-sections,
.light-theme .portal-mobile-nav { background: rgba(255, 255, 255, .96); border-color: var(--pro-line); }

.light-theme body[data-staff-role] {
  --staff-bg: #f4f8fb;
  --staff-panel: #fff;
  --staff-panel-2: #f3f7fa;
  --staff-line: #d7e4ec;
  --staff-text: #0b1c29;
  --staff-muted: #5b7382;
  --staff-blue: #168eea;
  --staff-cyan: #0878c8;
  --staff-green: #07865f;
  --staff-red: #2b72dd;
}
.light-theme .staff-sidebar,
.light-theme .staff-top { background: rgba(255, 255, 255, .96); }
.light-theme .staff-profile,
.light-theme .staff-kpis article,
.light-theme .staff-card,
.light-theme .staff-form,
.light-theme .note-item,
.light-theme .row-editor,
.light-theme .note-card { background: #fff; border-color: var(--staff-line); box-shadow: 0 12px 36px rgba(31, 69, 94, .08); }
.light-theme .ghost { color: #0b5f98; background: #eaf4fa; border-color: #bdd9e9; }
.light-theme .row-editor select,
.light-theme .staff-form input,
.light-theme .staff-form select,
.light-theme .staff-form textarea,
.light-theme .note-card textarea { color: var(--staff-text); background: #f5f8fa; border-color: var(--staff-line); }

.light-theme .landing-nav,
.light-theme .feature-grid article,
.light-theme .crm-section,
.light-theme .discipline-section,
.light-theme .final-cta,
.light-theme .crm-visual,
.light-theme .crm-node,
.light-theme .floating-stat,
.light-theme .market-strip {
  color: var(--pro-text);
  background: rgba(255, 255, 255, .94);
  border-color: var(--aureo-line);
  box-shadow: 0 14px 42px rgba(31, 69, 94, .08);
}
.light-theme .landing-nav nav a,
.light-theme .nav-login,
.light-theme .hero-copy > p,
.light-theme .section-heading p,
.light-theme .feature-grid p,
.light-theme .discipline-section p,
.light-theme .crm-copy > p,
.light-theme .landing-footer { color: #536f80; }
.light-theme .landing-nav nav a:hover { color: var(--pro-text); }
.light-theme .hero-secondary { color: #174259; background: #fff; border-color: var(--aureo-line); }

@media (max-width: 760px) {
  body:has(.modal-backdrop.open) .mobile-app-nav { display: none; }
  .modal-backdrop { align-items: flex-start; padding: 10px; overflow: auto; }
  .order-ticket { max-height: calc(100dvh - 20px); margin: auto 0; overflow: auto; }
  .trade-workspace,
  .terminal-shell.positions-collapsed .trade-workspace { grid-template-rows: auto minmax(310px, 52vh) 224px; }
  .positions-panel { min-height: 224px; overflow: hidden; }
  .positions-head { position: static; min-height: 44px; height: 44px; padding: 6px 8px; }
  .table-view,
  .table-view.active { height: 178px; min-height: 0; max-height: 178px; padding: 0 8px 7px; overflow: auto; }
  .position-table,
  .orders-table-inner,
  .closed-trades { display: block; min-width: 800px !important; width: 800px !important; }
  .position-head,
  .order-history-head,
  .closed-trade-head { display: grid; position: sticky; top: 0; z-index: 3; background: var(--pro-panel); }
  .position-row {
    min-height: 43px;
    display: grid;
    grid-template-columns: 1.2fr .62fr .72fr .92fr .82fr .88fr 1.05fr;
    gap: 11px;
    padding: 4px 9px;
    border: 0;
    border-top: 1px solid var(--pro-line);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  .position-row > span,
  .position-row > span:nth-child(1),
  .position-row > span:nth-child(2),
  .position-row > span:nth-child(3),
  .position-row > span:nth-child(4),
  .position-row > span:nth-child(5),
  .position-row > span:nth-child(6),
  .position-row > span:nth-child(7) {
    min-width: 0;
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 2px;
    padding: 0;
    border: 0;
    text-align: left;
  }
  .position-row > span:nth-child(3)::before,
  .position-row > span:nth-child(4)::before,
  .position-row > span:nth-child(5)::before,
  .position-row > span:nth-child(6)::before { content: none; }
  .position-row > span:nth-child(7) { flex-direction: row; align-items: center; justify-content: space-between; }
  .position-row > span:nth-child(7) { grid-column: auto; }
  .position-status > div { margin-left: 0; display: flex; gap: 4px; }
  .position-status > small { display: none !important; }
  .position-risk,
  .position-close { min-height: 25px; padding: 0 7px; font-size: 8px; }
  .order-history-row,
  .closed-trade-row {
    min-height: 43px;
    display: grid;
    gap: 11px;
    padding: 4px 9px;
    border: 0;
    border-top: 1px solid var(--pro-line);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  .order-history-row { grid-template-columns: .75fr .7fr .7fr .9fr .8fr; }
  .order-history-row > span:nth-child(1),
  .order-history-row > b,
  .order-history-row > span:nth-child(3),
  .order-history-row > span:nth-child(4),
  .order-history-row > span:nth-child(5) { display: block !important; grid-column: auto; grid-row: auto; align-self: center; }
  .closed-trade-row { grid-template-columns: 1.15fr .55fr 1.05fr .9fr 1fr; }
  .closed-trade-row > span:nth-child(2) { justify-self: start; }
  .closed-prices { grid-column: auto; padding: 0; border: 0; display: flex; }
  .closed-date { justify-content: center; }
  .closed-result b { font-size: 12px; }
  .history-empty { min-height: 150px; padding: 16px; }
  .mobile-app-nav { grid-template-columns: repeat(4, 1fr); }
  .top-controls > .theme-switch {
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 0;
    display: inline-flex !important;
    border-radius: 50%;
    box-shadow: none;
  }
  .portal-top > .theme-switch,
  .staff-top > .theme-switch,
  .landing-actions > .theme-switch {
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
    padding: 0;
    border-radius: 50%;
  }
  .portal-top > .theme-switch [data-theme-label],
  .staff-top > .theme-switch [data-theme-label],
  .landing-actions > .theme-switch [data-theme-label] { display: none; }
  .light-theme .position-head,
  .light-theme .order-history-head,
  .light-theme .closed-trade-head { background: #fff; }
  .light-theme .positions-head { background: rgba(255, 255, 255, .97); }
  .light-theme .portal-top,
  .light-theme .portal-mobile-sections { background: rgba(244, 248, 251, .96); }
  .landing-actions .theme-switch-label { display: none; }
  .landing-actions .theme-switch { width: 38px; padding: 0; }
  .staff-top > .theme-switch { width: 36px; min-width: 36px; }
}

/* Role entry points */
.role-access-links {
  margin-top: 15px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.role-access-links a {
  min-height: 35px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--pro-line);
  border-radius: 9px;
  color: var(--pro-muted);
  text-decoration: none;
  font-size: 10px;
  font-weight: 850;
}
.role-access-links a:hover,
.role-access-links a.active { border-color: var(--pro-blue); background: rgba(22, 142, 234, .14); color: var(--pro-text); }

.access-section {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 90px 0;
}
.access-grid {
  margin-top: 34px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.access-grid > a {
  min-height: 126px;
  padding: 22px;
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--aureo-line);
  border-radius: 18px;
  background: var(--aureo-panel);
  color: var(--aureo-ink);
  text-decoration: none;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .14);
}
.access-grid > a:hover { transform: translateY(-3px); border-color: var(--aureo-blue); }
.access-grid > a > i { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: rgba(22, 142, 234, .13); color: var(--aureo-blue); font-style: normal; font-size: 18px; }
.access-grid span { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.access-grid small { color: var(--aureo-blue-soft); font-size: 9px; font-weight: 900; letter-spacing: .11em; }
.access-grid b { font-size: 15px; }
.access-grid em { color: var(--aureo-muted); font-size: 10px; font-style: normal; }
.access-grid strong { color: var(--aureo-blue); font-size: 18px; }

/* Client performance, exposure and alert center */
.action-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 22px; }
.action-heading > div { min-width: 0; }
.primary-action.button { min-height: 43px; padding: 0 17px; display: inline-flex; align-items: center; justify-content: center; border-radius: 9px; text-decoration: none; white-space: nowrap; font-size: 11px; font-weight: 900; }
.performance-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.performance-grid article {
  min-height: 118px;
  padding: 19px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid var(--pro-line);
  border-radius: 15px;
  background: var(--pro-panel);
  box-shadow: 0 13px 38px rgba(0, 0, 0, .14);
}
.performance-grid small { color: var(--pro-muted); font-size: 9px; font-weight: 900; letter-spacing: .1em; }
.performance-grid b { margin: 8px 0 4px; color: var(--pro-text); font-size: 23px; line-height: 1.15; }
.performance-grid span { color: var(--pro-subtle); font-size: 10px; }
.compact-metrics { grid-template-columns: repeat(3, 1fr); }
.performance-layout { margin-top: 13px; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(290px, .6fr); gap: 13px; }
.exposure-list { display: grid; }
.exposure-row { min-height: 56px; display: grid; grid-template-columns: minmax(110px, .7fr) minmax(130px, 1.3fr) 48px; align-items: center; gap: 13px; border-top: 1px solid var(--pro-line); }
.exposure-row span { display: flex; flex-direction: column; }
.exposure-row b { font-size: 11px; }
.exposure-row small { color: var(--pro-muted); font-size: 9px; }
.exposure-row progress { width: 100%; height: 7px; overflow: hidden; border: 0; border-radius: 99px; background: rgba(127, 145, 156, .18); }
.exposure-row progress::-webkit-progress-bar { background: rgba(127, 145, 156, .18); border-radius: 99px; }
.exposure-row progress::-webkit-progress-value { background: linear-gradient(90deg, #0b6fc2, #47c8ff); border-radius: 99px; }
.exposure-row strong { text-align: right; font-size: 10px; }
.result-range > div { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.result-range > div > span { min-height: 78px; padding: 13px; display: flex; flex-direction: column; justify-content: center; border: 1px solid var(--pro-line); border-radius: 11px; }
.result-range small { color: var(--pro-muted); font-size: 8px; font-weight: 900; letter-spacing: .08em; }
.result-range b { margin-top: 6px; font-size: 14px; }
.risk-disclaimer { margin: 14px 2px 0; color: var(--pro-muted); font-size: 10px; }

.alert-card { margin-top: 13px; overflow-x: auto; }
.alert-head,
.alert-row { min-width: 670px; display: grid; grid-template-columns: 1.2fr .8fr .7fr .55fr; align-items: center; gap: 15px; }
.alert-head { min-height: 31px; color: var(--pro-muted); font-size: 9px; font-weight: 900; letter-spacing: .08em; }
.alert-row { min-height: 57px; border-top: 1px solid var(--pro-line); font-size: 11px; }
.alert-row > span:first-child { display: flex; flex-direction: column; }
.alert-row small { color: var(--pro-muted); font-size: 9px; }
.status-pill.active { color: var(--pro-green); background: rgba(7, 134, 95, .13); }
.status-pill.triggered { color: var(--pro-blue-soft); background: rgba(22, 142, 234, .13); }
.status-pill.cancelled { color: var(--pro-muted); }
.ghost-alert { min-height: 31px; border: 1px solid var(--pro-line); border-radius: 8px; background: transparent; color: var(--pro-muted); font-size: 9px; font-weight: 850; cursor: pointer; }
.ghost-alert:hover { color: var(--pro-red); border-color: var(--pro-red); }

.access-matrix { margin-top: 18px; }
.access-matrix-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; }
.access-matrix-grid > a {
  min-height: 108px;
  padding: 16px;
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--pro-line);
  border-radius: 13px;
  color: var(--pro-text);
  text-decoration: none;
}
.access-matrix-grid > a:hover { border-color: var(--pro-blue); background: rgba(22, 142, 234, .08); }
.access-matrix-grid > a > i { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: rgba(22, 142, 234, .13); color: var(--pro-blue-soft); font-style: normal; }
.access-matrix-grid span { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.access-matrix-grid small { color: var(--pro-blue-soft); font-size: 8px; font-weight: 900; letter-spacing: .1em; }
.access-matrix-grid b { font-size: 12px; }
.access-matrix-grid em { color: var(--pro-muted); font-size: 10px; line-height: 1.45; font-style: normal; }
.access-matrix > p { margin: 15px 1px 0; color: var(--pro-muted); font-size: 10px; }

.light-theme .access-grid > a,
.light-theme .performance-grid article { background: #fff; box-shadow: 0 12px 36px rgba(31, 69, 94, .08); }
html:not(.light-theme) .access-grid > a,
html:not(.light-theme) .performance-grid article { background: #0d0d10; border-color: rgba(255, 255, 255, .11); }

@media (max-width: 900px) {
  .access-grid { grid-template-columns: 1fr; }
  .access-matrix-grid { grid-template-columns: 1fr; }
  .performance-grid { grid-template-columns: 1fr 1fr; }
  .performance-layout { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .access-section { width: min(100% - 28px, 1180px); padding: 64px 0; }
  .action-heading { align-items: flex-start; flex-direction: column; }
  .action-heading .primary-action { width: 100%; }
  .performance-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .performance-grid article { min-height: 101px; padding: 14px; }
  .performance-grid b { font-size: 18px; }
  .performance-grid span { font-size: 9px; }
  .compact-metrics article:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .result-range > div { grid-template-columns: 1fr 1fr; }
}

/* Professional chart analysis toolbar */
.chart-toolbar {
  position: relative;
  z-index: 12;
  min-height: 54px;
  height: 54px;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: visible;
  border-bottom: 1px solid var(--pro-line);
  background: rgba(8, 10, 13, .98);
}
.terminal-chart { overflow: visible; z-index: 3; }
.chart-stage { inset: 54px 0 0; }
.tool-picker { position: relative; flex: 0 0 auto; }
.chart-tool,
.chart-action {
  min-width: 0;
  height: 40px;
  border: 1px solid var(--pro-line);
  border-radius: 9px;
  background: rgba(255, 255, 255, .025);
  color: var(--pro-muted);
  cursor: pointer;
}
.chart-tool {
  width: 112px;
  padding: 0 9px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 10px;
  align-items: center;
  gap: 6px;
  text-align: left;
}
.chart-tool > i { color: var(--pro-blue-soft); font-size: 15px; line-height: 1; font-style: normal; text-align: center; }
.chart-tool > span { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chart-tool small { color: var(--pro-subtle); font-size: 7px; font-weight: 900; line-height: 1; letter-spacing: .08em; }
.chart-tool b { overflow: hidden; color: var(--pro-text); font-size: 10px; line-height: 1.1; text-overflow: ellipsis; white-space: nowrap; }
.chart-tool em { color: var(--pro-subtle); font-size: 8px; font-style: normal; }
.chart-tool:hover,
.chart-action:hover { border-color: rgba(71, 200, 255, .52); background: rgba(71, 200, 255, .08); color: var(--pro-text); }
.chart-tool.active { border-color: rgba(71, 200, 255, .42); background: rgba(22, 142, 234, .11); }
.toolbar-divider { width: 1px; height: 28px; margin: 0 2px; flex: 0 0 auto; background: var(--pro-line); }
.toolbar-actions { min-width: 0; margin-left: auto; display: flex; align-items: center; gap: 4px; }
.chart-action {
  width: 48px;
  padding: 3px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.chart-action i { color: var(--pro-blue-soft); font-size: 13px; line-height: 1; font-style: normal; }
.chart-action small { color: inherit; font-size: 7px; font-weight: 800; line-height: 1; }
.chart-action.active { border-color: var(--pro-blue); background: rgba(22, 142, 234, .18); color: var(--pro-text); }
.more-picker { display: none; margin-left: auto; }
.chart-tool.more { width: 54px; grid-template-columns: 1fr; justify-items: center; padding: 0 4px; text-align: center; }
.chart-tool.more > i { font-size: 12px; letter-spacing: .08em; }
.chart-tool.more > span { align-items: center; }

.toolbar-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 40;
  width: 312px;
  max-height: min(470px, calc(100vh - 190px));
  padding: 8px;
  overflow-y: auto;
  border: 1px solid rgba(71, 200, 255, .28);
  border-radius: 13px;
  background: rgba(8, 12, 16, .98);
  box-shadow: 0 22px 58px rgba(0, 0, 0, .58);
  backdrop-filter: blur(20px);
}
.toolbar-menu[hidden] { display: none !important; }
.toolbar-menu header { padding: 8px 9px 10px; border-bottom: 1px solid var(--pro-line); }
.toolbar-menu header span { display: flex; flex-direction: column; gap: 3px; }
.toolbar-menu header b { color: var(--pro-text); font-size: 12px; }
.toolbar-menu header small { color: var(--pro-muted); font-size: 9px; }
.timeframe-grid { padding-top: 7px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.timeframe-grid button {
  min-height: 48px;
  padding: 7px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--pro-text);
  cursor: pointer;
}
.timeframe-grid button b { font-size: 11px; }
.timeframe-grid button small { color: var(--pro-muted); font-size: 8px; }
.timeframe-grid button:hover,
.timeframe-grid button.active { border-color: rgba(71, 200, 255, .42); background: rgba(22, 142, 234, .14); }
.option-menu { display: grid; gap: 3px; }
.option-menu > button {
  min-height: 48px;
  padding: 7px 9px;
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--pro-text);
  text-align: left;
  cursor: pointer;
}
.option-menu > button > i { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; background: rgba(71, 200, 255, .09); color: var(--pro-blue-soft); font-size: 14px; font-style: normal; }
.option-menu > button > span { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.option-menu > button b { font-size: 10px; }
.option-menu > button small { color: var(--pro-muted); font-size: 8px; line-height: 1.3; }
.option-menu > button:hover,
.option-menu > button.active { border-color: rgba(71, 200, 255, .34); background: rgba(22, 142, 234, .11); }
.option-menu > button.danger-tool:hover { border-color: rgba(74,146,255, .4); background: rgba(74,146,255, .08); }
.option-menu > button.danger-tool > i { color: var(--pro-red); background: rgba(74,146,255, .1); }
.more-tools-menu { right: 0; left: auto; }
.chart-stage canvas.drawing { cursor: crosshair; }
.terminal-chart:fullscreen,
.terminal-chart.fullscreen-active { width: 100vw; height: 100vh; border: 0; border-radius: 0; background: #050506; }

.light-theme .chart-toolbar { background: rgba(248, 251, 253, .98); }
.light-theme .chart-tool,
.light-theme .chart-action { background: #fff; }
.light-theme .toolbar-menu { background: rgba(255, 255, 255, .98); box-shadow: 0 22px 58px rgba(31, 69, 94, .2); }

@media (max-width: 1180px) {
  .chart-tool { width: 102px; }
  .chart-action { width: 42px; }
  .chart-action small { display: none; }
}

@media (max-width: 760px) {
  .chart-toolbar { min-height: 58px; height: 58px; padding: 7px 6px; gap: 3px; }
  .chart-stage { inset: 58px 0 0; }
  .tool-picker:has(.chart-tool.primary) { flex: 1 1 0; min-width: 0; }
  .chart-tool.primary { width: 100%; height: 43px; padding: 0 5px; grid-template-columns: 15px minmax(0, 1fr) 7px; gap: 3px; }
  .chart-tool > i { font-size: 12px; }
  .chart-tool small { font-size: 6px; }
  .chart-tool b { font-size: 8px; }
  .toolbar-divider,
  .toolbar-actions { display: none; }
  .more-picker { display: block; flex: 0 0 46px; }
  .chart-tool.more { width: 46px; height: 43px; }
  .toolbar-menu { width: min(330px, calc(100vw - 28px)); top: calc(100% + 7px); }
  .chart-toolbar > .tool-picker:nth-child(2) .toolbar-menu { left: -72px; }
  .chart-toolbar > .tool-picker:nth-child(3) .toolbar-menu { left: -150px; }
  .chart-toolbar > .tool-picker:nth-child(4) .toolbar-menu { right: -46px; left: auto; }
  .more-tools-menu { right: 0; left: auto; }
}

@media (max-width: 420px) {
  .chart-tool.primary { grid-template-columns: 1fr 7px; justify-items: start; }
  .chart-tool.primary > i { display: none; }
  .chart-tool small { font-size: 5.5px; }
  .chart-tool b { max-width: 58px; }
  .chart-toolbar > .tool-picker:nth-child(3) .toolbar-menu { left: -135px; }
}
