:root {
  --bg: #eef1f5;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --border: #d8dee8;
  --text: #1d2430;
  --muted: #6a7484;
  --accent: #0f5f9a;
  --accent-gold: #f2c14e;
  --accent-gold-strong: #d89b16;
  --accent-red: #d04b42;
  --display-font: "Teko", "Barlow", sans-serif;
  --buy: #1f8c4d;
  --sell: #c5473b;
  --shadow: 0 2px 10px rgba(17, 29, 49, 0.06);
  --radius: 8px;
  --shell-max-width: 1248px;
  --shell-padding: 11px;
  --dashboard-panel-max-width: 981px;
  --kalshi-left-panel-width: 281px;
  --kalshi-middle-panel-width: 439px;
  --kalshi-right-panel-width: 351px;
  --kalshi-dashboard-max-width: 1087px;
  --trade-panels-min-height: 557px;
  --ladder-visible-levels: 17;
  --ladder-row-height: 19px;
}

html.dark-mode,
body.dark-mode {
  --bg: #1a1d24;
  --surface: #212834;
  --surface-soft: #273140;
  --border: #3c495d;
  --text: #e3ecf7;
  --muted: #9babc1;
  --accent: #6fb2e8;
  --accent-gold: #ffd36a;
  --accent-gold-strong: #ffb938;
  --accent-red: #e7776f;
  --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;
}

.mango-body.exchange-theme {
  position: relative;
  background: #edf1f5;
}

.mango-body.exchange-theme::before,
.mango-body.exchange-theme::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.mango-body.exchange-theme::before {
  background: url("../assets/big-battlefield.png") center / cover no-repeat;
  filter: grayscale(0) saturate(0.52) brightness(1.12);
  transform: scale(1.02);
  z-index: 0;
}

.mango-body.exchange-theme::after {
  background:
    linear-gradient(180deg, rgba(244, 247, 251, 0.62) 0%, rgba(238, 242, 247, 0.52) 100%),
    radial-gradient(circle at top, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0) 48%),
    radial-gradient(circle at 14% 14%, rgba(242, 193, 78, 0.1) 0%, rgba(242, 193, 78, 0) 28%),
    radial-gradient(circle at 86% 18%, rgba(208, 75, 66, 0.08) 0%, rgba(208, 75, 66, 0) 24%);
  z-index: 0;
}

.mango-body.exchange-theme > *:not(.warning-toast):not(.inactive-indicator):not(.fill-toast-stack) {
  position: relative;
  z-index: 1;
}

.mango-body.exchange-theme .top-strip,
.mango-body.exchange-theme .dashboard-card,
.mango-body.exchange-theme .table-wrap,
.mango-body.exchange-theme .security-select-placeholder,
.mango-body.exchange-theme .tender-card,
.mango-body.exchange-theme .empty-state {
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.mango-body.exchange-theme .top-strip {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(216, 155, 22, 0.26);
  box-shadow:
    0 14px 34px rgba(21, 31, 46, 0.1),
    0 0 0 1px rgba(242, 193, 78, 0.12) inset;
}

.mango-body.exchange-theme .brand-mark,
.mango-body.exchange-theme .metric-box,
.mango-body.exchange-theme .sponsor-box,
.mango-body.exchange-theme .ticker-pill,
.mango-body.exchange-theme .sticky-toggle,
.mango-body.exchange-theme .theme-toggle,
.mango-body.exchange-theme .top-strip-layout-btn,
.mango-body.exchange-theme .top-strip-help-btn {
  background: rgba(247, 249, 252, 0.72);
}

.mango-body.exchange-theme .brand-mark {
  background: transparent;
  border: none;
}

.mango-body.exchange-theme .dashboard-card {
  background: rgba(255, 255, 255, 0.74);
  border-color: rgba(216, 155, 22, 0.24);
}

.mango-body.exchange-theme .table-wrap {
  background: rgba(255, 255, 255, 0.62);
}

.mango-body.exchange-theme .panel-table thead th {
  background: rgba(247, 249, 252, 0.86) !important;
}

.mango-body.exchange-theme .panel-table tbody td {
  background: rgba(255, 255, 255, 0.46) !important;
}

.mango-body.exchange-theme .security-select-placeholder {
  background:
    radial-gradient(1200px 380px at 18% -15%, rgba(120, 138, 160, 0.08), transparent 68%),
    rgba(237, 241, 246, 0.68);
}

.mango-body.exchange-theme .tender-card {
  background: rgba(238, 246, 255, 0.78);
}

.mango-body.exchange-theme .order-inline-pane {
  background: rgba(247, 249, 252, 0.68);
}

.mango-body.exchange-theme .empty-state {
  background: rgba(247, 249, 252, 0.64);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
  color-scheme: light;
  background:
    linear-gradient(180deg, rgba(255, 248, 233, 0.26) 0%, rgba(255, 242, 210, 0.54) 100%),
    radial-gradient(circle at 50% 50%, rgba(255, 224, 122, 0.2) 0%, rgba(255, 224, 122, 0) 42%),
    url("../assets/character-select.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.login-shell::before,
.login-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.login-shell::before {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 250, 239, 0.34) 100%);
}

.login-shell::after {
  background:
    linear-gradient(180deg, rgba(255, 251, 242, 0.2) 0%, rgba(255, 251, 242, 0.06) 24%, rgba(255, 247, 228, 0.06) 76%, rgba(214, 174, 92, 0.18) 100%);
}

body.dark-mode .login-shell {
  background:
    linear-gradient(180deg, rgba(255, 248, 233, 0.26) 0%, rgba(255, 242, 210, 0.54) 100%),
    radial-gradient(circle at 50% 50%, rgba(255, 224, 122, 0.2) 0%, rgba(255, 224, 122, 0) 42%),
    url("../assets/character-select.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.login-card {
  width: 100%;
  max-width: 460px;
  position: relative;
  z-index: 1;
  background: linear-gradient(180deg, rgba(255, 251, 242, 0.96) 0%, rgba(248, 241, 227, 0.98) 100%);
  border: 1px solid rgba(207, 166, 65, 0.38);
  border-radius: 18px;
  box-shadow:
    0 22px 60px rgba(78, 57, 15, 0.2),
    0 0 0 1px rgba(255, 255, 255, 0.55) inset;
  padding: 28px;
  color: #2f2618;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.5), transparent 42%),
    radial-gradient(circle at top right, rgba(255, 212, 126, 0.24), transparent 32%);
  pointer-events: none;
}

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

.login-brand-title {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
}

.login-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  margin-bottom: 14px;
  border-radius: 999px;
  border: 1px solid rgba(215, 166, 49, 0.36);
  background: rgba(255, 212, 102, 0.18);
  color: #835400;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.login-brand-ball {
  width: 74px;
  height: 74px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 0 18px rgba(255, 217, 92, 0.42));
}

