:root {
  --bg: #eef1f5;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --border: #d8dee8;
  --text: #1d2430;
  --muted: #6a7484;
  --accent: #0f5f9a;
  --buy: #1f8c4d;
  --sell: #c5473b;
  --shadow: 0 2px 10px rgba(17, 29, 49, 0.06);
  --radius: 10px;
  --shell-max-width: 1640px;
  --shell-padding: 14px;
}

html.dark-mode,
body.dark-mode {
  --bg: #1a1d24;
  --surface: #212834;
  --surface-soft: #273140;
  --border: #3c495d;
  --text: #e3ecf7;
  --muted: #9babc1;
  --accent: #6fb2e8;
  --buy: #39b874;
  --sell: #de6a61;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.36);
}

html.dark-mode {
  background: var(--bg);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Barlow", "Lato", sans-serif;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

a {
  color: inherit;
}

.mango-body {
  min-height: 100vh;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(145deg, #f0f3f8, #e8edf3);
}

body.dark-mode .login-shell {
  background: linear-gradient(145deg, #1a1d24, #252830);
}

.login-card {
  width: 100%;
  max-width: 430px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px;
}

.login-brand {
  margin-bottom: 22px;
}

.login-brand h1 {
  font-size: 1.65rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.login-brand p {
  color: var(--muted);
  font-size: 0.96rem;
}

.login-card .login-submit-btn.ui.button {
  background: #00b86b !important;
  border-color: #00a762 !important;
  color: #ffffff !important;
}

.login-card .login-submit-btn.ui.button:hover,
.login-card .login-submit-btn.ui.button:focus {
  background: #00ab63 !important;
  border-color: #00995a !important;
  color: #ffffff !important;
}

.login-card .login-submit-btn.ui.button:active {
  background: #009d5b !important;
  border-color: #008f53 !important;
  color: #ffffff !important;
}

.exchange-shell {
  max-width: var(--shell-max-width);
  margin: 0 auto;
  padding: var(--shell-padding);
}

.top-strip {
  --top-strip-pane-height: 46px;
  position: sticky;
  top: 10px;
  z-index: 90;
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  border-left-width: 6px;
  transition: padding 0.16s ease, gap 0.16s ease, box-shadow 0.16s ease;
}

.top-strip.top-strip-static {
  position: static !important;
  top: auto;
}

.top-strip.top-strip-floating {
  position: fixed;
  top: 10px;
  left: 0;
  right: 0;
  width: calc(100% - (2 * var(--shell-padding)));
  max-width: calc(var(--shell-max-width) - (2 * var(--shell-padding)));
  margin-left: auto;
  margin-right: auto;
  transform: none;
}

.top-strip-placeholder {
  width: 100%;
}

.top-strip-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  transition: gap 0.16s ease;
}

.top-strip.state-down {
  border-left-color: #bb3b2f;
}

.top-strip.state-wait {
  border-left-color: #be7f2d;
}

.top-strip.state-live {
  border-left-color: #1f8c4d;
}

.top-strip-left {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  height: var(--top-strip-pane-height);
  gap: 6px;
  color: #2b4560;
  padding: 0 10px 0 6px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  border-radius: 10px;
  font-weight: 700;
  letter-spacing: 0.01em;
  flex-shrink: 0;
  overflow: hidden;
  contain: paint;
}

.brand-mark-logo {
  display: block;
  height: 64%;
  width: 102px;
  object-fit: contain;
  object-position: 50% 50%;
  align-self: center;
  flex-shrink: 0;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.brand-mark-divider {
  color: #7f97b1;
  font-weight: 700;
  line-height: 1;
  margin-top: -1px;
}

.brand-mark-core {
  font-size: 0.79rem;
  line-height: 1;
  color: #2f4a67;
  margin-top: -1px;
}

.status-copy h2 {
  font-size: 1.12rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.2;
}

.status-head {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.scenario-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid #c6d6e4;
  background: linear-gradient(180deg, #f3f8fd 0%, #e5eef8 100%);
  color: #31516f;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.arena-assignment-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid #cbd6e1;
  background: #f4f7fb;
  color: #52677d;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.arena-assignment-chip.assigned {
  border-color: #a8cdb7;
  background: #edf8f1;
  color: #286043;
}

.arena-assignment-chip.unassigned {
  border-color: #e4c88b;
  background: #fff7e8;
  color: #76551e;
}

.status-copy p {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 2px 0 0;
}

.top-strip-right {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.top-strip-contract-nav-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.top-strip-contract-nav {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: var(--top-strip-pane-height);
  padding: 0 5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
}

.top-strip-contract-btn {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  min-height: calc(var(--top-strip-pane-height) - 10px);
  padding: 0 8px;
  background: transparent;
  color: #4f667f;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: "Barlow", sans-serif;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
}

.top-strip-contract-btn:hover {
  background: rgba(223, 235, 247, 0.85);
  color: #27435d;
}

.top-strip-contract-btn.active {
  border-color: #6fa5d2;
  background: linear-gradient(180deg, #e2eefb 0%, #d3e5f8 100%);
  color: #17476d;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

.top-strip-contract-key {
  display: inline-flex;
  align-items: center;
}

.top-strip-contract-key kbd {
  display: inline-block;
  min-width: 18px;
  padding: 2px 5px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  font-weight: 600;
  text-align: center;
  background: linear-gradient(180deg, #f0f2f5 0%, #d8dde5 100%);
  border: 1px solid #b8c2d0;
  border-radius: 4px;
  box-shadow: 0 1px 0 #b8c2d0, inset 0 1px 0 rgba(255, 255, 255, 0.8);
  color: #3d4a5c;
}

.top-strip-contract-btn.active .top-strip-contract-key kbd {
  background: linear-gradient(180deg, #d4e8f5 0%, #b8d8ed 100%);
  border-color: #7db2da;
  box-shadow: 0 1px 0 #7db2da, inset 0 1px 0 rgba(255, 255, 255, 0.62);
  color: #1a4d73;
}

.top-strip-contract-label {
  line-height: 1;
}

.top-strip-contract-price {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1;
  color: #6a7b90;
}

.top-strip-contract-btn.active .top-strip-contract-price {
  color: #2c5e86;
}

.top-strip-contract-divider {
  width: 1px;
  height: 22px;
  background: rgba(123, 143, 165, 0.55);
  border-radius: 999px;
  flex: 0 0 auto;
}

.metric-box {
  min-width: 120px;
  min-height: var(--top-strip-pane-height);
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 6px 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: min-width 0.16s ease, padding 0.16s ease;
}

.metric-label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1;
}

.metric-value {
  margin-top: 4px;
  font-size: 1.06rem;
  font-weight: 700;
  font-family: "IBM Plex Mono", monospace;
  line-height: 1;
  transition: font-size 0.16s ease;
}

.metric-box-inline-portfolio {
  min-width: 0;
}

.warning-toast {
  position: fixed;
  top: calc(var(--shell-padding) + 2px);
  right: var(--shell-padding);
  z-index: 140;
  width: min(360px, calc(100vw - (var(--shell-padding) * 2)));
  padding: 10px 12px;
  border: 1px solid #e4c88b;
  border-left: 4px solid #c4861b;
  border-radius: 10px;
  background: #fff7e8;
  color: #6b4a15;
  box-shadow: 0 10px 22px rgba(25, 38, 58, 0.18);
  opacity: 0;
  transform: translate3d(12px, -12px, 0);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.warning-toast.visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  pointer-events: auto;
}

.warning-toast.success,
.warning-toast.status-toast {
  border-color: #aacdb8;
  border-left-color: #2f8f5b;
  background: #effaf3;
  color: #20523a;
}

.warning-toast-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.warning-toast-title {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.warning-toast-close {
  border: 1px solid #e2c078;
  background: #fff1d6;
  color: #7a5518;
  border-radius: 6px;
  width: 22px;
  height: 22px;
  line-height: 18px;
  padding: 0;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.warning-toast-close:hover {
  background: #ffeac0;
}

.warning-toast.success .warning-toast-close,
.warning-toast.status-toast .warning-toast-close {
  border-color: #a5cdb4;
  background: #e0f3e7;
  color: #20523a;
}

.warning-toast.success .warning-toast-close:hover,
.warning-toast.status-toast .warning-toast-close:hover {
  background: #d2eddd;
}

.warning-toast-body {
  margin-top: 3px;
  font-size: 0.9rem;
  line-height: 1.35;
  word-break: break-word;
}

.fill-toast-stack {
  position: fixed;
  right: var(--shell-padding);
  bottom: var(--shell-padding);
  z-index: 141;
  width: min(280px, calc(100vw - (var(--shell-padding) * 2)));
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.fill-toast {
  border: 1px solid #c8d3e1;
  border-left: 4px solid #7e93ad;
  border-radius: 9px;
  background: #f5f8fc;
  color: #31465d;
  box-shadow: 0 10px 20px rgba(20, 33, 52, 0.16);
  padding: 8px 10px;
}

.fill-toast-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.1;
}

.fill-toast-body {
  margin-top: 3px;
  font-size: 0.86rem;
  line-height: 1.25;
  font-family: "IBM Plex Mono", monospace;
}

.help-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 160;
  background: rgba(11, 24, 39, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.help-modal-panel {
  width: min(720px, calc(100vw - 24px));
  max-height: min(84vh, 760px);
  overflow: auto;
  border-radius: 12px;
  border: 1px solid #c5d2e0;
  background: #ffffff;
  box-shadow: 0 24px 46px rgba(12, 23, 38, 0.28);
}

.help-modal-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 13px 16px;
  border-bottom: 1px solid #d8e1ec;
  background: linear-gradient(180deg, #f7fbff 0%, #edf3fa 100%);
}

.help-modal-head h3 {
  font-size: 1.02rem;
  font-weight: 700;
  color: #1f344a;
}

.help-modal-close {
  width: 30px;
  height: 30px;
  border: 1px solid #c5d4e3;
  border-radius: 8px;
  background: #f3f8fd;
  color: #395676;
  font-size: 1.2rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

.help-modal-close:hover {
  background: #e9f1f9;
}

.help-modal-body {
  padding: 14px 16px 16px;
  color: #2a394b;
}

.help-screen-switch {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.help-screen-btn {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.2;
  box-shadow: none;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
  outline: none;
  background-image: none;
}

.help-lead {
  margin-bottom: 8px;
  color: #4a5c70;
  font-size: 0.92rem;
}

.settings-screen {
  display: grid;
  gap: 14px;
}

.settings-lead {
  margin-bottom: 0;
}

.settings-screen .help-section + .help-section {
  margin-top: 0;
}

.help-section + .help-section {
  margin-top: 12px;
}

.help-section h4 {
  margin: 0 0 6px;
  color: #2f4760;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.help-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 7px;
}

.help-list li {
  line-height: 1.35;
  font-size: 0.92rem;
}

.help-footnote {
  margin-top: 10px;
  font-size: 0.84rem;
  color: #5a6d82;
}

.shortcut-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.shortcut-section-head h4 {
  margin: 0;
}

.shortcut-grid {
  display: grid;
  gap: 10px;
}

.shortcut-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #d8e3ee;
  border-radius: 10px;
  background: linear-gradient(180deg, #fbfdff 0%, #f4f8fc 100%);
}

.shortcut-copy {
  min-width: 0;
}

.shortcut-label {
  font-size: 0.92rem;
  font-weight: 600;
  color: #2a3e54;
}

.shortcut-caption {
  margin-top: 2px;
  font-size: 0.84rem;
  line-height: 1.3;
  color: #617387;
}

.shortcut-key-btn {
  min-width: 126px;
  padding: 8px 12px;
  border: 1px solid #c6d4e2;
  border-radius: 9px;
  background: #ffffff;
  color: #1f344a;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}

.shortcut-key-btn:hover {
  background: #f4f8fc;
  border-color: #8ab1d3;
}

.shortcut-key-btn.capturing {
  background: #17324d;
  border-color: #17324d;
  color: #ffffff;
  box-shadow: 0 0 0 3px rgba(84, 141, 192, 0.18);
}

.help-reset-btn {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  border: 1px solid #c8d6e5;
  border-radius: 10px;
  min-height: 36px;
  padding: 0 11px;
  background: linear-gradient(180deg, #ffffff 0%, #f4f8fc 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
  color: #35506a;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: "Barlow", sans-serif;
  letter-spacing: 0.04em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-shrink: 0;
  white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}

.help-reset-btn:hover {
  background: linear-gradient(180deg, #fdfefe 0%, #edf4fb 100%);
  border-color: #8ab1d3;
  color: #1f344a;
}

.help-reset-btn:active {
  transform: translateY(1px);
}

.help-reset-btn-icon {
  width: 13px;
  height: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #58738d;
  flex: 0 0 auto;
}

.help-reset-btn-icon svg {
  width: 11px;
  height: 11px;
  display: block;
}

.help-reset-btn-label {
  line-height: 1;
}

.settings-panel {
  display: grid;
  gap: 14px;
  padding: 14px 15px;
  border: 1px solid #d8e3ee;
  border-radius: 12px;
  background: linear-gradient(180deg, #fbfdff 0%, #f3f8fd 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.settings-copy {
  font-size: 0.92rem;
  line-height: 1.4;
  color: #4a5c70;
}

.settings-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.settings-section-head h4 {
  margin: 0;
}

.settings-section-head .settings-copy {
  margin-top: 5px;
  margin-bottom: 0;
}

.settings-control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.settings-control-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 13px;
  border: 1px solid #d8e3ee;
  border-radius: 10px;
  background: linear-gradient(180deg, #fbfdff 0%, #f4f8fc 100%);
}

.settings-control-card-wide {
  grid-column: 1 / -1;
}

.settings-control-copy {
  min-width: 0;
}

.settings-control-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: #2a3e54;
}

.settings-control-caption {
  margin-top: 3px;
  font-size: 0.83rem;
  line-height: 1.35;
  color: #617387;
}

.settings-inline-toggle {
  flex: 0 0 auto;
  min-height: 36px;
  height: 36px;
}

.settings-inline-toggle.sticky-toggle {
  min-width: 58px;
  justify-content: center;
  gap: 0;
  padding: 0 12px;
}

.settings-inline-toggle.sticky-toggle .sticky-toggle-text {
  display: none;
}

.settings-inline-toggle.theme-toggle {
  min-width: 46px;
}

.settings-layout-btn {
  min-width: 136px;
  min-height: 36px;
  height: 36px;
  padding: 0 12px;
  flex: 0 0 auto;
}

.settings-subsection {
  display: grid;
  gap: 10px;
}

.settings-subsection + .settings-subsection {
  padding-top: 14px;
  border-top: 1px solid rgba(200, 214, 228, 0.8);
}

.settings-subsection-title {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #63778d;
}

.interface-mode-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}

.interface-mode-btn {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 11px 14px 12px;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  line-height: 1.2;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  text-align: left;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}

.interface-mode-title {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.interface-mode-description {
  font-size: 0.82rem;
  line-height: 1.35;
  font-weight: 500;
  opacity: 0.9;
}

.top-strip-folded-portfolio {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.folded-portfolio-group {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.folded-portfolio-label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1;
}

.folded-portfolio-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.folded-portfolio-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 6px 10px;
  border: 1px solid #ccd8e5;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.folded-portfolio-pill-name {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
}

.folded-portfolio-pill-value {
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  font-family: "IBM Plex Mono", monospace;
  line-height: 1;
}

.ticker-strip {
  margin-top: 0;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  transition: gap 0.16s ease;
}

.ticker-pill {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  font-family: "IBM Plex Mono", monospace;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: padding 0.16s ease, font-size 0.16s ease, gap 0.16s ease;
}

.ticker-pill.active {
  border-color: #7db2da;
  background: #e7f3fc;
}

.ticker-pill-key-hint {
  opacity: 1;
  transition: opacity 0.15s ease;
  margin-right: 4px;
}

.ticker-pill:hover .ticker-pill-key-hint,
.ticker-pill:focus .ticker-pill-key-hint,
.ticker-pill.active .ticker-pill-key-hint {
  opacity: 1;
}

.ticker-pill-key-hint kbd {
  display: inline-block;
  min-width: 20px;
  padding: 2px 6px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  background: linear-gradient(180deg, #f0f2f5 0%, #d8dde5 100%);
  border: 1px solid #b8c2d0;
  border-radius: 4px;
  box-shadow: 0 1px 0 #b8c2d0, inset 0 1px 0 rgba(255, 255, 255, 0.8);
  color: #3d4a5c;
}

.ticker-pill.active .ticker-pill-key-hint kbd {
  background: linear-gradient(180deg, #d4e8f5 0%, #b8d8ed 100%);
  border-color: #7db2da;
  box-shadow: 0 1px 0 #7db2da, inset 0 1px 0 rgba(255, 255, 255, 0.6);
  color: #1a4d73;
}

.ticker-name {
  font-weight: 700;
}

.ticker-position {
  color: var(--muted);
}

.ticker-fair {
  color: #4f6278;
  font-variant-numeric: tabular-nums;
}

.top-strip-progress {
  margin-top: 2px;
}

.top-strip-toggle-wrap {
  display: flex;
  align-items: stretch;
  min-height: var(--top-strip-pane-height);
}

.top-strip-layout-wrap {
  display: flex;
  align-items: stretch;
  min-height: var(--top-strip-pane-height);
}

.top-strip-help-wrap {
  display: flex;
  align-items: stretch;
  min-height: var(--top-strip-pane-height);
}

.sticky-toggle,
.theme-toggle,
.top-strip-layout-btn,
.top-strip-help-btn {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: linear-gradient(180deg, #f8fbff 0%, #edf3fa 100%);
  color: #465d75;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88);
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.sticky-toggle:hover,
.theme-toggle:hover,
.top-strip-layout-btn:hover,
.top-strip-help-btn:hover {
  background: linear-gradient(180deg, #f2f7fd 0%, #e6eef7 100%);
  border-color: #c2cfdd;
  color: #354c64;
}

.top-strip-layout-btn {
  min-width: 132px;
  height: 100%;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: "Barlow", sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
}

.top-strip-layout-btn .layout-icon {
  font-size: 0.84rem;
}

.top-strip-layout-btn .layout-icon svg {
  width: 11px;
  height: 11px;
  display: block;
}

.top-strip-help-btn {
  min-width: 44px;
  height: 100%;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: "Barlow", sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0 10px;
}

.theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 100%;
  min-width: 44px;
  justify-content: center;
  gap: 0;
  padding: 0 10px;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: "Barlow", sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.theme-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.theme-toggle-icon {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(88, 119, 148, 0.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.78rem;
  line-height: 1;
}

.top-strip-layout-btn .layout-icon,
.top-strip-help-btn .help-icon {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(88, 119, 148, 0.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}

.top-strip-help-btn .help-icon {
  font-size: 1rem;
}

.top-strip-help-btn .help-icon .icon {
  margin: 0;
  width: auto;
  font-size: 0.82rem;
  line-height: 1;
}

.top-strip-layout-btn .layout-label {
  line-height: 1;
}

.top-strip-help-btn:focus-visible,
.top-strip-layout-btn:focus-visible,
.theme-toggle:focus-within,
.sticky-toggle:focus-within {
  outline: 2px solid #7da4c8;
  outline-offset: 2px;
}

.sticky-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 100%;
  gap: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: "Barlow", sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0 11px 0 10px;
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
}

.sticky-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.sticky-toggle-slider {
  width: 32px;
  height: 18px;
  border-radius: 999px;
  background: #bdcada;
  border: 1px solid #aebed0;
  position: relative;
  transition: background 0.14s ease, border-color 0.14s ease;
  flex-shrink: 0;
}

.sticky-toggle-slider::after {
  content: "";
  position: absolute;
  top: 1px;
  left: 1px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 29, 45, 0.2);
  transition: transform 0.14s ease;
}

.sticky-toggle input:checked + .sticky-toggle-slider {
  background: #6ea1cb;
  border-color: #5a8fb9;
}

.sticky-toggle input:checked + .sticky-toggle-slider::after {
  transform: translateX(14px);
}

.sticky-toggle-text {
  color: inherit;
  line-height: 1;
}

.tender-stack {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.security-select-placeholder {
  margin-top: 12px;
  min-height: 62vh;
  border: 1px solid #d5dbe4;
  border-radius: var(--radius);
  background:
    radial-gradient(1200px 380px at 18% -15%, rgba(120, 138, 160, 0.09), transparent 68%),
    linear-gradient(165deg, #f2f4f7 0%, #e8ecf2 100%);
  display: grid;
  place-items: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.security-select-placeholder-inner {
  text-align: center;
  color: #5e6979;
  padding: 24px;
}

.security-select-placeholder-inner h2 {
  font-size: clamp(1.5rem, 2.2vw, 2rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #4e5a6b;
}

.security-select-placeholder-inner p {
  margin-top: 8px;
  font-size: 0.95rem;
  color: #6c7787;
}

.tender-card {
  background: #eef6ff;
  border: 1px solid #bfdaf5;
  border-radius: 9px;
  padding: 11px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.tender-copy h4 {
  font-size: 0.98rem;
  margin-bottom: 2px;
}

.tender-copy p {
  color: #33556f;
  font-size: 0.9rem;
}

.tender-actions {
  display: flex;
  gap: 6px;
}

.dashboard-grid {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  align-content: flex-start;
  gap: 12px;
}

.dashboard-card {
  flex: 0 0 auto;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
  min-width: 0;
}

body.widget-dragging {
  user-select: none;
  cursor: grabbing;
}

body.widget-width-resizing {
  user-select: none;
  cursor: ew-resize;
}

body.widget-height-resizing {
  user-select: none;
  cursor: ns-resize;
}

.widget-card {
  position: relative;
  transition: box-shadow 0.14s ease, border-color 0.14s ease;
  overflow: auto;
}

.widget-card:hover {
  border-color: #bec8d6;
}

.widget-drag-handle {
  cursor: grab;
  touch-action: none;
}

.widget-card.widget-dragging .widget-drag-handle {
  cursor: grabbing;
}

.widget-card.widget-floating {
  position: fixed;
  z-index: 120;
  resize: both;
  overflow: auto;
  min-width: 280px;
  min-height: 220px;
  max-width: min(92vw, 1500px);
  max-height: 88vh;
  box-shadow: 0 16px 40px rgba(18, 31, 49, 0.18);
}

.widget-width-handle {
  position: absolute;
  top: 8px;
  right: 0;
  bottom: 8px;
  width: 8px;
  cursor: ew-resize;
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.14s ease;
  z-index: 4;
}

.widget-height-handle {
  position: sticky;
  left: 0;
  right: 0;
  bottom: 0;
  margin: -8px 8px 0;
  height: 8px;
  cursor: ns-resize;
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.14s ease;
  z-index: 5;
}

.widget-card[data-widget-docked="1"] > .widget-height-handle {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0 8px;
}

.widget-width-handle::before {
  content: "";
  position: absolute;
  top: 20%;
  bottom: 20%;
  left: 3px;
  width: 2px;
  border-radius: 2px;
  background: #9fb1c4;
}

.widget-height-handle::before {
  content: "";
  position: absolute;
  left: 22%;
  right: 22%;
  top: 3px;
  height: 2px;
  border-radius: 2px;
  background: #9fb1c4;
}

.widget-card:hover .widget-width-handle,
.widget-card.widget-width-dragging .widget-width-handle,
body.widget-width-resizing .widget-width-handle {
  opacity: 0.75;
}

.widget-card:hover .widget-height-handle,
.widget-card.widget-height-dragging .widget-height-handle,
body.widget-height-resizing .widget-height-handle {
  opacity: 0.75;
}

.widget-card.widget-floating .widget-width-handle {
  display: none;
}

.widget-card.widget-floating .widget-height-handle {
  display: none;
}

.dashboard-grid.widget-snap-active {
  outline: 1px dashed #9fb6cd;
  outline-offset: 3px;
}

.widget-card.widget-snap-before::before,
.widget-card.widget-snap-after::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  height: 2px;
  border-radius: 4px;
  background: #5f8fb8;
  z-index: 3;
}

.widget-card.widget-snap-before::before {
  top: -6px;
}

.widget-card.widget-snap-after::after {
  bottom: -6px;
}

.card-span-1 {
  flex-basis: calc(8.333333% - 11px);
  max-width: calc(8.333333% - 11px);
}

.card-span-2 {
  flex-basis: calc(16.666667% - 10px);
  max-width: calc(16.666667% - 10px);
}

.card-span-3 {
  flex-basis: calc(25% - 9px);
  max-width: calc(25% - 9px);
}

.card-span-4 {
  flex-basis: calc(33.333333% - 8px);
  max-width: calc(33.333333% - 8px);
}

.card-span-5 {
  flex-basis: calc(41.666667% - 7px);
  max-width: calc(41.666667% - 7px);
}

.card-span-6 {
  flex-basis: calc(50% - 6px);
  max-width: calc(50% - 6px);
}

.card-span-7 {
  flex-basis: calc(58.333333% - 5px);
  max-width: calc(58.333333% - 5px);
}

.card-span-8 {
  flex-basis: calc(66.666667% - 4px);
  max-width: calc(66.666667% - 4px);
}

.card-span-9 {
  flex-basis: calc(75% - 3px);
  max-width: calc(75% - 3px);
}

.card-span-10 {
  flex-basis: calc(83.333333% - 2px);
  max-width: calc(83.333333% - 2px);
}

.card-span-11 {
  flex-basis: calc(91.666667% - 1px);
  max-width: calc(91.666667% - 1px);
}

.card-span-12 {
  flex-basis: 100%;
  max-width: 100%;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.card-head h3 {
  font-size: 1.06rem;
  font-weight: 700;
}

.card-head span {
  color: var(--muted);
  font-size: 0.86rem;
}

.section-title {
  margin-top: 10px;
  margin-bottom: 6px;
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.holding-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.holding-pill {
  border: 1px solid var(--border);
  background: var(--surface-soft);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.holding-pill.full-width {
  grid-column: 1 / -1;
}

.holding-pill.neutral {
  background: var(--surface-soft);
}

.holding-name {
  color: var(--muted);
  font-size: 0.86rem;
}

.holding-value {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.92rem;
  font-weight: 500;
}

.table-wrap {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: auto;
  background: var(--surface);
}

.table-wrap.compact-table {
  max-height: 200px;
}

.table-wrap.tall-table {
  max-height: 295px;
}

.table-wrap.orders-open-table,
.table-wrap.old-orders-open-table {
  max-height: none;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.orders-open-table {
  flex: 1 1 auto;
  min-height: 180px;
  height: auto;
}

.old-orders-open-table {
  height: 295px;
}

.table-wrap.ladder-scroll {
  height: 420px;
  overflow-y: auto;
}

.dashboard-card[data-widget-id="ladder"],
.dashboard-card[data-widget-id^="ladder-"] {
  display: flex;
  flex-direction: column;
}

.dashboard-card[data-widget-id="ladder"] .ladder-content,
.dashboard-card[data-widget-id^="ladder-"] .ladder-content {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.dashboard-card[data-widget-id="ladder"] .table-wrap.ladder-scroll,
.dashboard-card[data-widget-id^="ladder-"] .table-wrap.ladder-scroll {
  flex: 0 0 auto;
}

.dashboard-card[data-widget-id="ladder"] .config-grid,
.dashboard-card[data-widget-id^="ladder-"] .config-grid {
  flex: 0 0 auto;
  grid-template-columns: minmax(0, 1fr);
  max-width: 240px;
}

.dashboard-card[data-widget-id="ladder"][data-widget-height] .table-wrap.ladder-scroll,
.dashboard-card[data-widget-id^="ladder-"][data-widget-height] .table-wrap.ladder-scroll {
  flex: 1 1 auto;
  min-height: 180px;
  height: auto;
}

.panel-table {
  margin: 0 !important;
  border: none !important;
  font-size: 0.9rem;
}

.panel-table thead th {
  background: var(--surface-soft) !important;
  color: var(--text) !important;
  font-weight: 600 !important;
  position: sticky;
  top: 0;
  z-index: 1;
}

.panel-table td,
.panel-table th {
  border-left: none !important;
  border-right: none !important;
  color: var(--text) !important;
}

.panel-table thead th {
  background: var(--surface-soft) !important;
}

.panel-table tbody td {
  background: var(--surface) !important;
}

.dashboard-card[data-widget-id="portfolio"] .panel-table {
  width: 100% !important;
}

.dashboard-card[data-widget-id="portfolio"] {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dashboard-card[data-widget-id="portfolio"] > :not(.portfolio-filled-orders-section) {
  flex: 0 0 auto;
  flex-shrink: 0;
}

.dashboard-card[data-widget-id="portfolio"][data-widget-docked="1"] {
  overflow: hidden;
}

.dashboard-card[data-widget-id="portfolio"][data-widget-docked="1"]:not([data-widget-height]) {
  height: 560px;
}

.dashboard-card[data-widget-id="portfolio"] .portfolio-section-title {
  margin-top: 10px;
  margin-bottom: 6px;
}

.dashboard-card[data-widget-id="portfolio"] > .portfolio-section-title:first-of-type {
  margin-top: 0;
}

.dashboard-card[data-widget-id="portfolio"] .portfolio-filled-orders-section {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  min-height: 0;
  margin-top: 10px;
  overflow: hidden;
}

.dashboard-card[data-widget-id="portfolio"] .portfolio-filled-orders-section .portfolio-section-title {
  margin-top: 0;
}

.dashboard-card[data-widget-id="portfolio"] .portfolio-filled-orders-table {
  flex: 1 1 auto;
  min-height: 0;
  height: 0;
  max-height: none;
  overflow-y: auto;
}

.dashboard-card[data-widget-id="portfolio"] .panel-table thead th:first-child,
.dashboard-card[data-widget-id="portfolio"] .panel-table tbody td:first-child {
  width: 100%;
}

.dashboard-card[data-widget-id="portfolio"] .panel-table thead th:last-child,
.dashboard-card[data-widget-id="portfolio"] .panel-table tbody td:last-child {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

.text-right {
  text-align: right;
}

.empty-row {
  text-align: left;
  color: var(--muted);
  padding: 16px !important;
}

.panel-table tbody td.empty-row {
  width: auto !important;
  white-space: normal !important;
  text-align: left !important;
}

.field-block {
  margin-bottom: 10px;
}

.field-block label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.84rem;
}

.keybind-hint {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
}

.field-block input,
.field-block select,
.quickbook-input,
.config-grid input {
  width: 100%;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  padding: 6px 8px;
  color: var(--text);
}

.orders-panel-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 0 0 auto;
  min-width: 0;
}

.place-order-layout {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: flex-start;
}

.orders-panel-section + .orders-panel-section {
  margin-top: 18px;
}

.orders-section-title {
  margin-top: 0;
}

.orders-open-section {
  flex: 1 1 auto;
  min-height: 0;
  padding-top: 2px;
}

.place-order-security-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.place-order-ticker-btn {
  display: block;
  min-width: 72px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.place-order-ticker-btn:hover {
  background: #e8f0f8;
  border-color: #a8bfd4;
}

.place-order-ticker-btn.active {
  background: #e7f3fc;
  border-color: #5f95bf;
  color: #0f4b76;
}

.place-order-forms-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.order-inline-pane {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  border-left: 4px solid var(--border);
  transition: border-color 0.14s ease, background 0.14s ease, box-shadow 0.14s ease;
}

.order-inline-pane.buy-pane {
  border-left-color: var(--buy);
}

.order-inline-pane.sell-pane {
  border-left-color: var(--sell);
}

.order-inline-pane strong {
  font-weight: 700;
  transition: color 0.14s ease;
}

.order-inline-pane.buy-pane:focus-within {
  border-color: #8dc8a5;
  border-left-color: var(--buy);
  background: linear-gradient(180deg, #f3fbf6 0%, #eaf6ef 100%);
  box-shadow: 0 0 0 3px rgba(31, 140, 77, 0.14), 0 10px 22px rgba(31, 140, 77, 0.1);
}

.order-inline-pane.buy-pane:focus-within strong {
  color: #1f8c4d;
}

.order-inline-pane.sell-pane:focus-within {
  border-color: #d6a7a2;
  border-left-color: var(--sell);
  background: linear-gradient(180deg, #fff6f5 0%, #fbeeee 100%);
  box-shadow: 0 0 0 3px rgba(197, 71, 59, 0.14), 0 10px 22px rgba(197, 71, 59, 0.1);
}

.order-inline-pane.sell-pane:focus-within strong {
  color: #b44338;
}

.order-submit-btn {
  padding: 8px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.order-submit-btn.buy-btn {
  background: var(--buy);
  color: #fff;
  border-color: var(--buy);
}

.order-submit-btn.buy-btn:hover:not(:disabled) {
  filter: brightness(1.08);
}

.order-submit-btn.sell-btn {
  background: var(--sell);
  color: #fff;
  border-color: var(--sell);
}

.order-submit-btn.sell-btn:hover:not(:disabled) {
  filter: brightness(1.08);
}

.order-submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.order-inline-key-hint {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 28px;
  margin-right: 6px;
}

.order-inline-key-hint.placeholder {
  visibility: hidden;
}

.order-inline-key-hint kbd {
  display: inline-block;
  min-width: 22px;
  padding: 3px 7px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
  background: linear-gradient(180deg, #f0f2f5 0%, #d8dde5 100%);
  border: 1px solid #b8c2d0;
  border-radius: 4px;
  box-shadow: 0 1px 0 #b8c2d0, inset 0 1px 0 rgba(255, 255, 255, 0.8);
  color: #3d4a5c;
}

.order-inline-pane.buy-pane .order-inline-key-hint kbd {
  background: linear-gradient(180deg, #d4eef0 0%, #b8e0e5 100%);
  border-color: #7db8c2;
  box-shadow: 0 1px 0 #7db8c2, inset 0 1px 0 rgba(255, 255, 255, 0.6);
  color: #14643a;
}

.order-inline-pane.sell-pane .order-inline-key-hint kbd {
  background: linear-gradient(180deg, #f0e0e0 0%, #e5c8c8 100%);
  border-color: #c2a0a0;
  box-shadow: 0 1px 0 #c2a0a0, inset 0 1px 0 rgba(255, 255, 255, 0.6);
  color: #8f2f26;
}

.orders-cancel-all-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.orders-cancel-all-key-hint {
  display: inline-flex;
  align-items: center;
}

.orders-cancel-all-key-hint kbd {
  display: inline-block;
  min-width: 22px;
  padding: 3px 7px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
  text-align: center;
  background: linear-gradient(180deg, #f0e0e0 0%, #e5c8c8 100%);
  border: 1px solid #c2a0a0;
  border-radius: 4px;
  box-shadow: 0 1px 0 #c2a0a0, inset 0 1px 0 rgba(255, 255, 255, 0.6);
  color: #8f2f26;
}

.order-inline-input {
  width: 62px;
  min-width: 44px;
  height: 100%;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
  font-size: 1rem;
  padding: 8px 10px;
  text-align: right;
  -moz-appearance: textfield;
}

.order-inline-field {
  display: inline-flex;
  align-items: center;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  overflow: hidden;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.order-inline-prefix {
  width: 26px;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--border);
  background: #f0f5fb;
  color: #4b6682;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
}

.order-inline-field:focus-within {
  border-color: #7bafd4;
  box-shadow: 0 0 0 2px rgba(123, 175, 212, 0.2);
}

.order-inline-input::-webkit-outer-spin-button,
.order-inline-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.order-inline-input:focus {
  outline: none;
}

.order-inline-input::placeholder {
  color: #9aa8b8;
}

.dashboard-card[data-widget-id="place-order"] {
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dashboard-card[data-widget-id="place-order"][data-widget-docked="1"] {
  overflow: hidden;
}

.dashboard-card[data-widget-id="place-order"][data-widget-docked="1"]:not([data-widget-height]) {
  height: 560px;
}

.dashboard-card[data-widget-id="place-order"] > .card-head {
  flex: 0 0 auto;
}

.orders-widget-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
  padding-bottom: 8px;
}

.dashboard-card[data-widget-id="new-orders"] {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.all-contract-orders-stack {
  display: flex;
  flex-direction: column;
  flex: 1 0 auto;
  gap: 18px;
  min-height: 0;
}

.contract-order-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.contract-order-selector {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 11px 0 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: linear-gradient(180deg, #f8fbff 0%, #eef4fb 100%);
  color: #4f667f;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88);
  font-family: "Barlow", sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
}

.contract-order-selector:hover {
  background: linear-gradient(180deg, #f2f7fd 0%, #e6eef7 100%);
  border-color: #c2cfdd;
  color: #385069;
}

.contract-order-selector.active {
  background: linear-gradient(180deg, #e2eefb 0%, #d3e5f8 100%);
  border-color: #6fa5d2;
  color: #17476d;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 0 0 1px rgba(111, 165, 210, 0.1);
}

.contract-order-selector-key {
  display: inline-flex;
  align-items: center;
  min-width: 22px;
}

.contract-order-selector-key.placeholder {
  visibility: hidden;
}

.contract-order-selector-key kbd {
  display: inline-block;
  min-width: 22px;
  padding: 3px 7px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
  background: linear-gradient(180deg, #f0f2f5 0%, #d8dde5 100%);
  border: 1px solid #b8c2d0;
  border-radius: 4px;
  box-shadow: 0 1px 0 #b8c2d0, inset 0 1px 0 rgba(255, 255, 255, 0.8);
  color: #3d4a5c;
}

.contract-order-selector.active .contract-order-selector-key kbd {
  background: linear-gradient(180deg, #d4e8f5 0%, #b8d8ed 100%);
  border-color: #7db2da;
  box-shadow: 0 1px 0 #7db2da, inset 0 1px 0 rgba(255, 255, 255, 0.6);
  color: #1a4d73;
}

.contract-order-selector-label {
  line-height: 1;
}

.contract-order-block + .contract-order-block {
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.contract-order-panes {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dashboard-card[data-widget-id="place-order"] .panel-table {
  width: 100% !important;
}

.dashboard-card[data-widget-id="place-order"] .panel-table thead th:last-child,
.dashboard-card[data-widget-id="place-order"] .panel-table tbody td:last-child,
.dashboard-card[data-widget-id="old-orders"] .panel-table thead th:last-child,
.dashboard-card[data-widget-id="old-orders"] .panel-table tbody td:last-child {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

.dashboard-card[data-widget-id="place-order"] .orders-open-actions-head,
.dashboard-card[data-widget-id="old-orders"] .orders-open-actions-head {
  padding-right: 12px !important;
  vertical-align: middle !important;
  text-align: right !important;
}

.dashboard-card[data-widget-id="place-order"] .orders-cancel-all-btn,
.dashboard-card[data-widget-id="old-orders"] .orders-cancel-all-btn {
  display: inline-flex;
  align-items: center;
  margin: 0 !important;
}

.dashboard-card[data-widget-id="old-orders"] {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dashboard-card[data-widget-id="old-orders"][data-widget-docked="1"]:not([data-widget-height]) {
  height: 470px;
  overflow: hidden;
}

.old-orders-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}

.old-orders-section + .old-orders-section {
  margin-top: 18px;
}

.old-orders-filled-section {
  flex: 1 1 auto;
  overflow: hidden;
}

.old-orders-filled-table {
  flex: 1 1 auto;
  min-height: 0;
  height: 0;
  max-height: none;
  overflow-y: auto;
}

@container (max-width: 450px) {
  .place-order-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .place-order-security-col {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

.ladder-table {
  width: 100% !important;
  table-layout: fixed;
  text-align: right;
}

.ladder-table col.ladder-col-price {
  width: 42%;
}

.ladder-table col.ladder-col-mkt {
  width: 28%;
}

.ladder-table col.ladder-col-action {
  width: 142px;
}

.ladder-table th,
.ladder-table td {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.ladder-row {
  cursor: default;
}

.ladder-row.ask td {
  background: #fff4f3 !important;
}

.ladder-row.bid td {
  background: #f0f7ff !important;
}

.ladder-qty-cell {
  text-align: right;
}

.ladder-my-qty-inline {
  margin-left: 8px;
  font-weight: 600;
  color: #375372;
}

.ladder-action-cell {
  text-align: center;
  width: 132px;
}

.ladder-action-pair {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.ladder-action-btn {
  min-width: 60px;
  padding-left: 8px !important;
  padding-right: 8px !important;
  border-width: 1px !important;
  border-style: solid !important;
  border-color: #cfd8e3 !important;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.ladder-action-btn.buy-signal {
  background: #eaf8ef !important;
  border-color: #8fc6a2 !important;
  color: #1e7442 !important;
}

.ladder-action-btn.sell-signal {
  background: #faefee !important;
  border-color: #d2a59f !important;
  color: #8d3f37 !important;
}

.ladder-action-btn:hover:not(:disabled) {
  background: #f3f6fa !important;
}

.ladder-action-btn.buy-signal:hover:not(:disabled) {
  background: #e4f5eb !important;
  border-color: #83be98 !important;
}

.ladder-action-btn.sell-signal:hover:not(:disabled) {
  background: #f8e8e6 !important;
  border-color: #cb9a93 !important;
}

.ladder-action-btn:disabled {
  opacity: 0.45 !important;
}

.ladder-spread td {
  text-align: center;
  font-weight: 600;
  background: #f6f8fb;
}

.config-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.subscription-strip {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.subscription-pill {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  font-size: 0.83rem;
  padding: 5px 10px;
  cursor: pointer;
}

.subscription-pill.subscribed {
  border-color: #87c79b;
  background: #eaf8ef;
  color: #1e7442;
}

.subscription-pill.unsubscribed {
  border-color: #d6a8a3;
  background: #faefee;
  color: #8d3f37;
}

.subscription-pill.free {
  border-color: #b4c5d8;
  background: #eef4fb;
  color: #375372;
}

body.dark-mode .subscription-pill.subscribed {
  border-color: var(--buy);
  background: rgba(45, 168, 90, 0.2);
  color: #6dd89a;
}

body.dark-mode .subscription-pill.unsubscribed {
  border-color: var(--sell);
  background: rgba(217, 84, 74, 0.2);
  color: #e88a82;
}

body.dark-mode .subscription-pill.free {
  border-color: var(--border);
  background: var(--surface-soft);
  color: var(--muted);
}

.chart-canvas {
  min-height: 320px;
  height: auto;
  width: 100%;
  flex: 1 1 auto;
}

.dashboard-card[data-widget-id="price-chart"] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dashboard-card[data-widget-id="price-chart"][data-widget-height] .chart-canvas {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
}

.chart-toggles {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chart-toggle {
  border: 1px solid var(--border);
  background: #f4f7fb;
  border-radius: 7px;
  padding: 6px 10px;
  cursor: pointer;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
}

.chart-toggle.active {
  border-color: #8ab5d9;
  background: #e8f3fc;
}

.scoreboard-canvas {
  width: 100%;
  height: 500px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 10px;
}

.admin-controls {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  color: #4b5b70;
  font-size: 0.9rem;
}

.empty-state {
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  text-align: center;
  padding: 20px 12px;
}

.progress-bar-shell {
  margin-top: 12px !important;
  border-radius: 999px !important;
  border: 1px solid var(--border) !important;
  overflow: hidden;
}

.top-strip .progress-bar-shell {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  background: #f9fbfe;
}

.top-strip.top-strip-condensed {
  gap: 6px;
  padding: 7px 10px;
  border-left-width: 4px;
  box-shadow: 0 5px 12px rgba(17, 30, 46, 0.11);
}

.top-strip.top-strip-condensed .top-strip-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.top-strip.top-strip-condensed .brand-mark {
  height: var(--top-strip-condensed-pane-height, 30px);
  padding: 0 9px;
  border-radius: 999px;
  gap: 0;
  background: #f7fafc;
}

.top-strip.top-strip-condensed .brand-mark-logo {
  width: 72px;
  height: 62%;
}

.top-strip.top-strip-condensed .brand-mark-divider,
.top-strip.top-strip-condensed .brand-mark-core {
  display: none;
}

.top-strip.top-strip-condensed .status-copy h2 {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.15;
  max-width: 400px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.top-strip.top-strip-condensed .status-head {
  gap: 7px;
}

.top-strip.top-strip-condensed .scenario-chip,
.top-strip.top-strip-condensed .arena-assignment-chip {
  min-height: 18px;
  padding: 0 7px;
  font-size: 0.58rem;
}

.top-strip.top-strip-condensed .status-copy p {
  display: none;
}

.top-strip.top-strip-condensed .top-strip-left {
  gap: 6px;
}

.top-strip.top-strip-condensed .metric-box {
  min-width: auto;
  min-height: 0;
  height: var(--top-strip-condensed-pane-height, 30px);
  padding: 0 9px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  flex-direction: row;
  justify-content: center;
  gap: 6px;
  background: #f7fafc;
}

.top-strip.top-strip-condensed .metric-box::before {
  content: attr(data-mini-label);
  display: inline;
  margin: 0;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1;
  color: #6a7b90;
}

.top-strip.top-strip-condensed .metric-box-inline-portfolio {
  max-width: 240px;
  flex: 0 1 auto;
}

.top-strip.top-strip-condensed .metric-label {
  display: none;
}

.top-strip.top-strip-condensed .metric-value {
  font-size: 0.78rem;
  margin-top: 0;
  line-height: 1;
}

.top-strip.top-strip-condensed .metric-box-inline-portfolio .metric-value {
  font-size: 0.72rem;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-strip.top-strip-condensed .top-strip-right {
  --top-strip-condensed-pane-height: 30px;
  gap: 7px;
  align-items: stretch;
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.top-strip.top-strip-condensed .top-strip-contract-nav-wrap {
  gap: 7px;
}

.top-strip.top-strip-condensed .top-strip-contract-nav {
  min-height: var(--top-strip-condensed-pane-height, 30px);
  padding: 0 4px;
  background: #f7fafc;
}

.top-strip.top-strip-condensed .top-strip-contract-btn {
  min-height: 24px;
  padding: 0 7px;
  gap: 4px;
  font-size: 0.72rem;
}

.top-strip.top-strip-condensed .top-strip-contract-key kbd {
  min-width: 16px;
  padding: 1px 4px;
  font-size: 0.64rem;
}

.top-strip.top-strip-condensed .top-strip-contract-price {
  font-size: 0.68rem;
}

.top-strip.top-strip-condensed .top-strip-contract-divider {
  height: 18px;
  background: rgba(123, 143, 165, 0.48);
}

.top-strip.top-strip-condensed .top-strip-help-btn {
  min-width: auto;
  height: var(--top-strip-condensed-pane-height, 30px);
  padding: 0 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  gap: 5px;
  line-height: 1;
}

.top-strip.top-strip-condensed .top-strip-layout-btn {
  min-width: auto;
  height: var(--top-strip-condensed-pane-height, 30px);
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.68rem;
  gap: 5px;
  line-height: 1;
}

.top-strip.top-strip-condensed .top-strip-help-btn .help-icon,
.top-strip.top-strip-condensed .top-strip-layout-btn .layout-icon {
  width: 15px;
  height: 15px;
}

.top-strip.top-strip-condensed .top-strip-help-wrap {
  min-height: var(--top-strip-condensed-pane-height, 30px);
  align-self: stretch;
}

.top-strip.top-strip-condensed .top-strip-layout-wrap {
  min-height: var(--top-strip-condensed-pane-height, 30px);
}

.top-strip.top-strip-condensed .ticker-strip {
  gap: 6px;
  row-gap: 4px;
  align-items: center;
}

.top-strip.top-strip-condensed .ticker-pill {
  padding: 3px 8px;
  font-size: 0.75rem;
  gap: 4px;
  border-color: #c8d5e3;
  background: #fff;
}

.top-strip.top-strip-condensed .ticker-pill-key-hint kbd {
  min-width: 16px;
  padding: 1px 4px;
  font-size: 0.65rem;
}

.top-strip.top-strip-condensed .ticker-pill.active {
  border-color: #5f95bf;
  background: #dfedf9;
  color: #0f4b76;
  box-shadow: inset 0 0 0 1px rgba(95, 149, 191, 0.22);
}

.top-strip.top-strip-condensed .ticker-price,
.top-strip.top-strip-condensed .ticker-position {
  display: none;
}

.top-strip.top-strip-condensed .top-strip-toggle-wrap {
  display: none;
}

.top-strip.top-strip-condensed .top-strip-progress {
  margin-top: 1px;
}

.top-strip.top-strip-condensed .progress-bar-shell {
  height: 5px;
  min-height: 5px;
  opacity: 0.92;
}

.top-strip.top-strip-condensed .progress-bar-shell .bar {
  min-height: 5px;
}

.top-strip.top-strip-condensed .progress-bar-shell .label {
  display: none;
}

/* Dark mode visual polish */
html.dark-mode body,
body.dark-mode {
  background: var(--bg);
  color: var(--text);
}

html.dark-mode .mango-body {
  background: var(--bg);
}

html.dark-mode .login-shell {
  background: radial-gradient(1000px 420px at 10% -15%, rgba(111, 178, 232, 0.14), transparent 60%), linear-gradient(150deg, #131923 0%, #1b2432 55%, #192231 100%);
}

html.dark-mode .login-card .ui.form .field > label {
  color: var(--muted) !important;
}

html.dark-mode .login-card .ui.form input[type="text"],
html.dark-mode .login-card .ui.form input[type="password"] {
  background: #1a2330 !important;
  border: 1px solid #36475c !important;
  color: var(--text) !important;
}

html.dark-mode .top-strip {
  border-color: var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

html.dark-mode .top-strip.state-down {
  border-left-color: #cb6761;
}

html.dark-mode .top-strip.state-wait {
  border-left-color: #c59d57;
}

html.dark-mode .top-strip.state-live {
  border-left-color: #48b173;
}

html.dark-mode .brand-mark {
  color: #d6e3f1;
  border-color: #34465b;
  background: #1b2533;
}

html.dark-mode .brand-mark-divider {
  color: #7188a2;
}

html.dark-mode .brand-mark-core {
  color: #c6d7ea;
}

html.dark-mode .scenario-chip {
  border-color: #49617b;
  background: linear-gradient(180deg, #23384d 0%, #1b2b3c 100%);
  color: #dce8f6;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

html.dark-mode .arena-assignment-chip {
  border-color: #49617b;
  background: #202d3d;
  color: #c3d3e4;
}

html.dark-mode .arena-assignment-chip.assigned {
  border-color: #315f45;
  background: #12291d;
  color: #bce9cd;
}

html.dark-mode .arena-assignment-chip.unassigned {
  border-color: #72572a;
  background: #2a2216;
  color: #f5dab0;
}

html.dark-mode .metric-box {
  background: #1b2533;
  border-color: #34465b;
}

html.dark-mode .top-strip-help-btn,
html.dark-mode .sticky-toggle,
html.dark-mode .theme-toggle,
html.dark-mode .top-strip-layout-btn {
  background: linear-gradient(180deg, #233247 0%, #1b2738 100%);
  border-color: #3e546e;
  color: #ccdaea;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

html.dark-mode .top-strip-help-btn:hover,
html.dark-mode .sticky-toggle:hover,
html.dark-mode .theme-toggle:hover,
html.dark-mode .top-strip-layout-btn:hover {
  background: linear-gradient(180deg, #2a3d57 0%, #1f3045 100%);
  border-color: #557090;
  color: #e1ebf8;
}

html.dark-mode .theme-toggle-icon,
html.dark-mode .top-strip-layout-btn .layout-icon,
html.dark-mode .top-strip-help-btn .help-icon {
  background: rgba(151, 180, 211, 0.2);
  color: #e2ecf8;
}

html.dark-mode .top-strip-help-btn:focus-visible {
  outline-color: var(--accent);
}

html.dark-mode .top-strip-layout-btn:focus-visible {
  outline-color: var(--accent);
}

html.dark-mode .theme-toggle:focus-within,
html.dark-mode .sticky-toggle:focus-within {
  outline-color: var(--accent);
}

html.dark-mode .sticky-toggle-slider {
  background: #35475f;
  border-color: #445b75;
}

html.dark-mode .sticky-toggle-slider::after {
  background: #d8e4f1;
}

html.dark-mode .sticky-toggle input:checked + .sticky-toggle-slider {
  background: #4f85b5;
  border-color: #6a9ecb;
}

html.dark-mode .sticky-toggle-text {
  color: #bfd0e6;
}

html.dark-mode .warning-toast {
  border-color: #72572a;
  border-left-color: #c8963c;
  background: #2a2216;
  color: #f5dab0;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
}

html.dark-mode .warning-toast.success,
html.dark-mode .warning-toast.status-toast {
  border-color: #315f45;
  border-left-color: #53b879;
  background: #12291d;
  color: #bce9cd;
}

html.dark-mode .warning-toast-close {
  border-color: #927142;
  background: #3a2f1d;
  color: #f5d7a8;
}

html.dark-mode .warning-toast-close:hover {
  background: #463721;
}

html.dark-mode .warning-toast.success .warning-toast-close,
html.dark-mode .warning-toast.status-toast .warning-toast-close {
  border-color: #376f50;
  background: #183525;
  color: #bce9cd;
}

html.dark-mode .warning-toast.success .warning-toast-close:hover,
html.dark-mode .warning-toast.status-toast .warning-toast-close:hover {
  background: #1d432e;
}

html.dark-mode .fill-toast {
  border-color: #4e6078;
  border-left-color: #7d95b4;
  background: #1f2a38;
  color: #d3e0ee;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.44);
}

html.dark-mode .help-modal-overlay {
  background: rgba(4, 8, 14, 0.7);
}

html.dark-mode .help-modal-panel {
  border-color: var(--border);
  background: #1b2431;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.52);
}

html.dark-mode .help-modal-head {
  border-bottom-color: #334458;
  background: linear-gradient(180deg, #243245 0%, #1d2838 100%);
}

html.dark-mode .help-modal-head h3,
html.dark-mode .help-modal-body,
html.dark-mode .help-section h4 {
  color: #dbe7f4;
}

html.dark-mode .help-lead,
html.dark-mode .help-footnote {
  color: #a5b7cc;
}

html.dark-mode .settings-copy {
  color: #a5b7cc;
}

html.dark-mode .settings-panel {
  background: linear-gradient(180deg, #202c3b 0%, #1a2430 100%);
  border-color: #384b61;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

html.dark-mode .help-reset-btn {
  border-color: #45607d;
  background: linear-gradient(180deg, #253447 0%, #1e2b39 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  color: #d4e0ed;
}

html.dark-mode .help-reset-btn:hover {
  border-color: #6e95ba;
  background: linear-gradient(180deg, #2a3b4f 0%, #233244 100%);
  color: #eef5fd;
}

html.dark-mode .help-reset-btn-icon {
  color: #9fb5cc;
}

html.dark-mode .settings-control-card {
  background: linear-gradient(180deg, #202c3b 0%, #1b2532 100%);
  border-color: #384b61;
}

html.dark-mode .settings-control-label {
  color: #dbe7f4;
}

html.dark-mode .settings-control-caption {
  color: #9fb4cb;
}

html.dark-mode .settings-subsection + .settings-subsection {
  border-top-color: rgba(76, 97, 121, 0.9);
}

html.dark-mode .settings-subsection-title {
  color: #9fb4cb;
}

html.dark-mode .interface-mode-btn {
  box-shadow: none;
}

html.dark-mode .shortcut-row {
  background: linear-gradient(180deg, #202c3b 0%, #1b2532 100%);
  border-color: #384b61;
}

html.dark-mode .shortcut-label {
  color: #e3edf7;
}

html.dark-mode .shortcut-caption {
  color: #9fb4cb;
}

html.dark-mode .shortcut-key-btn {
  background: #13202f;
  border-color: #3e556d;
  color: #deebf8;
}

html.dark-mode .shortcut-key-btn:hover {
  background: #1a2b3d;
  border-color: #6a8eaf;
}

html.dark-mode .shortcut-key-btn.capturing {
  background: #6ea8d6;
  border-color: #6ea8d6;
  color: #112131;
  box-shadow: 0 0 0 3px rgba(110, 168, 214, 0.24);
}

html.dark-mode .help-modal-close {
  border-color: #43596f;
  background: #223143;
  color: #cfe0f3;
}

html.dark-mode .help-modal-close:hover {
  background: #2a3c52;
}

html.dark-mode .ticker-pill {
  background: #1b2533;
  border-color: #34465b;
}

html.dark-mode .ticker-pill:hover,
html.dark-mode .ticker-pill:focus {
  background: #223145;
}

html.dark-mode .ticker-pill.active {
  border-color: #6aa6d7;
  background: #294056;
  color: #ebf4ff;
}

html.dark-mode .ticker-pill-key-hint kbd {
  background: linear-gradient(180deg, #34465d 0%, #27364a 100%);
  border-color: #4d6280;
  box-shadow: 0 1px 0 #4d6280, inset 0 1px 0 rgba(255, 255, 255, 0.14);
  color: #e6f0fc;
}

html.dark-mode .ticker-pill.active .ticker-pill-key-hint kbd {
  background: linear-gradient(180deg, #4b7193 0%, #3a5d80 100%);
  border-color: #7cb4de;
  box-shadow: 0 1px 0 #7cb4de, inset 0 1px 0 rgba(255, 255, 255, 0.18);
  color: #f3f9ff;
}

html.dark-mode .ticker-fair {
  color: #b5c7dd;
}

html.dark-mode .folded-portfolio-group {
  background: #1b2533;
  border-color: #34465b;
}

html.dark-mode .folded-portfolio-pill {
  background: #16212e;
  border-color: #41546a;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

html.dark-mode .folded-portfolio-pill-name {
  color: #9db1c9;
}

html.dark-mode .folded-portfolio-pill-value {
  color: #e3edf8;
}

html.dark-mode .security-select-placeholder {
  border-color: #334456;
  background: radial-gradient(1200px 380px at 18% -15%, rgba(116, 162, 212, 0.16), transparent 68%), linear-gradient(165deg, #1d2736 0%, #151e2a 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

html.dark-mode .security-select-placeholder-inner,
html.dark-mode .security-select-placeholder-inner h2,
html.dark-mode .security-select-placeholder-inner p {
  color: #b8c9dd;
}

html.dark-mode .tender-card {
  background: #202f40;
  border-color: #395775;
}

html.dark-mode .tender-copy p {
  color: #bdd1e6;
}

html.dark-mode .widget-card:hover {
  border-color: #4a5e76;
}

html.dark-mode .widget-card.widget-floating {
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.5);
}

html.dark-mode .widget-width-handle::before,
html.dark-mode .widget-height-handle::before {
  background: #6e86a3;
}

html.dark-mode .dashboard-grid.widget-snap-active {
  outline-color: #627b99;
}

html.dark-mode .widget-card.widget-snap-before::before,
html.dark-mode .widget-card.widget-snap-after::after {
  background: #7aaad2;
}

html.dark-mode .place-order-ticker-btn:hover {
  background: #26364a;
  border-color: #4d6b8d;
}

html.dark-mode .place-order-ticker-btn.active {
  background: #2c4660;
  border-color: #6ea9d8;
  color: #ebf5ff;
}

html.dark-mode .order-inline-key-hint kbd {
  background: linear-gradient(180deg, #36495f 0%, #27374b 100%);
  border-color: #4f6683;
  box-shadow: 0 1px 0 #4f6683, inset 0 1px 0 rgba(255, 255, 255, 0.14);
  color: #d7e6f7;
}

html.dark-mode .contract-order-selector {
  background: linear-gradient(180deg, #243345 0%, #1f2d3f 100%);
  border-color: #40566d;
  color: #d4e2f0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

html.dark-mode .contract-order-selector:hover {
  background: linear-gradient(180deg, #2a3a4d 0%, #223246 100%);
  border-color: #54708f;
  color: #ebf5ff;
}

html.dark-mode .contract-order-selector.active {
  background: linear-gradient(180deg, #2c4660 0%, #243c53 100%);
  border-color: #6ea9d8;
  color: #ebf5ff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 0 0 1px rgba(110, 169, 216, 0.14);
}

html.dark-mode .contract-order-selector-key kbd {
  background: linear-gradient(180deg, #36495f 0%, #27374b 100%);
  border-color: #4f6683;
  box-shadow: 0 1px 0 #4f6683, inset 0 1px 0 rgba(255, 255, 255, 0.14);
  color: #d7e6f7;
}

html.dark-mode .contract-order-selector.active .contract-order-selector-key kbd {
  background: linear-gradient(180deg, #35567b 0%, #284461 100%);
  border-color: #6ea9d8;
  box-shadow: 0 1px 0 #6ea9d8, inset 0 1px 0 rgba(255, 255, 255, 0.14);
  color: #eef6ff;
}

html.dark-mode .order-inline-pane.buy-pane .order-inline-key-hint kbd {
  background: linear-gradient(180deg, #2f5a4a 0%, #224637 100%);
  border-color: #43816a;
  box-shadow: 0 1px 0 #43816a, inset 0 1px 0 rgba(255, 255, 255, 0.14);
  color: #b8f0d0;
}

html.dark-mode .order-inline-pane.sell-pane .order-inline-key-hint kbd {
  background: linear-gradient(180deg, #5f3d3d 0%, #4b2f2f 100%);
  border-color: #8b5959;
  box-shadow: 0 1px 0 #8b5959, inset 0 1px 0 rgba(255, 255, 255, 0.14);
  color: #f4cdca;
}

html.dark-mode .orders-cancel-all-key-hint kbd {
  background: linear-gradient(180deg, #5f3d3d 0%, #4b2f2f 100%);
  border-color: #8b5959;
  box-shadow: 0 1px 0 #8b5959, inset 0 1px 0 rgba(255, 255, 255, 0.14);
  color: #f4cdca;
}

html.dark-mode .order-inline-pane.buy-pane:focus-within {
  border-color: #4e9d78;
  border-left-color: var(--buy);
  background: linear-gradient(180deg, #253d34 0%, #1d3029 100%);
  box-shadow: 0 0 0 3px rgba(57, 184, 116, 0.24), 0 12px 24px rgba(0, 0, 0, 0.32);
}

html.dark-mode .order-inline-pane.buy-pane:focus-within strong {
  color: #97e2b9;
}

html.dark-mode .order-inline-pane.sell-pane:focus-within {
  border-color: #a46d69;
  border-left-color: var(--sell);
  background: linear-gradient(180deg, #442d31 0%, #352326 100%);
  box-shadow: 0 0 0 3px rgba(222, 106, 97, 0.24), 0 12px 24px rgba(0, 0, 0, 0.32);
}

html.dark-mode .order-inline-pane.sell-pane:focus-within strong {
  color: #f0b4af;
}

html.dark-mode .order-inline-input:focus {
  border-color: transparent;
  box-shadow: none;
}

html.dark-mode .order-inline-field {
  border-color: #4e6078;
  background: #1b2737;
}

html.dark-mode .order-inline-prefix {
  border-right-color: #4e6078;
  background: #233246;
  color: #cfe0f3;
}

html.dark-mode .order-inline-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(111, 178, 232, 0.28);
}

html.dark-mode .order-inline-input::placeholder {
  color: #8ca0b7;
}

html.dark-mode .ladder-row.ask td {
  background: #3a2529 !important;
}

html.dark-mode .ladder-row.bid td {
  background: #21312d !important;
}

html.dark-mode .ladder-table tbody tr + tr td {
  border-top: 1px solid rgba(88, 106, 128, 0.34) !important;
}

html.dark-mode .ladder-my-qty-inline {
  color: #b5cde6;
}

html.dark-mode .ladder-action-btn {
  border-color: #3f5167 !important;
}

html.dark-mode .ladder-action-btn.buy-signal {
  background: rgba(57, 184, 116, 0.22) !important;
  border-color: #4ea780 !important;
  color: #91e0b6 !important;
}

html.dark-mode .ladder-action-btn.sell-signal {
  background: rgba(222, 106, 97, 0.22) !important;
  border-color: #b67a75 !important;
  color: #f0b6b1 !important;
}

html.dark-mode .ladder-action-btn:hover:not(:disabled) {
  background: #2a3647 !important;
}

html.dark-mode .ladder-spread td {
  background: #1b2533 !important;
  color: #c5d5e7 !important;
}

html.dark-mode .chart-toggle {
  background: #1f2a39;
  border-color: #40546b;
}

html.dark-mode .chart-toggle.active {
  background: #2d4660;
  border-color: #6ea8d6;
}

html.dark-mode .admin-controls {
  color: #adbed3;
}

html.dark-mode .top-strip .progress-bar-shell {
  background: #1a2432;
}

html.dark-mode .progress-bar-shell .label {
  color: #dbe7f4 !important;
}

html.dark-mode .dashboard-card[data-widget-id="place-order"] .ui.mini.button:not(.red):not(.blue):not(.green),
html.dark-mode .dashboard-card[data-widget-id="old-orders"] .ui.mini.button:not(.red):not(.blue):not(.green) {
  background: #223144 !important;
  border: 1px solid #40556f !important;
  color: #d9e7f7 !important;
}

html.dark-mode .dashboard-card[data-widget-id="place-order"] .ui.mini.button:not(.red):not(.blue):not(.green):hover,
html.dark-mode .dashboard-card[data-widget-id="old-orders"] .ui.mini.button:not(.red):not(.blue):not(.green):hover {
  background: #2a3b52 !important;
}

html.dark-mode .top-strip.top-strip-condensed {
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
}

html.dark-mode .top-strip.top-strip-condensed .metric-box {
  background: #1d2938;
}

html.dark-mode .top-strip.top-strip-condensed .brand-mark {
  background: #1d2938;
}

html.dark-mode .top-strip.top-strip-condensed .top-strip-contract-nav {
  background: #1d2938;
  border-color: #3a4d64;
}

html.dark-mode .top-strip.top-strip-condensed .top-strip-contract-btn {
  color: #c7d8ea;
}

html.dark-mode .top-strip.top-strip-condensed .top-strip-contract-btn:hover {
  background: rgba(56, 77, 100, 0.68);
  color: #eef5fd;
}

html.dark-mode .top-strip.top-strip-condensed .top-strip-contract-btn.active {
  border-color: #6ea7d5;
  background: #2b4360;
  color: #ebf5ff;
  box-shadow: inset 0 0 0 1px rgba(110, 167, 213, 0.26);
}

html.dark-mode .top-strip.top-strip-condensed .top-strip-contract-price {
  color: #9eb4cc;
}

html.dark-mode .top-strip.top-strip-condensed .top-strip-contract-btn.active .top-strip-contract-price {
  color: #d8e8f8;
}

html.dark-mode .top-strip.top-strip-condensed .top-strip-contract-key kbd {
  background: linear-gradient(180deg, #36495f 0%, #27374b 100%);
  border-color: #4f6683;
  box-shadow: 0 1px 0 #4f6683, inset 0 1px 0 rgba(255, 255, 255, 0.14);
  color: #d7e6f7;
}

html.dark-mode .top-strip.top-strip-condensed .top-strip-contract-btn.active .top-strip-contract-key kbd {
  background: linear-gradient(180deg, #35567b 0%, #284461 100%);
  border-color: #6ea9d8;
  box-shadow: 0 1px 0 #6ea9d8, inset 0 1px 0 rgba(255, 255, 255, 0.14);
  color: #eef6ff;
}

html.dark-mode .top-strip.top-strip-condensed .top-strip-contract-divider {
  background: rgba(117, 143, 172, 0.54);
}

html.dark-mode .top-strip.top-strip-condensed .metric-box::before {
  color: #90a5bf;
}

html.dark-mode .top-strip.top-strip-condensed .ticker-pill {
  border-color: #3a4d64;
  background: #1a2737;
}

html.dark-mode .top-strip.top-strip-condensed .folded-portfolio-group {
  background: #1c2938;
}

html.dark-mode .top-strip.top-strip-condensed .folded-portfolio-pill {
  background: #172230;
  border-color: #405267;
}

html.dark-mode .top-strip.top-strip-condensed .ticker-pill.active {
  border-color: #6ea7d5;
  background: #2b4360;
  color: #ebf5ff;
  box-shadow: inset 0 0 0 1px rgba(110, 167, 213, 0.28);
}

@media (max-width: 1200px) {
  .card-span-3 {
    flex-basis: calc(50% - 6px);
    max-width: calc(50% - 6px);
  }

  .card-span-4 {
    flex-basis: calc(50% - 6px);
    max-width: calc(50% - 6px);
  }

  .card-span-5 {
    flex-basis: calc(50% - 6px);
    max-width: calc(50% - 6px);
  }

  .card-span-8 {
    flex-basis: 100%;
    max-width: 100%;
  }

  .card-span-6 {
    flex-basis: calc(50% - 6px);
    max-width: calc(50% - 6px);
  }

  .card-span-12 {
    flex-basis: 100%;
    max-width: 100%;
  }
}

@media (max-width: 980px) {
  .top-strip {
    top: 8px;
  }

  .top-strip.top-strip-floating {
    top: 8px;
  }

  .top-strip-main {
    flex-direction: column;
    align-items: flex-start;
  }

  .top-strip-right {
    width: 100%;
    flex-wrap: wrap;
    align-items: center;
  }

  .metric-box {
    flex: 1;
  }

  .top-strip-toggle-wrap {
    width: 100%;
  }

  .top-strip-layout-wrap {
    width: 100%;
  }

  .top-strip-help-wrap {
    margin-left: auto;
  }

  .top-strip-folded-portfolio {
    grid-template-columns: minmax(0, 1fr);
  }

  .card-span-4,
  .card-span-3,
  .card-span-5,
  .card-span-6,
  .card-span-8,
  .card-span-12 {
    flex-basis: 100%;
    max-width: 100%;
  }

  .dashboard-grid .widget-card {
    flex-basis: 100% !important;
    max-width: 100% !important;
  }

  .dashboard-card[data-widget-id="portfolio"][data-widget-docked="1"]:not([data-widget-height]) {
    height: auto;
    overflow: visible;
  }

  .dashboard-card[data-widget-id="place-order"][data-widget-docked="1"]:not([data-widget-height]) {
    height: auto;
    overflow: visible;
  }

  .dashboard-card[data-widget-id="place-order"][data-widget-docked="1"] {
    overflow: visible;
  }

  .orders-widget-body {
    overflow: visible;
    padding-bottom: 0;
  }

  .dashboard-card[data-widget-id="portfolio"] .portfolio-filled-orders-table {
    max-height: 260px;
  }

  .widget-card.widget-floating {
    position: static;
    resize: none;
    overflow: visible;
    left: auto !important;
    top: auto !important;
    width: auto !important;
    height: auto !important;
    z-index: auto !important;
    min-width: 0;
    min-height: 0;
    max-width: none;
    max-height: none;
    box-shadow: var(--shadow);
  }

  .widget-width-handle {
    display: none;
  }

  .widget-height-handle {
    display: none;
  }
}

@media (max-width: 760px) {
  :root {
    --shell-padding: 10px;
  }

  .config-grid,
  .holding-grid {
    grid-template-columns: 1fr;
  }

  .tender-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .tender-actions {
    width: 100%;
  }

  .tender-actions .button {
    flex: 1;
  }

  .folded-portfolio-pill {
    width: 100%;
    justify-content: space-between;
  }

  .help-modal-overlay {
    padding: 10px;
  }

  .help-modal-panel {
    width: calc(100vw - 20px);
    max-height: 88vh;
  }

  .help-modal-head,
  .help-modal-body {
    padding-left: 12px;
    padding-right: 12px;
  }

  .help-screen-switch {
    flex-wrap: wrap;
  }

  .shortcut-section-head {
    flex-direction: column;
    align-items: stretch;
  }

  .settings-section-head {
    flex-direction: column;
    align-items: stretch;
  }

  .settings-control-grid {
    grid-template-columns: 1fr;
  }

  .settings-control-card-wide {
    grid-column: auto;
  }

  .settings-control-card {
    flex-direction: column;
    align-items: stretch;
  }

  .shortcut-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .shortcut-key-btn,
  .help-reset-btn,
  .interface-mode-btn {
    width: 100%;
  }

  .interface-mode-toggle {
    grid-template-columns: 1fr;
  }
}
