/* Shared night surfaces. Canvas charts resolve these same palette tokens. */
body:not(.light-mode) {
  --rgb-main-background-color: 10, 17, 34;
  --rgb-body-background-color: 8, 15, 31;
  --rgb-header-background-color: 15, 27, 49;
  --rgb-subheader-background-color: 21, 36, 63;
  --rgb-dropdown-background-color: 19, 33, 58;
  --rgb-input-background-color: 14, 26, 47;
  --rgb-divider-color: 58, 82, 118;
  --content-panel: #12223c;
  --content-field: #0e1a2f;
  --content-border: #344d72;
  --content-secondary: #bfcee5;
  --content-link: #79dff5;
  --content-accent: #bea6ff;
  --chart-secondary-background: #0e1a2f;
  --chart-pane-divider: #344d72;
  --base-bright: #12223c;
  --main-background-color: #0a1122;
  --body-background-color: #080f1f;
  --header-background-color: #0f1b31;
  --subheader-background-color: #15243f;
  --dropdown-background-color: #13213a;
  --input-background-color: #0e1a2f;
  --divider-color: #344d72;
  --table-background-color: #0e1a2f;
  --table-header-background-color: #162b49;
  --surface-night-glow: 0 0 0 1px rgba(137,160,220,.035), 0 10px 32px rgba(1,6,19,.22);
  color-scheme: dark;
  background: radial-gradient(ellipse at 8% 0%,rgba(112,66,230,.15),transparent 42%),radial-gradient(ellipse at 95% 0%,rgba(20,170,207,.12),transparent 42%),#080f1f;
  background-attachment: fixed;
}
body:not(.light-mode) .pg-layout {background:transparent;}
body:not(.light-mode) .pg-header {
  background:linear-gradient(105deg,#111b35 0%,#142441 55%,#10283b 100%);
  border-bottom:1px solid #365174;
  box-shadow:0 1px 0 rgba(137,181,245,.07),0 6px 24px rgba(2,8,24,.24);
}
body:not(.light-mode) .pg-trading-screen {
  --terminal-panel: #11213a;
  --terminal-panel-head: #162b49;
  --terminal-border: #334f74;
  background:radial-gradient(ellipse at 6% 0%,rgba(115,72,228,.09),transparent 45%),radial-gradient(ellipse at 97% 0%,rgba(31,183,218,.08),transparent 45%),#0a1224;
}
body:not(.light-mode) .trade-terminal__panel {
  background:linear-gradient(145deg,#152943,#102038);
  border-color:#334f74;
  box-shadow:var(--surface-night-glow);
}
body:not(.light-mode) :is(.trade-terminal__orders,.trade-terminal__trades,.trade-terminal__markets) {
  background:#102039;
}
body:not(.light-mode) .trade-terminal__panel :is(.cr-table-header,.cr-tab-panel__navigation-container),
body:not(.light-mode) .market-orders__heading,
body:not(.light-mode) .market-orders thead th {
  background:linear-gradient(105deg,#1b2b4b,#162c46);
  border-bottom-color:#385476;
}
body:not(.light-mode) .market-orders {background:#102039;}
body:not(.light-mode) .market-orders__scroll {background:#0e1a2f;}
body:not(.light-mode) .market-orders__pagination {background:#12233e;}
body:not(.light-mode) .market-orders tbody tr:hover {background:rgba(116,156,239,.075);}
body:not(.light-mode) :is(.admin-chart-card,.audience-metrics>div,.admin-kpi-card,.ap-card,.monitor-card) {
  background:linear-gradient(145deg,#162a46,#12213b);
  border-color:var(--content-border);
  box-shadow:var(--surface-night-glow);
}
body:not(.light-mode) :is(.modal-content,.admin-dialog__panel,.admin-dialog-panel) {
  background:linear-gradient(145deg,#192b49,#12213b);
  border-color:#415d86;
  box-shadow:0 24px 80px rgba(0,5,22,.55),0 0 35px rgba(107,79,223,.06);
}
body:not(.light-mode) :is(input,select,textarea):focus-visible {
  outline-color:#8bcce8;
}

/* Explicit light surfaces: --base-bright is a legacy neutral, not a panel colour. */
body.light-mode .market-orders {
  --base-bright:#ffffff;
  --divider-color:#d5dfef;
  --secondary-text-color:#52647e;
  --secondary-contrast-cta-color:#315d89;
  color:#1b293f;
  background:#ffffff;
  box-shadow:0 8px 28px rgba(41,65,107,.06);
}
body.light-mode .market-orders__heading {background:linear-gradient(110deg,#ffffff,#f1f6ff);border-color:#d5dfef;}
body.light-mode .market-orders__heading strong span {color:#234b75;}
body.light-mode .market-orders__pagination {background:#f7f9fe;border-color:#d5dfef;color:#334762;}
body.light-mode .market-orders__scroll,
body.light-mode .market-orders table {background:#ffffff;}
body.light-mode .market-orders th {background:#edf3fc;color:#405776;border-color:#d5dfef;}
body.light-mode .market-orders td {border-color:#e4eaf4;}
body.light-mode .market-orders tbody tr:hover {background:#f4f7ff;}
body.light-mode .market-orders__side--buy,
body.light-mode .market-orders__state--done {color:#0b7551;background:#eaf8f1;}
body.light-mode .market-orders__side--sell,
body.light-mode .market-orders__state--reject {color:#b72543;background:#fff0f3;}
body.light-mode .market-orders__state--wait {color:#5141b1;background:#f1edff;}
body.light-mode .market-orders__state--pending {color:#875b06;background:#fff7df;}
body.light-mode .market-orders__state--cancel {color:#52647e;background:#f2f5fa;}
body.light-mode .market-orders__empty {color:#52647e;background:#ffffff;}
body.light-mode .market-orders__error {color:#b72543;background:#fff0f3;}
body.light-mode .market-orders progress {accent-color:#168268;}

/* Transfer the space released in the orders panel to the candles. */
@media (min-width:1200px) and (max-width:1749px) {
 body .pg-layout .trade-terminal {grid-template-rows:minmax(418px,1fr) 238px;}
}
@media (min-width:1750px) {
 body .pg-layout .trade-terminal {grid-template-rows:minmax(392px,1fr) 264px;}
}
@media (min-width:981px) and (max-width:1199px) {
 body .pg-layout .trade-terminal {grid-template-rows:526px 364px 300px;}
}
@media (min-width:601px) and (max-width:980px) {
 body .pg-layout .trade-terminal {grid-template-rows:466px auto 430px 284px 300px 300px;}
}
@media (max-width:600px) {
 body .pg-layout .pg-trading-screen .trade-terminal {grid-template-rows:416px auto 440px 294px 300px 330px;}
}
body .trade-terminal__orders {container-name:order-panel;container-type:inline-size;}
body .trade-terminal__chart {container-name:chart-panel;container-type:inline-size;}
body .market-orders td {padding-block:4px;}
body .market-orders td:first-child small {display:inline;margin-inline-start:7px;white-space:nowrap;}
body .market-orders td button {min-height:22px;padding:2px 6px;}

body .pg-layout .trade-terminal .fynex-chart.fynex-chart--tools {grid-template-rows:34px 32px minmax(0,1fr);}
body .pg-layout .trade-terminal .fynex-chart__toolbar {display:flex;align-items:center;flex-wrap:nowrap;gap:6px;padding:0 8px;overflow-x:auto;scrollbar-width:none;}
body .pg-layout .trade-terminal .fynex-chart__identity {align-items:center;flex:0 0 auto;width:auto;min-width:0;margin:0;gap:5px;white-space:nowrap;}
body .pg-layout .trade-terminal .fynex-chart__pair {display:flex;align-items:center;}
body .pg-layout .trade-terminal .fynex-chart__periods {display:flex;flex:0 0 auto;width:auto;order:0;gap:2px;margin-inline-start:auto;}
body .pg-layout .trade-terminal .fynex-chart__periods button {width:auto;min-width:28px;flex:0 0 auto;padding-inline:5px;height:26px;min-height:26px;}
body .pg-layout .trade-terminal .fynex-chart__live {flex:0 0 auto;margin:0;white-space:nowrap;}
body .pg-layout .trade-terminal .fynex-chart__toolbar .pg-charts__views {margin-inline-start:0;}
body .pg-layout .trade-terminal .chart-tools__scroll {height:31px;padding-block:2px;}
body .pg-layout .trade-terminal .chart-tools__scroll>button {height:26px;min-height:26px;}
body .pg-layout .trade-terminal :is(.fynex-chart__loading,.fynex-chart__empty) {inset-block-start:66px;}
body .pg-layout .trade-terminal .chart-tools__menu {top:70px;}
@container chart-panel (max-width:600px) {
 body .pg-layout .trade-terminal .fynex-chart__toolbar {gap:5px;padding-inline:5px;}
 body .pg-layout .trade-terminal .fynex-chart__pair .fx-asset-label__text {position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;}
 body .pg-layout .trade-terminal .fynex-chart__periods button {min-width:23px;padding-inline:3px;}
 body .pg-layout .trade-terminal .fynex-chart__live {overflow:visible;padding-inline:2px;}
 body .pg-layout .trade-terminal .fynex-chart__live-label {position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);}
 body .pg-layout .trade-terminal .pg-charts__views button {padding-inline:6px;}
}
@container chart-panel (min-width:1100px) {
 body .pg-layout .trade-terminal .fynex-chart.fynex-chart--tools {grid-template-columns:minmax(560px,1fr) max-content;grid-template-rows:34px minmax(0,1fr);}
 body .pg-layout .trade-terminal .fynex-chart__toolbar {grid-area:1/1;}
 body .pg-layout .trade-terminal .chart-tools {grid-area:1/2;min-width:0;border-inline-start:1px solid var(--content-border);}
 body .pg-layout .trade-terminal .fynex-chart__canvas,
 body .pg-layout .trade-terminal .fynex-chart__values {grid-area:2/1/3/-1;}
 body .pg-layout .trade-terminal :is(.fynex-chart__loading,.fynex-chart__empty) {inset-block-start:34px;}
 body .pg-layout .trade-terminal .chart-tools__menu {top:38px;}
}

/* Match the search control to its title and give the list the remaining row. */
body .pg-layout .trade-terminal .pg-trading-markets__panel {grid-template-rows:auto auto minmax(0,1fr);}
body .pg-layout .trade-terminal .pg-trading-markets__header {display:flex;align-items:center;gap:8px;padding:3px 8px;}
body .pg-layout .trade-terminal .pg-trading-markets__header .pg-trading-markets__search {min-width:0;min-height:28px;margin:0;border-radius:8px;}
body .pg-layout .trade-terminal .pg-trading-markets__header .pg-trading-markets__search:focus-within {border-color:var(--content-link);}
body .pg-layout .trade-terminal .pg-trading-markets__header .pg-trading-markets__search-icon {flex-basis:27px;width:27px;height:26px;}
body .pg-layout .trade-terminal .pg-trading-markets__header .pg-trading-markets__search input {height:26px;min-height:26px;padding-inline:5px 27px;}
body .pg-layout .trade-terminal .pg-trading-markets__table-head {grid-row:2;}
body .pg-layout .trade-terminal .pg-trading-markets__list {grid-row:3;}
@media (max-width:600px) {
 body .pg-layout .trade-terminal .pg-trading-markets__header .pg-trading-markets__search {min-height:35px;}
 body .pg-layout .trade-terminal .pg-trading-markets__header .pg-trading-markets__search input {height:33px;min-height:33px;}
}

/* Compact the gutters of the order form, including the touch layout. */
body .pg-layout :is(.trade-terminal__order,.pg-mobile-create-order) .pg-order .cr-order .cr-tab-content__active {padding:7px 9px 8px;}
body .pg-layout :is(.trade-terminal__order,.pg-mobile-create-order) .cr-order-form {--terminal-order-field:36px;padding:0;}
body .pg-layout :is(.trade-terminal__order,.pg-mobile-create-order) .cr-order .cr-tab-content .cr-order-item {margin-block:0 3px;padding-block:0;}
body .pg-layout :is(.trade-terminal__order,.pg-mobile-create-order) .cr-order .cr-tab-content .cr-order-item:last-child {margin-block-end:0;}
body .pg-layout :is(.trade-terminal__order,.pg-mobile-create-order) .cr-order .cr-tab-content .cr-order-item :is(label,legend) {margin-block:0 2px;}
body .pg-layout :is(.trade-terminal__order,.pg-mobile-create-order) .cr-order-form .cr-order-item--type :is(.cr-dropdown,.dropdown-toggle) {
 height:var(--terminal-order-field);min-height:var(--terminal-order-field);padding-block:0;
}
body .pg-layout :is(.trade-terminal__order,.pg-mobile-create-order) .cr-order .cr-order-form :is(.cr-order-input > .cr-order-input__fieldset,.cr-order-input .form-control,.cr-order-input__crypto-icon,.cr-order-input-mobile__button) {
 height:var(--terminal-order-field)!important;
}
body .pg-layout :is(.trade-terminal__order,.pg-mobile-create-order) .cr-order .cr-tab-content .cr-order-item__percentage-buttons {margin-block:0;padding-block:0;}
body .pg-layout :is(.trade-terminal__order,.pg-mobile-create-order) .cr-order .cr-order-form .cr-percentage-button {height:30px;min-height:30px;}
body .pg-layout :is(.trade-terminal__order,.pg-mobile-create-order) .cr-order .cr-tab-content :is(.cr-order-item__total,.cr-order-item__available) {margin-block:0;padding-block:0;}
body .pg-layout :is(.trade-terminal__order,.pg-mobile-create-order) .cr-order-form .cr-order-item:last-child > button {margin-block:3px 0;min-height:38px;}
@media (max-width:600px) {
 body .pg-layout :is(.trade-terminal__order,.pg-mobile-create-order) .cr-order-form {--terminal-order-field:40px;}
 body .pg-layout :is(.trade-terminal__order,.pg-mobile-create-order) .cr-order .cr-order-form .cr-percentage-button {height:36px;min-height:36px;}
 body .pg-layout :is(.trade-terminal__order,.pg-mobile-create-order) .cr-order-form .cr-order-item:last-child > button {min-height:44px;}
}
body .market-orders :is(th,td):nth-child(-n+5) {text-align:start;}
body .market-orders__id {display:block;max-width:12ch;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:10px;color:var(--secondary-text-color);background:transparent;padding:0;border:0;direction:ltr;}

/* Compact navigation shared by the desktop drawer and the mobile menu. */
body #fynex-sidebar {
 width:min(238px,84vw);
 background:linear-gradient(152deg,color-mix(in srgb,var(--content-accent) 9%,var(--content-panel)),var(--content-panel) 46%);
 border-inline-end:1px solid var(--content-border);
 box-shadow:10px 14px 38px #06122535;
}
body #fynex-sidebar .pg-sidebar-wrapper-nav {gap:2px;padding:7px 9px;}
body #fynex-sidebar .pg-sidebar-wrapper-profile {margin:0;padding:6px 9px;}
body #fynex-sidebar .pg-sidebar-wrapper-logout {margin:0;padding:2px 9px 8px;}
body #fynex-sidebar :is(.pg-sidebar-wrapper-nav-item,.pg-sidebar-wrapper-profile-link,.pg-sidebar-wrapper-logout-link) {
 gap:9px;min-height:36px;margin:0;padding:6px 9px;border-radius:8px;transform:none;
 color:var(--content-secondary);
}
body #fynex-sidebar .pg-sidebar-wrapper-nav-item-img-wrapper {width:20px;flex:0 0 20px;margin:0;}
body #fynex-sidebar :is(.pg-sidebar-wrapper-nav-item-img,.pg-sidebar-wrapper-logout-link-img) {width:18px;height:18px;margin:0;}
body #fynex-sidebar :is(.pg-sidebar-wrapper-nav-item-text,.pg-sidebar-wrapper-profile-link-text,.pg-sidebar-wrapper-logout-link-text) {font-size:12px;font-weight:650;line-height:1.25;}
body #fynex-sidebar :is(.pg-sidebar-wrapper-nav,.pg-sidebar-wrapper-profile) a {display:block;border-radius:8px;color:var(--content-secondary);}
body #fynex-sidebar :is(.pg-sidebar-wrapper-nav,.pg-sidebar-wrapper-profile) a:focus-visible {outline:2px solid var(--content-link);outline-offset:-2px;}
body #fynex-sidebar :is(.pg-sidebar-wrapper-nav,.pg-sidebar-wrapper-profile) .route-selected :is(.pg-sidebar-wrapper-nav-item,.pg-sidebar-wrapper-profile-link) {
 background:color-mix(in srgb,var(--content-accent) 15%,var(--content-panel));
 box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--content-accent) 32%,transparent);
 color:var(--primary-text-color);
}
body #fynex-sidebar .pg-sidebar-wrapper-lng {padding:8px 9px 3px;}
body #fynex-sidebar .pg-sidebar-wrapper-lng button {min-height:36px;padding-block:4px;}
body #mobile-main-menu {
 gap:3px;padding:7px;border:1px solid var(--content-border);border-radius:12px;
 background:linear-gradient(155deg,color-mix(in srgb,var(--content-accent) 8%,var(--content-panel)),var(--content-panel));
}
body #mobile-main-menu > :is(a,button) {min-height:39px;padding:7px 9px;border-radius:7px;font-size:12px;}
body #mobile-main-menu > :is([aria-current="page"],.active) {background:color-mix(in srgb,var(--content-accent) 15%,var(--content-panel));color:var(--primary-text-color);}
@media (max-width:768px) {
 body #fynex-sidebar :is(.pg-sidebar-wrapper-nav-item,.pg-sidebar-wrapper-profile-link,.pg-sidebar-wrapper-logout-link) {min-height:39px;}
}