.login-brand-copy {
  min-width: 0;
}

.login-brand h1 {
  font-size: clamp(2rem, 4vw, 2.5rem);
  font-weight: 700;
  line-height: 0.98;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #332101;
}

.login-brand-meta {
  color: #5c6677;
  font-size: 0.95rem;
}

.login-sponsor-row {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(207, 166, 65, 0.22);
  box-shadow: 0 6px 16px rgba(72, 53, 13, 0.08);
}

.login-sponsor-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #687385;
}

.login-sponsor-logo {
  display: block;
  width: 104px;
  height: auto;
}

.login-card .ui.form .field > label {
  color: #755305 !important;
  font-size: 0.82rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.login-card .ui.form input[type="text"],
.login-card .ui.form input[type="password"] {
  background: rgba(255, 255, 255, 0.92) !important;
  border: 1px solid rgba(195, 153, 57, 0.28) !important;
  color: #342611 !important;
  border-radius: 10px !important;
  min-height: 48px !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.74),
    0 1px 2px rgba(78, 57, 15, 0.08);
}

.login-card .ui.form input[type="text"]::placeholder,
.login-card .ui.form input[type="password"]::placeholder {
  color: #8c96a6 !important;
}

.login-card .ui.form input[type="text"]:focus,
.login-card .ui.form input[type="password"]:focus {
  border-color: rgba(214, 160, 33, 0.72) !important;
  box-shadow: 0 0 0 3px rgba(255, 208, 97, 0.22) !important;
}

.login-card .login-submit-btn.ui.button {
  margin-top: 8px;
  min-height: 50px;
  border-radius: 12px !important;
  background: linear-gradient(180deg, #ffcf4e 0%, #ff9f1f 100%) !important;
  border: 1px solid #ffcb53 !important;
  color: #261300 !important;
  font-size: 1rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow:
    0 10px 26px rgba(255, 166, 31, 0.28),
    inset 0 1px 0 rgba(255, 248, 214, 0.7);
}

.login-card .login-submit-btn.ui.button:hover,
.login-card .login-submit-btn.ui.button:focus {
  background: linear-gradient(180deg, #ffd868 0%, #ffab33 100%) !important;
  border-color: #ffd15e !important;
  color: #261300 !important;
}

.login-card .login-submit-btn.ui.button:active {
  background: linear-gradient(180deg, #f7c23f 0%, #fb9813 100%) !important;
  border-color: #efbc47 !important;
  color: #261300 !important;
}

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

.top-strip {
  --top-strip-pane-height: 30px;
  position: static;
  top: auto;
  z-index: 90;
  display: grid;
  gap: 6px;
  padding: 8px 11px 6px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  border-left-width: 5px;
  transition: 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: 11px;
}

.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-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  color: #2b4560;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 0;
  font-weight: 700;
  letter-spacing: 0.01em;
  min-width: 0;
}

.brand-mark-logo,
.brand-mark-ball {
  display: block;
  object-fit: contain;
  object-position: 50% 50%;
  flex-shrink: 0;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.brand-mark-ball {
  width: 44px;
  height: 44px;
  filter: drop-shadow(0 4px 12px rgba(255, 203, 80, 0.28));
}

.brand-mark-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.brand-mark-title {
  font-family: var(--display-font);
  font-size: 1.36rem;
  line-height: 0.92;
  color: #20394f;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.brand-mark-status {
  color: var(--muted);
  font-size: 0.61rem;
  line-height: 1.2;
}

.top-strip-summary {
  display: flex;
  gap: 10px;
  align-items: stretch;
  justify-content: center;
  flex: 0 0 auto;
}

.top-strip-sponsor {
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.sponsor-box {
  min-width: 62px;
  min-height: var(--top-strip-pane-height);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
}

.sponsor-box-logo {
  display: block;
  width: 45px;
  max-width: 100%;
  height: auto;
}

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

.metric-box.metric-box-primary {
  min-width: 78px;
  padding: 4px 7px;
}

.metric-box.metric-box-primary .metric-label {
  font-size: 0.43rem;
}

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

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

.metric-box.metric-box-primary .metric-value {
  font-size: 0.65rem;
}

.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-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-body {
  margin-top: 3px;
  font-size: 0.9rem;
  line-height: 1.35;
  word-break: break-word;
}

.inactive-indicator {
  position: fixed;
  left: var(--shell-padding);
  bottom: var(--shell-padding);
  z-index: 142;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid #e4c88b;
  border-left: 4px solid #c4861b;
  border-radius: 10px;
  background: #fff7e8;
  color: #6b4a15;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: 0 10px 22px rgba(25, 38, 58, 0.18);
  pointer-events: none;
}

.inactive-indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c4861b;
  box-shadow: 0 0 0 3px rgba(196, 134, 27, 0.18);
  animation: inactive-indicator-pulse 1.6s ease-in-out infinite;
}

.inactive-indicator.inactive-indicator-down {
  border-color: #e7b0a8;
  border-left-color: #c0392b;
  background: #fdecea;
  color: #7a2a1e;
}

.inactive-indicator.inactive-indicator-down .inactive-indicator-dot {
  background: #c0392b;
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.18);
}

@keyframes inactive-indicator-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.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(760px, 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.16rem;
  font-weight: 700;
  color: #1f344a;
}

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

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

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

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

.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;
}

.ticker-strip {
  margin-top: 0;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  padding-top: 4px;
}

.ticker-strip-label {
  display: inline-flex;
  align-items: center;
  margin-right: 4px;
  color: var(--muted);
  font-family: var(--display-font);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
}

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

.ticker-pill.active {
  border-color: var(--accent-gold-strong);
  background: linear-gradient(180deg, #fff8df 0%, #f6ebc4 100%);
  color: #5b4010;
  box-shadow: inset 0 0 0 1px rgba(216, 155, 22, 0.16);
}

.ticker-pill:hover {
  border-color: rgba(216, 155, 22, 0.44);
  transform: translateY(-1px);
}

.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;
  letter-spacing: 0.02em;
}

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

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

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

@media (min-width: 981px) {
  .top-strip:not(.top-strip-condensed) {
    grid-template-columns: minmax(0, 1fr) auto auto;
    column-gap: 14px;
    align-items: stretch;
  }

  .top-strip:not(.top-strip-condensed) .top-strip-main {
    display: contents;
  }

  .top-strip:not(.top-strip-condensed) .top-strip-brand {
    grid-column: 1;
    grid-row: 1;
  }

  .top-strip:not(.top-strip-condensed) .top-strip-summary {
    grid-column: 2;
    grid-row: 1;
    height: 100%;
  }

  .top-strip:not(.top-strip-condensed) .top-strip-sponsor {
    grid-column: 3;
    grid-row: 1;
    height: 100%;
  }

  .top-strip:not(.top-strip-condensed) .ticker-strip {
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
    width: fit-content;
    max-width: 100%;
    padding-right: 10px;
  }

  .top-strip:not(.top-strip-condensed) .top-strip-progress {
    grid-column: 1 / -1;
  }

  .top-strip:not(.top-strip-condensed) .metric-box.metric-box-primary {
    min-width: 120px;
    padding: 6px 11px;
    height: 100%;
  }

  .top-strip:not(.top-strip-condensed) .metric-box.metric-box-primary .metric-value {
    font-size: 0.94rem;
  }

  .top-strip:not(.top-strip-condensed) .sponsor-box {
    min-width: 109px;
    padding: 4px 11px;
    height: 100%;
  }

  .top-strip:not(.top-strip-condensed) .sponsor-box-logo {
    width: 78px;
  }
}

.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: 100px;
  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-help-btn {
  min-width: 78px;
  min-height: 34px;
  height: auto;
  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: 6px;
  padding: 4px 12px;
  line-height: 1;
  white-space: nowrap;
}

.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: 0.74rem;
}

.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: 8px;
  min-height: 40vh;
  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: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  align-content: flex-start;
  gap: 8px;
}

@media (min-width: 981px) {
  .top-strip.kalshi-top-strip {
    max-width: var(--kalshi-dashboard-max-width);
  }

  .top-strip.kalshi-top-strip.top-strip-floating {
    max-width: var(--kalshi-dashboard-max-width);
  }

  .top-strip {
    width: 100%;
    max-width: var(--dashboard-panel-max-width);
    margin-left: auto;
    margin-right: auto;
  }

  .top-strip.top-strip-floating {
    width: calc(100% - (2 * var(--shell-padding)));
    max-width: var(--dashboard-panel-max-width);
  }

  .dashboard-grid {
    width: 100%;
    max-width: var(--dashboard-panel-max-width);
    margin-left: auto;
    margin-right: auto;
  }

  .dashboard-grid.kalshi-dashboard-grid {
    max-width: var(--kalshi-dashboard-max-width);
    justify-content: center;
  }

  .dashboard-grid.kalshi-dashboard-grid > .market-info-panel,
  .dashboard-grid.kalshi-dashboard-grid > .kalshi-place-order-panel,
  .dashboard-grid.kalshi-dashboard-grid > .kalshi-ladder-panel {
    flex-grow: 0;
    flex-shrink: 0;
  }

  .dashboard-grid.kalshi-dashboard-grid > .market-info-panel {
    flex-basis: var(--kalshi-left-panel-width);
    max-width: var(--kalshi-left-panel-width);
  }

  .dashboard-grid.kalshi-dashboard-grid > .kalshi-place-order-panel {
    flex-basis: var(--kalshi-middle-panel-width);
    max-width: var(--kalshi-middle-panel-width);
  }

  .dashboard-grid.kalshi-dashboard-grid > .kalshi-ladder-panel {
    flex-basis: var(--kalshi-right-panel-width);
    max-width: var(--kalshi-right-panel-width);
  }
}

.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: 6px;
  min-width: 0;
}

.market-info-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: var(--trade-panels-min-height);
  overflow: hidden;
}

.dashboard-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(242, 193, 78, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(208, 75, 66, 0.08), transparent 26%);
  opacity: 0.8;
}

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

.widget-card:hover {
  border-color: rgba(216, 155, 22, 0.5);
  box-shadow: 0 16px 34px rgba(21, 31, 46, 0.14);
  transform: translateY(-2px);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

/* Top-bar button that opens the full leaderboard page. */
.top-strip-leaderboard-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  min-height: 34px;
  padding: 4px 12px;
  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);
  cursor: pointer;
  font-family: "Barlow", sans-serif;
  line-height: 1.05;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

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

.top-strip-leaderboard-btn.active {
  background: #c4861b;
  color: #fff;
  border-color: #c4861b;
}

.top-strip-leaderboard-btn-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1;
}

.top-strip-leaderboard-btn-meta {
  font-size: 0.56rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  line-height: 1;
}

.top-strip-leaderboard-btn.active .top-strip-leaderboard-btn-meta {
  color: rgba(255, 255, 255, 0.85);
}

html.dark-mode .top-strip-leaderboard-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-leaderboard-btn:hover {
  background: linear-gradient(180deg, #2a3d57 0%, #1f3045 100%);
  border-color: #557090;
  color: #e1ebf8;
}

.top-strip.top-strip-condensed .top-strip-leaderboard-btn-meta {
  display: none;
}

/* Full leaderboard page (sibling to .dashboard-grid). */
.leaderboard-page {
  padding: 24px clamp(16px, 3vw, 40px) 40px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.leaderboard-page-head {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.leaderboard-page-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  color: #fff;
  background: #1f6feb;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(31, 111, 235, 0.25);
  transition: background-color 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
}

.leaderboard-page-back:hover {
  background: #1a5fcf;
  box-shadow: 0 3px 10px rgba(31, 111, 235, 0.35);
}

.leaderboard-page-back:active {
  transform: translateY(1px);
}

.leaderboard-page-back i.icon {
  margin: 0 !important;
}

.leaderboard-page-title h1 {
  font-family: var(--display-font);
  font-size: 1.8rem;
  margin: 0 0 4px;
}

.leaderboard-page-title p {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

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

.leaderboard-page-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.leaderboard-page-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.leaderboard-page-card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-soft);
}

.leaderboard-page-card-head h2 {
  font-family: var(--display-font);
  font-size: 1.1rem;
  margin: 0 0 2px;
}

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

.leaderboard-page-card .table-wrap {
  /* Cap at ~10 rows of the very compact panel-table; matches .compact-table elsewhere. */
  max-height: 240px;
}

.leaderboard-page-table {
  width: 100%;
  margin: 0 !important;
}

.leaderboard-page-table .leaderboard-page-sum {
  font-weight: 700;
  border-right: 1px solid var(--border);
}

.leaderboard-page-table .leaderboard-page-round {
  font-family: "IBM Plex Mono", monospace;
  color: var(--muted);
  white-space: nowrap;
}

.leaderboard-page-table .leaderboard-page-round.positive {
  color: #1f8c4d;
}

.leaderboard-page-table .leaderboard-page-round.negative {
  color: #bb3b2f;
}

.leaderboard-page-table .leaderboard-page-missing {
  color: var(--muted);
  opacity: 0.5;
}

/* Practice rounds display on the board but don't count toward totals;
   de-emphasise the cell and header so the graded R1/R2/... cells stand out. */
.leaderboard-page-table .leaderboard-page-practice {
  background: rgba(128, 128, 128, 0.08);
  font-style: italic;
}

.leaderboard-page-table thead th.leaderboard-page-practice {
  color: var(--muted);
}

html.dark-mode .leaderboard-page-table .leaderboard-page-practice {
  background: rgba(200, 215, 232, 0.06);
}

.leaderboard-page-table tbody tr.positive .leaderboard-page-sum {
  color: #1f8c4d;
}

.leaderboard-page-table tbody tr.negative .leaderboard-page-sum {
  color: #bb3b2f;
}

.leaderboard-page-table tbody tr.leaderboard-page-self td {
  background: rgba(196, 134, 27, 0.12);
  font-weight: 700;
}

html.dark-mode .leaderboard-page-table tbody tr.positive .leaderboard-page-sum {
  color: #5fd08a;
}

html.dark-mode .leaderboard-page-table tbody tr.negative .leaderboard-page-sum {
  color: #e67365;
}

html.dark-mode .leaderboard-page-table .leaderboard-page-round.positive {
  color: #5fd08a;
}

html.dark-mode .leaderboard-page-table .leaderboard-page-round.negative {
  color: #e67365;
}

html.dark-mode .leaderboard-page-table tbody tr.leaderboard-page-self td {
  background: rgba(242, 193, 78, 0.14);
}

.card-head h3 {
  font-family: var(--display-font);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 0.95;
  text-transform: uppercase;
}

.card-head span {
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.section-title {
  margin-top: 6px;
  margin-bottom: 4px;
  font-family: var(--display-font);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

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

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

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

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

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

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

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

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

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

.table-wrap.ladder-scroll {
  height: calc((var(--ladder-visible-levels) + 2) * var(--ladder-row-height));
  overflow-y: auto;
}

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

.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 {
  flex: 0 0 calc((var(--ladder-visible-levels) + 2) * var(--ladder-row-height));
  min-height: calc((var(--ladder-visible-levels) + 2) * var(--ladder-row-height));
  height: calc((var(--ladder-visible-levels) + 2) * var(--ladder-row-height));
}

.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"] .config-grid .field-block {
  margin-bottom: 0;
}

.dashboard-card[data-widget-id="ladder"] .config-grid .field-block label {
  font-size: 1.08rem;
  margin-bottom: 6px;
}

.dashboard-card[data-widget-id="ladder"] .config-grid .field-block input {
  height: 36px;
  font-size: 1.06rem;
  padding: 4px 8px;
}

.dashboard-card[data-widget-id="ladder"] {
  min-height: var(--trade-panels-min-height);
}

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

.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="place-order"] .panel-table {
  width: 100% !important;
}

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

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

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

.dashboard-card[data-widget-id="place-order"] {
  min-height: var(--trade-panels-min-height);
}

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

.dashboard-card[data-widget-id="place-order"] > .portfolio-section-title {
  font-size: 0.80rem;
}

.dashboard-card[data-widget-id="place-order"] .portfolio-positions-table {
  max-height: 128px;
}

.dashboard-card[data-widget-id="place-order"] .portfolio-positions-table .panel-table {
  font-size: 0.53rem;
}

.dashboard-card[data-widget-id="place-order"] .portfolio-positions-table .panel-table th {
  font-size: 0.8rem;
}

.dashboard-card[data-widget-id="place-order"] .portfolio-positions-table .panel-table tbody td:first-child {
  font-size: 0.64rem;
}

.dashboard-card[data-widget-id="place-order"] .portfolio-positions-table .panel-table tbody td.text-right {
  font-size: 0.8rem;
}

.dashboard-card[data-widget-id="place-order"] .portfolio-positions-table .panel-table th,
.dashboard-card[data-widget-id="place-order"] .portfolio-positions-table .panel-table td {
  padding: 0.24rem 0.28rem !important;
}

.dashboard-card[data-widget-id="place-order"] .portfolio-open-orders-table .panel-table,
.dashboard-card[data-widget-id="place-order"] .portfolio-filled-orders-table .panel-table {
  font-size: 0.67rem;
}

.dashboard-card[data-widget-id="place-order"] .portfolio-open-orders-table .panel-table th,
.dashboard-card[data-widget-id="place-order"] .portfolio-open-orders-table .panel-table td,
.dashboard-card[data-widget-id="place-order"] .portfolio-filled-orders-table .panel-table th,
.dashboard-card[data-widget-id="place-order"] .portfolio-filled-orders-table .panel-table td {
  padding: 0.18rem 0.22rem !important;
}

.dashboard-card[data-widget-id="place-order"] .portfolio-open-orders-table .ui.mini.button {
  font-size: 0.56rem !important;
  padding: 2px 4px !important;
  min-height: 0 !important;
}

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

.dashboard-card[data-widget-id="place-order"] .portfolio-orders-row {
  display: flex;
  flex: 1 1 0;
  gap: 5px;
  min-height: 0;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid rgba(216, 155, 22, 0.22);
  overflow: hidden;
}

.dashboard-card[data-widget-id="place-order"] .portfolio-open-orders-section,
.dashboard-card[data-widget-id="place-order"] .portfolio-filled-orders-section {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

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

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

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

.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 {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

.portfolio-subhead {
  margin-top: 6px;
  margin-bottom: 4px;
  align-items: center;
}

.portfolio-subhead .portfolio-section-title {
  margin: 0;
}

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

.empty-row {
  text-align: center !important;
  color: var(--muted);
  padding: 16px !important;
  font-size: 2em;
  font-weight: 500;
}

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

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

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

.field-block input,
.field-block select,
.quickbook-input,
.config-grid input {
  width: 100%;
  height: 18px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  padding: 2px 4px;
  color: var(--text);
  font-size: 0.53rem;
}

.place-order-layout {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: flex-start;
  flex-direction: row;
  flex-wrap: nowrap;
  width: 100%;
}

.place-order-security-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  align-items: stretch;
  width: 91px;
}

.place-order-ticker-btn {
  display: block;
  width: 100%;
  min-width: 82px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.59rem;
  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: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
  margin-left: 0;
  min-width: 0;
  width: fit-content;
  max-width: 100%;
}

.place-order-contract-img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  flex-shrink: 0;
}

.order-inline-pane {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 4px 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  border-left: 3px 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 {
  min-height: 21px;
  padding: 3px 7px;
  font-size: 0.58rem;
  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 {
  margin-right: 2px;
}

.order-inline-key-hint kbd {
  display: inline-block;
  min-width: 12px;
  padding: 2px 4px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.64rem;
  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;
}

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


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

.order-inline-prefix {
  width: 14px;
  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.54rem;
  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;
}

@container (max-width: 320px) {
  .place-order-layout {
    flex-direction: column;
  }

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

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

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

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

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

.ladder-table th,
.ladder-table td {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  height: var(--ladder-row-height);
  padding: 0.15rem 0.2rem !important;
}

.ladder-row {
  cursor: default;
}

.mango-body.exchange-theme .ladder-table .ladder-row.ask td {
  background: #f6e8e8 !important;
}

.mango-body.exchange-theme .ladder-table .ladder-row.bid td {
  background: #e7f3e8 !important;
}

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

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

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

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

.ladder-action-btn {
  min-width: 40px;
  padding-left: 8px !important;
  padding-right: 8px !important;
  border-width: 1px !important;
  border-style: solid !important;
  border-color: #cfd8e3 !important;
  font-size: 0.5rem !important;
  line-height: 1.1 !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: 6px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.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 {
  height: 384px;
  width: 100%;
}

.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: 276px;
  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;
}

.case-status-banner {
  margin-top: 0;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #f9fbfe;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
  text-align: center;
}

.case-status-banner.case-status-down {
  border-color: #e0b4b4;
  background: #fff6f6;
  color: #9f3a38;
}

.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: 6px;
  background: #f7fafc;
}

.top-strip.top-strip-condensed .brand-mark-logo {
  width: 20px;
  height: 20px;
}

.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-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.metric-box-primary {
  min-width: 105px;
  padding: 0 8px;
}

.top-strip.top-strip-condensed .sponsor-box {
  min-width: 77px;
  min-height: 0;
  height: var(--top-strip-condensed-pane-height, 30px);
  padding: 0 7px;
  border-radius: 999px;
  background: #f7fafc;
}

.top-strip.top-strip-condensed .sponsor-box-logo {
  width: 50px;
}

.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-label {
  display: none;
}

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

.top-strip.top-strip-condensed .metric-box.metric-box-primary .metric-value {
  font-size: 0.66rem;
}

.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-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;
}

/* Kalshi-style "Winner" market view */

.kalshi-category-pill {
  font-weight: 700 !important;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.8rem !important;
  padding: 6px 14px !important;
  min-height: 32px;
  min-width: 77px;
  justify-content: center;
  box-shadow: 0 2px 0 rgba(25, 38, 58, 0.06);
}

.kalshi-category-pill:hover { border-color: #7db2da; background: #f2f8fd; }
.kalshi-category-pill.active {
  border-color: #60a5fa;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  color: #f1f5f9;
  box-shadow:
    0 4px 16px rgba(15, 23, 42, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.kalshi-category-pill.active .ticker-name {
  color: #f1f5f9;
}
.kalshi-category-pill.active:hover {
  border-color: #93c5fd;
  background: linear-gradient(180deg, #243447 0%, #131c2e 100%);
}

.mango-body.exchange-theme .kalshi-category-pill.active {
  border-color: #60a5fa;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  color: #f1f5f9;
  box-shadow:
    0 4px 16px rgba(15, 23, 42, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.mango-body.exchange-theme .kalshi-category-pill.active .ticker-name {
  color: #f1f5f9;
}
.mango-body.exchange-theme .kalshi-category-pill.active:hover {
  border-color: #93c5fd;
  background: linear-gradient(180deg, #243447 0%, #131c2e 100%);
}

.ticker-strip-divider {
  width: 1px;
  align-self: stretch;
  margin: 4px 2px;
  background: var(--border);
  flex-shrink: 0;
}

.kalshi-market { margin-top: 10px; }

.market-info-panel-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.market-info-panel-description {
  margin: 0;
  color: #56677a;
  font-size: 0.74rem;
  line-height: 1.4;
}

.market-info-panel-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  margin-top: 10px;
}

.market-info-panel-label {
  margin-bottom: 6px;
  color: var(--muted);
  font-family: var(--display-font);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.kalshi-market-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.kalshi-market-question {
  font-family: var(--display-font);
  font-size: clamp(1.8rem, 2.8vw, 2.2rem);
  font-weight: 600;
  color: var(--text);
  margin: 0;
  line-height: 0.96;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.market-info-panel .kalshi-market-question {
  font-size: clamp(1.2rem, 1.6vw, 1.52rem);
}

.kalshi-market-tooltip-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.kalshi-market-tooltip {
  width: 19px;
  height: 19px;
  border-radius: 999px;
  border: 1px solid rgba(216, 155, 22, 0.34);
  background: rgba(255, 248, 223, 0.78);
  color: #7a5713;
  font-family: var(--display-font);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
  cursor: help;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kalshi-market-tooltip-bubble {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: min(420px, calc(100vw - 32px));
  padding: 10px 11px;
  border: 1px solid rgba(216, 155, 22, 0.34);
  border-radius: 10px;
  background: rgba(255, 248, 223, 0.98);
  color: #4d3810;
  font-size: 0.76rem;
  line-height: 1.4;
  box-shadow: 0 12px 28px rgba(17, 29, 49, 0.14);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.14s ease, visibility 0.14s ease, transform 0.14s ease;
  z-index: 5;
}

.kalshi-market-tooltip-wrap:hover .kalshi-market-tooltip-bubble,
.kalshi-market-tooltip-wrap:focus-within .kalshi-market-tooltip-bubble {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.kalshi-characters-panel {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}

.market-info-panel .kalshi-characters-panel {
  flex: 1 1 auto;
  flex-direction: column;
  flex-wrap: nowrap;
  align-content: stretch;
}

.kalshi-char-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  cursor: pointer;
  transition: border-color 0.14s ease, box-shadow 0.14s ease, transform 0.14s ease;
  text-align: left;
  min-width: 122px;
}

.market-info-panel .kalshi-char-card {
  width: 100%;
  min-width: 0;
}

.kalshi-char-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}

.kalshi-char-card:hover { border-color: #90b8e0; transform: translateY(-2px); }
.kalshi-char-card.active {
  border-color: #60a5fa;
  box-shadow:
    0 0 0 2px rgba(96, 165, 250, 0.35),
    0 10px 24px rgba(15, 23, 42, 0.35);
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
}
.kalshi-char-card.active .kalshi-char-name {
  color: #f1f5f9;
}
.kalshi-char-card.active .kalshi-char-fair {
  color: #7dd3fc;
}
.kalshi-char-card.active .kalshi-char-position {
  color: #f1f5f9;
}

.kalshi-char-img { width: 35px; height: 35px; object-fit: contain; border-radius: 6px; flex-shrink: 0; }
.kalshi-char-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kalshi-char-name { font-family: var(--display-font); font-size: 0.84rem; font-weight: 600; color: var(--text); line-height: 1; letter-spacing: 0.04em; text-transform: uppercase; }
.kalshi-char-hotkey { color: var(--muted); }
.kalshi-char-fair { font-size: 0.76rem; font-weight: 700; font-family: "IBM Plex Mono", monospace; color: #3b82f6; line-height: 1; }
.kalshi-char-position {
  flex: 0 0 auto;
  margin-left: 8px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  text-align: right;
}

html.dark-mode .kalshi-char-card { background: #1b2533; border-color: #34465b; }
html.dark-mode .kalshi-char-card:hover { border-color: #5a8ac0; }
html.dark-mode .kalshi-char-card.active {
  border-color: #60a5fa;
  box-shadow:
    0 0 0 2px rgba(96, 165, 250, 0.35),
    0 10px 24px rgba(0, 0, 0, 0.3);
  background: linear-gradient(180deg, #1a2436 0%, #111a28 100%);
}
html.dark-mode .kalshi-char-card.active .kalshi-char-fair {
  color: #7dd3fc;
}
html.dark-mode .kalshi-char-name { color: #e5eef8; }
html.dark-mode .kalshi-char-hotkey { color: #9fb1c8; }
html.dark-mode .kalshi-char-fair { color: #60a5fa; }
html.dark-mode .kalshi-char-position { color: #9fb1c8; }
html.dark-mode .kalshi-market-question { color: #e5eef8; }
html.dark-mode .market-info-panel-description { color: #aec0d5; }
html.dark-mode .kalshi-category-pill.active {
  background: linear-gradient(180deg, #1a2436 0%, #111a28 100%);
  border-color: #60a5fa;
  color: #f8fafc;
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
html.dark-mode .kalshi-category-pill.active .ticker-name {
  color: #f8fafc;
}
html.dark-mode .ticker-strip-label { color: #b8c9dd; }
html.dark-mode .kalshi-market-tooltip { background: rgba(70, 56, 20, 0.7); border-color: rgba(255, 185, 56, 0.32); color: #ffe2a4; }
html.dark-mode .kalshi-market-tooltip-bubble { background: rgba(31, 24, 12, 0.96); border-color: rgba(255, 185, 56, 0.32); color: #f7e6b6; box-shadow: 0 14px 30px rgba(0, 0, 0, 0.4); }

/* 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 .mango-body.exchange-theme {
  background: #141922;
}

html.dark-mode .mango-body.exchange-theme::before {
  filter: grayscale(0) saturate(0.44) brightness(0.78);
}

html.dark-mode .mango-body.exchange-theme::after {
  background:
    linear-gradient(180deg, rgba(20, 25, 34, 0.62) 0%, rgba(16, 21, 30, 0.72) 100%),
    radial-gradient(circle at top, rgba(94, 118, 148, 0.16) 0%, rgba(94, 118, 148, 0) 46%),
    radial-gradient(circle at 14% 14%, rgba(255, 211, 106, 0.12) 0%, rgba(255, 211, 106, 0) 28%),
    radial-gradient(circle at 86% 18%, rgba(231, 119, 111, 0.1) 0%, rgba(231, 119, 111, 0) 24%);
}

html.dark-mode .mango-body.exchange-theme .top-strip {
  background: rgba(22, 30, 40, 0.78);
  border-color: rgba(255, 185, 56, 0.28);
  box-shadow:
    0 20px 38px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 211, 106, 0.1) inset;
}

html.dark-mode .mango-body.exchange-theme .brand-mark,
html.dark-mode .mango-body.exchange-theme .metric-box,
html.dark-mode .mango-body.exchange-theme .sponsor-box,
html.dark-mode .mango-body.exchange-theme .ticker-pill,
html.dark-mode .mango-body.exchange-theme .sticky-toggle,
html.dark-mode .mango-body.exchange-theme .theme-toggle,
html.dark-mode .mango-body.exchange-theme .top-strip-layout-btn,
html.dark-mode .mango-body.exchange-theme .top-strip-help-btn,
html.dark-mode .mango-body.exchange-theme .order-inline-pane,
html.dark-mode .mango-body.exchange-theme .empty-state {
  background: rgba(27, 37, 51, 0.72);
}

html.dark-mode .mango-body.exchange-theme .kalshi-category-pill.active {
  background: linear-gradient(180deg, #1a2436 0%, #111a28 100%);
  border-color: #60a5fa;
  color: #f8fafc;
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
html.dark-mode .mango-body.exchange-theme .kalshi-category-pill.active .ticker-name {
  color: #f8fafc;
}
html.dark-mode .mango-body.exchange-theme .kalshi-category-pill.active:hover {
  border-color: #93c5fd;
  background: linear-gradient(180deg, #1f2a40 0%, #151d2e 100%);
}

html.dark-mode .mango-body.exchange-theme .dashboard-card {
  background: rgba(23, 31, 42, 0.76);
  border-color: rgba(255, 185, 56, 0.2);
}

html.dark-mode .mango-body.exchange-theme .table-wrap {
  background: rgba(22, 31, 43, 0.62);
}

html.dark-mode .mango-body.exchange-theme .panel-table thead th {
  background: rgba(39, 49, 64, 0.84) !important;
}

html.dark-mode .mango-body.exchange-theme .panel-table tbody td {
  background: rgba(24, 33, 46, 0.46) !important;
}

html.dark-mode .mango-body.exchange-theme .security-select-placeholder {
  background:
    radial-gradient(1200px 380px at 18% -15%, rgba(116, 162, 212, 0.1), transparent 68%),
    rgba(22, 30, 41, 0.72);
}

html.dark-mode .mango-body.exchange-theme .tender-card {
  background: rgba(32, 47, 64, 0.78);
}

html.dark-mode .login-shell {
  background:
    linear-gradient(180deg, rgba(255, 248, 233, 0.26) 0%, rgba(255, 242, 210, 0.54) 100%),
    radial-gradient(circle at 50% 50%, rgba(255, 224, 122, 0.2) 0%, rgba(255, 224, 122, 0) 42%),
    url("../assets/character-select.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

html.dark-mode .login-card .ui.form .field > label {
  color: #755305 !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: transparent;
  background: transparent;
}

html.dark-mode .brand-mark-title {
  color: #e5eef8;
}

html.dark-mode .brand-mark-status {
  color: #a8bad0;
}

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

html.dark-mode .sponsor-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-close {
  border-color: #927142;
  background: #3a2f1d;
  color: #f5d7a8;
}

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

html.dark-mode .inactive-indicator {
  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 .inactive-indicator.inactive-indicator-down {
  border-color: #7a3a32;
  border-left-color: #e06a58;
  background: #2a1714;
  color: #f4c6bd;
}

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 .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: var(--accent-gold);
  background: linear-gradient(180deg, #5c4a1c 0%, #473814 100%);
  color: #fff2c8;
  box-shadow: inset 0 0 0 1px rgba(255, 211, 106, 0.18);
}

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 .widget-card:hover {
  border-color: rgba(255, 211, 106, 0.44);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.46);
}

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

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 .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 .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 .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 .mango-body.exchange-theme .ladder-table .ladder-row.ask td {
  background: #3a2b2d !important;
}

html.dark-mode .mango-body.exchange-theme .ladder-table .ladder-row.bid td {
  background: #25342a !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 .case-status-banner {
  background: #1a2432;
  border-color: #334557;
  color: #dbe7f4;
}

html.dark-mode .case-status-banner.case-status-down {
  background: #3a1f23;
  border-color: #8c4549;
  color: #ffcfd2;
}

html.dark-mode .dashboard-card[data-widget-id="place-order"] .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 {
  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 .sponsor-box {
  background: #1d2938;
}

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 .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: 1280px) {
  .card-span-3 {
    flex-basis: calc(50% - 4px);
    max-width: calc(50% - 4px);
  }

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

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

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

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

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

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

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

@media (max-width: 980px) {
  .top-strip-main {
    flex-direction: column;
    align-items: flex-start;
  }

  .top-strip-brand,
  .top-strip-summary,
  .top-strip-sponsor {
    width: 100%;
  }

  .top-strip-summary {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .top-strip-sponsor {
    justify-content: flex-start;
  }

  .metric-box,
  .sponsor-box {
    flex: 1;
  }

  .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;
  }

  .market-info-panel {
    flex-basis: 100%;
    max-width: 100%;
    min-height: auto;
  }

  .market-info-panel .kalshi-characters-panel {
    flex-direction: row;
    flex-wrap: wrap;
  }

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

  .dashboard-card[data-widget-id="place-order"] .portfolio-orders-row {
    flex-direction: column;
  }

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

}

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

  .top-strip-brand {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .brand-mark {
    width: 100%;
  }

  .top-strip-brand {
    gap: 12px;
  }

  .brand-mark-ball {
    width: 70px;
    height: 70px;
  }

  .brand-mark-title {
    font-size: 1.28rem;
  }

  .brand-mark-status {
    font-size: 0.8rem;
  }

  .login-brand-title {
    align-items: flex-start;
  }

  .login-brand-ball {
    width: 58px;
    height: 58px;
  }

  .login-card {
    padding: 22px 18px;
  }

  .login-sponsor-row {
    width: 100%;
    justify-content: space-between;
  }

  .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;
  }

  .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;
  }
}
