:root {
  color: #17233d;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input { font: inherit; }

.login-page,
.home-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 14%, rgba(106, 220, 255, 0.38), transparent 34%),
    radial-gradient(circle at 83% 86%, rgba(126, 87, 255, 0.32), transparent 37%),
    linear-gradient(145deg, #071b3a 0%, #10295a 46%, #242159 100%);
}

.login-page::before {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  content: "";
  pointer-events: none;
}

.login-shell {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 40px 20px;
}

.login-card {
  width: min(100%, 410px);
  padding: 42px 40px 34px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 22px;
  background: rgba(250, 252, 255, 0.96);
  box-shadow: 0 28px 80px rgba(2, 10, 35, 0.42);
  backdrop-filter: blur(18px);
}

.brand-mark {
  display: grid;
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  place-items: center;
  border-radius: 15px;
  color: white;
  background: linear-gradient(145deg, #316ce8, #714dde);
  box-shadow: 0 10px 24px rgba(67, 84, 214, 0.3);
}

.brand-mark svg {
  width: 29px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.brand-name {
  margin: 0 0 18px;
  color: #50617e;
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.2em;
  text-align: center;
}

.login-card h1 {
  margin: 0;
  color: #111d35;
  font-size: clamp(1.65rem, 5vw, 2rem);
  line-height: 1.18;
  text-align: center;
}

.login-intro {
  margin: 9px 0 29px;
  color: #66738b;
  text-align: center;
}

.error-message {
  margin: 0 0 20px;
  padding: 11px 13px;
  border: 1px solid #f3b8c0;
  border-radius: 9px;
  color: #92263a;
  background: #fff2f4;
  font-size: 0.875rem;
}

.field { margin-bottom: 19px; }
.field label {
  display: block;
  margin-bottom: 7px;
  color: #273650;
  font-size: 0.86rem;
  font-weight: 650;
}

.field input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid #cbd4e2;
  border-radius: 10px;
  outline: none;
  color: #16213a;
  background: #fff;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.field input:focus {
  border-color: #416ede;
  box-shadow: 0 0 0 4px rgba(65, 110, 222, 0.14);
}

.password-field { position: relative; }
.password-field input { padding-right: 49px; }
.password-toggle {
  position: absolute;
  top: 50%;
  right: 7px;
  display: grid;
  width: 36px;
  height: 36px;
  padding: 8px;
  transform: translateY(-50%);
  place-items: center;
  border: 0;
  border-radius: 7px;
  color: #64718a;
  background: transparent;
  cursor: pointer;
}

.password-toggle:hover { color: #2c55b9; background: #eef3ff; }
.password-toggle:focus-visible,
.sign-in-button:focus-visible,
.remember-control input:focus-visible,
.logout-button:focus-visible {
  outline: 3px solid rgba(65, 110, 222, 0.35);
  outline-offset: 2px;
}

.password-toggle svg {
  width: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

.remember-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 23px;
  color: #53617a;
  font-size: 0.86rem;
  cursor: pointer;
}

.remember-control input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #426dde;
}

.sign-in-button,
.logout-button {
  width: 100%;
  height: 49px;
  border: 0;
  border-radius: 10px;
  color: white;
  background: linear-gradient(100deg, #2866d6, #6848d6);
  box-shadow: 0 10px 20px rgba(56, 79, 190, 0.23);
  font-weight: 700;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, opacity 150ms ease;
}

.sign-in-button:hover,
.logout-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 13px 24px rgba(56, 79, 190, 0.3);
}

.sign-in-button:disabled { opacity: 0.68; cursor: wait; }
.security-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 28px 0 0;
  color: #758198;
  font-size: 0.75rem;
  text-align: center;
}

.security-note svg {
  width: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.dashboard-page { min-height: 100vh; overflow-x: hidden; background: #f4f7fc; }
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  width: 210px;
  flex-direction: column;
  padding: 25px 18px 20px;
  color: #d9e4fa;
  background: linear-gradient(180deg, #0a1d42 0%, #172150 100%);
  box-shadow: 8px 0 30px rgba(21, 34, 74, 0.08);
}

.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 11px 27px; color: #fff; font-size: 1.15rem; font-weight: 750; }
.sidebar-mark {
  display: grid;
  width: 37px;
  height: 37px;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(145deg, #3979ec, #7653e4);
  box-shadow: 0 8px 18px rgba(42, 96, 215, 0.28);
}

.sidebar-mark svg { width: 23px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 1.8; }
.sidebar-nav { display: grid; min-height: 0; gap: 5px; overflow-y: auto; }
.nav-item {
  display: flex;
  min-height: 45px;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  border-radius: 9px;
  color: #aebbd4;
  font-size: 0.89rem;
  font-weight: 550;
  text-decoration: none;
}

.nav-item.active { color: #fff; background: rgba(91, 128, 238, 0.22); box-shadow: inset 3px 0 #64b5ff; }
.nav-item[aria-disabled="true"] { cursor: default; }
.nav-icon { display: grid; width: 22px; height: 22px; flex: 0 0 auto; place-items: center; }
.nav-icon svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }

.sidebar-logout { margin-top: auto; }
.sidebar-logout button,
.mobile-menu button {
  width: 100%;
  padding: 12px;
  border: 1px solid rgba(203, 218, 247, 0.18);
  border-radius: 9px;
  color: #c6d3ea;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  text-align: left;
}

.sidebar-logout button:hover { color: #fff; background: rgba(255, 255, 255, 0.09); }
.dashboard-main { min-height: 100vh; margin-left: 210px; padding: 28px clamp(24px, 3vw, 38px) 50px; }
.dashboard-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.dashboard-heading h1 { margin: 0 0 7px; color: #14213b; font-size: clamp(1.75rem, 3vw, 2.15rem); letter-spacing: -0.035em; }
.dashboard-heading p { margin: 0; color: #6b7890; }
.server-status {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid #cce8dc;
  border-radius: 999px;
  color: #267657;
  background: #effaf5;
  font-size: 0.78rem;
  font-weight: 650;
}

.server-status > span { width: 7px; height: 7px; border-radius: 50%; background: #2ca875; box-shadow: 0 0 0 3px rgba(44, 168, 117, 0.13); }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 22px; }
.summary-card,
.dashboard-panel { border: 1px solid #e1e7f0; border-radius: 14px; background: #fff; box-shadow: 0 7px 24px rgba(29, 46, 86, 0.055); }
.summary-card { min-width: 0; padding: 21px; }
.summary-card p { margin: 0 0 14px; color: #68758c; font-size: 0.81rem; font-weight: 650; }
.summary-card strong { display: block; overflow-wrap: anywhere; color: #14213b; font-size: clamp(1.45rem, 2.25vw, 1.8rem); letter-spacing: -0.03em; }
.summary-card > span { display: block; margin-top: 9px; color: #98a3b5; font-size: 0.73rem; }
.dashboard-panels { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.75fr); gap: 22px; }
.dashboard-panel { min-width: 0; }
.panel-heading { display: flex; min-height: 66px; align-items: center; justify-content: space-between; padding: 0 22px; border-bottom: 1px solid #e9edf4; }
.panel-heading h2 { margin: 0; color: #202d47; font-size: 1rem; }
.panel-heading > span { color: #8b96a9; font-size: 0.75rem; }
.empty-state { display: grid; min-height: 286px; place-content: center; justify-items: center; padding: 30px; color: #7a879b; text-align: center; }
.empty-state.compact { min-height: 286px; }
.empty-state p { margin: 12px 0 0; font-size: 0.86rem; }
.empty-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 12px; color: #5778d6; background: #eef3ff; font-weight: 750; }
.mobile-header { display: none; }

@media (max-width: 1100px) {
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-panels { grid-template-columns: 1fr; }
  .empty-state, .empty-state.compact { min-height: 220px; }
}

@media (max-width: 760px) {
  .sidebar { display: none; }
  .mobile-header {
    position: relative;
    z-index: 2;
    display: flex;
    height: 65px;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    color: #fff;
    background: linear-gradient(100deg, #0a1d42, #242159);
  }

  .mobile-brand { display: flex; align-items: center; gap: 9px; font-weight: 750; }
  .mobile-mark { display: grid; width: 31px; height: 31px; place-items: center; border-radius: 8px; background: linear-gradient(145deg, #3979ec, #7653e4); }
  .mobile-menu { position: relative; }
  .mobile-menu summary { display: grid; width: 40px; height: 40px; align-content: center; gap: 5px; padding: 9px; border-radius: 8px; cursor: pointer; list-style: none; }
  .mobile-menu summary::-webkit-details-marker { display: none; }
  .mobile-menu summary:focus-visible { outline: 3px solid rgba(121, 190, 255, 0.55); }
  .mobile-menu summary span { display: block; height: 2px; border-radius: 2px; background: #fff; }
  .mobile-menu nav { position: absolute; top: 48px; right: 0; display: grid; width: min(260px, calc(100vw - 28px)); padding: 10px; border: 1px solid #dce3ef; border-radius: 12px; color: #273650; background: #fff; box-shadow: 0 16px 40px rgba(10, 25, 61, 0.24); }
  .mobile-menu nav a,
  .mobile-menu nav > span { padding: 10px 11px; border-radius: 7px; color: #64718a; font-size: 0.88rem; text-decoration: none; }
  .mobile-menu nav a.active { color: #315ec8; background: #eef3ff; font-weight: 700; }
  .mobile-menu form { margin-top: 7px; padding-top: 8px; border-top: 1px solid #e6eaf1; }
  .mobile-menu button { color: #34425c; background: #f6f8fb; }
  .dashboard-main { margin-left: 0; padding: 28px 18px 38px; }
}

@media (max-width: 480px) {
  .login-shell { padding: 20px 14px; }
  .login-card { padding: 32px 24px 28px; border-radius: 18px; }
  .brand-mark { width: 48px; height: 48px; }
  .dashboard-heading { align-items: flex-start; flex-direction: column; margin-bottom: 24px; }
  .summary-grid { grid-template-columns: 1fr; gap: 12px; }
  .summary-card { padding: 18px; }
  .panel-heading { padding: 0 18px; }
  .empty-state, .empty-state.compact { min-height: 180px; padding: 24px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}

.broker-heading { align-items: flex-start; }
.primary-action,
.secondary-action,
.danger-action {
  min-height: 42px;
  padding: 0 18px;
  border-radius: 9px;
  font-weight: 700;
  cursor: pointer;
}

.primary-action {
  border: 0;
  color: #fff;
  background: linear-gradient(100deg, #2866d6, #6848d6);
  box-shadow: 0 8px 18px rgba(56, 79, 190, 0.2);
}

.secondary-action { border: 1px solid #cdd8eb; color: #315bb7; background: #f7f9ff; }
.danger-action { border: 1px solid #efc5cc; color: #a33649; background: #fff7f8; }
.primary-action:focus-visible,
.secondary-action:focus-visible,
.danger-action:focus-visible {
  outline: 3px solid rgba(65, 110, 222, 0.3);
  outline-offset: 2px;
}

.notice {
  margin: 0 0 18px;
  padding: 12px 15px;
  border: 1px solid;
  border-radius: 10px;
  font-size: 0.86rem;
}

.notice.success { border-color: #bfe3d2; color: #1f6f50; background: #effaf5; }
.notice.error { border-color: #f0c2ca; color: #962e42; background: #fff4f5; }
.notice.warning { border-color: #eddca7; color: #795c12; background: #fffaf0; }
.broker-panel { border: 1px solid #e1e7f0; border-radius: 14px; background: #fff; box-shadow: 0 7px 24px rgba(29, 46, 86, 0.055); }
.connection-list { display: grid; gap: 0; }
.connection-card {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 0.8fr) auto;
  gap: 24px;
  align-items: center;
  padding: 22px;
  border-bottom: 1px solid #e9edf4;
}

.connection-card:last-child { border-bottom: 0; }
.connection-identity { display: flex; min-width: 0; align-items: center; gap: 13px; }
.broker-logo { display: grid; width: 42px; height: 42px; flex: 0 0 auto; place-items: center; border-radius: 11px; color: #fff; background: linear-gradient(145deg, #2670d8, #5a4fd1); font-weight: 800; }
.broker-logo.large { width: 52px; height: 52px; margin-bottom: 4px; border-radius: 14px; font-size: 1.15rem; }
.connection-identity h3 { margin: 0 0 5px; overflow: hidden; color: #1b2944; font-size: 0.95rem; text-overflow: ellipsis; white-space: nowrap; }
.connection-identity p,
.connection-meta p { margin: 0; color: #7a879b; font-size: 0.75rem; }
.connection-meta { display: grid; justify-items: start; gap: 5px; }
.connection-badge { display: inline-flex; padding: 5px 9px; border-radius: 999px; font-size: 0.7rem; font-weight: 750; }
.connection-badge.valid { color: #237653; background: #eaf8f1; }
.connection-badge.expired { color: #9a3548; background: #fff0f2; }
.connection-badge.pending { color: #765d1d; background: #fff7df; }
.connection-actions { display: flex; gap: 9px; }
.broker-empty-state { display: grid; min-height: 330px; place-content: center; justify-items: center; padding: 36px 20px; color: #78859a; text-align: center; }
.broker-empty-state h3 { margin: 13px 0 7px; color: #263550; font-size: 1rem; }
.broker-empty-state p { max-width: 430px; margin: 0; font-size: 0.84rem; line-height: 1.55; }

@media (max-width: 980px) {
  .connection-card { grid-template-columns: minmax(200px, 1fr) auto; }
  .connection-meta { grid-column: 1; grid-row: 2; }
  .connection-actions { grid-column: 2; grid-row: 1 / span 2; }
}

@media (max-width: 600px) {
  .broker-heading form,
  .primary-action { width: 100%; }
  .connection-card { grid-template-columns: 1fr; gap: 15px; }
  .connection-meta,
  .connection-actions { grid-column: 1; grid-row: auto; }
  .connection-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .connection-actions form,
  .connection-actions button { width: 100%; }
}

.holdings-panel {
  overflow: hidden;
  border: 1px solid #e1e7f0;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 7px 24px rgba(29, 46, 86, 0.055);
}

.portfolio-heading { margin-bottom: 22px; }
.portfolio-refresh-group { display: flex; align-items: center; gap: 13px; }
.portfolio-refresh-group > span { color: #7d8799; font-size: 0.76rem; }
.refresh-action {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 7px;
  padding: 0 14px;
  border: 1px solid #d8dfeb;
  border-radius: 8px;
  color: #33415a;
  background: #fff;
  cursor: pointer;
}
.refresh-action:disabled { opacity: 0.58; cursor: wait; }
.refresh-action:focus-visible,
.holdings-controls input:focus,
.holdings-controls select:focus { outline: 3px solid rgba(65, 110, 222, 0.2); outline-offset: 1px; }
.portfolio-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.portfolio-summary[hidden] { display: none; }
.portfolio-summary-card {
  min-height: 116px;
  padding: 20px 22px;
  border: 1px solid #dfe5ef;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(29, 46, 86, 0.04);
}
.portfolio-summary-card > span { display: block; margin-bottom: 9px; color: #69768b; font-size: 0.8rem; }
.portfolio-summary-card strong { color: #14213b; font-size: clamp(1.25rem, 2vw, 1.55rem); letter-spacing: -0.025em; }
.portfolio-summary-card strong.positive { color: #168650; }
.portfolio-summary-card strong.negative { color: #b0374c; }
.portfolio-summary-card strong.neutral { color: #59667b; }
.summary-value-line { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.summary-value-line small { font-size: 0.72rem; font-weight: 750; }
.summary-value-line small.positive { color: #168650; }
.summary-value-line small.negative { color: #b0374c; }
.summary-value-line small.neutral { color: #6c778a; }
.portfolio-metric-card { position: relative; display: grid; grid-template-columns: 38px minmax(0, 1fr); align-items: start; gap: 12px; padding: 15px 14px; overflow: hidden; }
.portfolio-metric-card > .portfolio-card-icon { display: grid; width: 34px; height: 34px; margin: 0; place-items: center; border-radius: 9px; line-height: 1; }
.portfolio-card-icon svg { display: block; }
.portfolio-metric-content { min-width: 0; }
.portfolio-metric-content > p { margin: 3px 0 8px; color: #4e5d77; font-size: .71rem; font-weight: 750; }
.portfolio-metric-content > span { display: block; margin-top: 8px; color: #8d99ad; font-size: .65rem; }
.portfolio-metric-card .summary-value-line { gap: 6px; }
.portfolio-metric-card .summary-value-line small { font-size: .66rem; }
.portfolio-card-sparkline { position: absolute; right: 10px; bottom: 10px; display: block; width: 72px; height: 27px; }
.metric-invested .portfolio-card-icon { color: #1169eb; background: #dfebff; }
.metric-current .portfolio-card-icon { color: #06a35e; background: #ddf6e8; }
.metric-pnl .portfolio-card-icon { color: #7535ea; background: #eee3ff; }
.metric-day .portfolio-card-icon { color: #d75c14; background: #ffe6d6; }
.holdings-toolbar { display: flex; min-height: 62px; align-items: center; justify-content: space-between; gap: 20px; padding: 10px 16px; border-bottom: 1px solid #e4e9f1; }
.holdings-title-group { display: flex; align-items: baseline; gap: 9px; }
.holdings-title-group h2 { margin: 0; color: #202d47; font-size: 1rem; }
.holdings-title-group span { color: #8590a2; font-size: 0.74rem; white-space: nowrap; }
.holdings-controls { display: flex; justify-content: flex-end; gap: 9px; }
.holdings-controls[hidden] { display: none; }
.holdings-controls label { min-width: 0; }
.holdings-controls input,
.holdings-controls select {
  height: 36px;
  border: 1px solid #d6deeb;
  border-radius: 7px;
  outline: none;
  color: #47546a;
  background: #fff;
  font-size: 0.75rem;
}
.holding-search { position: relative; }
.holding-search > span:not(.visually-hidden) { position: absolute; top: 9px; left: 11px; color: #64738b; }
.holding-search input { width: 160px; padding: 0 12px 0 32px; }
.holdings-controls select { min-width: 136px; padding: 0 32px 0 12px; }
.holdings-controls label:last-child select { min-width: 190px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; clip-path: inset(50%); }

.portfolio-state {
  display: grid;
  min-height: 330px;
  place-content: center;
  justify-items: center;
  padding: 38px 20px;
  color: #78859a;
  text-align: center;
}

.portfolio-state[hidden],
[data-portfolio-content][hidden],
[data-holdings-count][hidden] { display: none; }
.portfolio-state h3 { margin: 13px 0 7px; color: #263550; font-size: 1rem; }
.portfolio-state p { max-width: 470px; margin: 0; font-size: 0.84rem; line-height: 1.55; }
.portfolio-state-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 13px;
  color: #496bc8;
  background: #eef3ff;
  font-weight: 800;
}
.portfolio-state-icon.error { color: #963448; background: #fff0f2; }
.loading-indicator {
  width: 40px;
  height: 40px;
  border: 4px solid #e5ebf7;
  border-top-color: #526bd4;
  border-radius: 50%;
  animation: portfolio-spin 800ms linear infinite;
}
.portfolio-state-actions { display: flex; gap: 10px; margin-top: 20px; }
.portfolio-action-link { display: inline-flex; align-items: center; text-decoration: none; }
.holdings-table-wrap { overflow-x: auto; }
.holdings-table { width: 100%; table-layout: fixed; border-collapse: collapse; color: #35425a; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.holdings-table .column-symbol { width: 14%; }
.holdings-table .column-exchange { width: 8%; }
.holdings-table .column-quantity { width: 8%; }
.holdings-table .column-price { width: 12%; }
.holdings-table .column-pnl { width: 23%; }
.holdings-table th,
.holdings-table td { height: 44px; padding: 10px 18px; border-bottom: 1px solid #e7ebf2; text-align: left; vertical-align: middle; white-space: nowrap; }
.holdings-table th { height: 38px; padding: 8px 18px; vertical-align: middle; }
.holdings-table th { color: #77849a; background: #fafbfe; font-size: 0.72rem; font-weight: 750; letter-spacing: 0.02em; text-transform: uppercase; }
.holdings-table tr:last-child td { border-bottom: 0; }
.holdings-table th:not(:first-child),
.holdings-table td:not(:first-child),
.holdings-table .numeric { text-align: center; }
.holdings-table th.numeric,
.holdings-table td.numeric { padding-left: 12px; padding-right: 12px; }
.holdings-table .pnl-cell { padding-left: 12px; padding-right: 12px; }
.holding-symbol { color: #172641; font-weight: 750; }
.pnl-badge { display: inline-flex; width: 180px; max-width: 100%; align-items: baseline; justify-content: center; gap: 8px; padding: 5px 8px; border-radius: 6px; text-align: center; white-space: nowrap; }
.pnl-amount { font-size: 0.75rem; font-weight: 750; }
.pnl-percentage { font-size: 0.68rem; font-weight: 500; }
.pnl-value.positive { color: #13864b; background: #e8f6ec; }
.pnl-value.positive .pnl-percentage { color: #31935f; }
.pnl-value.negative { color: #c53447; background: #fdebed; }
.pnl-value.negative .pnl-percentage { color: #d24b5b; }
.pnl-value.neutral { color: #667185; background: #f0f2f6; }
.pnl-value.neutral .pnl-percentage { color: #7d8798; }
.holdings-mobile { display: none; }

@keyframes portfolio-spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .holdings-table-wrap { display: none; }
  .holdings-mobile { display: grid; }
  .holding-mobile-card { padding: 20px 18px; border-bottom: 1px solid #e9edf4; }
  .holding-mobile-card:last-child { border-bottom: 0; }
  .holding-mobile-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
  .holding-mobile-heading h3 { margin: 0; color: #172641; font-size: 1rem; }
  .holding-mobile-heading span { color: #6d7a90; font-size: 0.75rem; font-weight: 700; }
  .holding-mobile-card dl { display: grid; grid-template-columns: 1fr 1fr; gap: 17px 20px; margin: 0; }
  .holding-mobile-field dt { margin-bottom: 5px; color: #8490a4; font-size: 0.7rem; }
  .holding-mobile-field dd { margin: 0; color: #33415a; font-size: 0.84rem; font-weight: 650; overflow-wrap: anywhere; }
  .holding-mobile-field dd.pnl-value.positive { color: #1e7150; }
  .holding-mobile-field dd.pnl-value.negative { color: #9a3045; }
  .holding-mobile-field dd.pnl-value.neutral { color: #626f83; }
  .portfolio-state { min-height: 270px; }
}

@media (max-width: 1050px) {
  .portfolio-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .holdings-toolbar { align-items: stretch; flex-direction: column; }
  .holdings-controls { justify-content: stretch; }
  .holdings-controls label { flex: 1; }
  .holding-search input,
  .holdings-controls select,
  .holdings-controls label:last-child select { width: 100%; min-width: 0; }
}

@media (max-width: 600px) {
  .portfolio-refresh-group { width: 100%; justify-content: space-between; }
  .portfolio-refresh-group > span { order: 2; }
  .holdings-controls { display: grid; grid-template-columns: 1fr 1fr; }
  .holdings-controls .holding-search { grid-column: 1 / -1; }
  .portfolio-summary { gap: 10px; }
  .portfolio-summary-card { min-height: 100px; padding: 16px; }
}

@media (max-width: 390px) {
  .portfolio-summary { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .loading-indicator { animation: none; border-top-color: #e5ebf7; box-shadow: inset 0 0 0 4px #526bd4; }
}

.market-summary strong.positive,
.market-pnl.positive { color: #13864b; }
.market-summary strong.negative,
.market-pnl.negative { color: #c53447; }
.market-summary strong.neutral,
.market-pnl.neutral { color: #667185; }
.market-toolbar { min-height: 64px; }
.view-tabs { display: inline-flex; padding: 3px; border-radius: 8px; background: #eef2f8; }
.view-tabs button { min-width: 70px; height: 34px; border: 0; border-radius: 6px; color: #66748b; background: transparent; cursor: pointer; font-weight: 700; }
.view-tabs button.active { color: #214fae; background: #fff; box-shadow: 0 2px 8px rgba(25, 45, 84, 0.1); }
.market-table-wrap { overflow-x: auto; }
.market-table { width: 100%; min-width: 1020px; border-collapse: collapse; color: #35425a; font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.market-table th, .market-table td { height: 44px; padding: 9px 12px; border-bottom: 1px solid #e7ebf2; text-align: center; vertical-align: middle; white-space: nowrap; }
.market-table th { height: 38px; color: #77849a; background: #fafbfe; font-size: 0.67rem; letter-spacing: 0.02em; text-transform: uppercase; }
.market-table th:first-child, .market-table td:first-child { text-align: left; padding-left: 18px; }
.market-table tr:last-child td { border-bottom: 0; }
.market-mobile { display: none; }
.order-status { display: inline-block; min-width: 88px; padding: 5px 8px; border-radius: 6px; color: #59667b; background: #f0f2f6; font-size: 0.68rem; font-weight: 750; }
.status-complete { color: #13864b; background: #e8f6ec; }
.status-rejected { color: #c53447; background: #fdebed; }
.status-cancelled { color: #667185; background: #eef0f4; }
.status-open, .status-trigger-pending { color: #936312; background: #fff5d9; }
.order-side { font-weight: 750; }
.order-side.buy { color: #156cbb; }
.order-side.sell { color: #b33b50; }
.market-mobile-card { padding: 18px; border-bottom: 1px solid #e7ebf2; }
.market-mobile-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 15px; }
.market-mobile-heading h3 { margin: 0; color: #172641; font-size: 0.92rem; }
.market-mobile-card dl { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin: 0; }
.market-mobile-card dt { margin-bottom: 4px; color: #8490a4; font-size: 0.68rem; }
.market-mobile-card dd { margin: 0; color: #33415a; font-size: 0.8rem; font-weight: 650; }
@media (max-width: 1050px) { .market-toolbar { align-items: stretch; flex-direction: column; } }
@media (max-width: 900px) { .market-table-wrap { display: none; } .market-mobile { display: block; } }
@media (max-width: 600px) { .market-mobile-card dl { grid-template-columns: 1fr; } }
.dashboard-connection { display: inline-flex; margin: -10px 0 18px; padding: 6px 10px; border-radius: 999px; color: #667185; background: #eef2f7; font-size: 0.72rem; font-weight: 700; }
.dashboard-connection.connected { color: #17794a; background: #e8f6ec; }
.dashboard-connection.partial { color: #875f16; background: #fff5d9; }
.dashboard-connection.error, .dashboard-connection.unavailable { color: #a83749; background: #fdebed; }
.dashboard-connection a { color: inherit; }
.summary-card strong.positive, .dashboard-list-row .positive { color: #13864b; }
.summary-card strong.negative, .dashboard-list-row .negative { color: #c53447; }
.panel-heading a { color: #315bb7; font-size: 0.75rem; font-weight: 700; text-decoration: none; }
.dashboard-list { min-height: 286px; }
.dashboard-list-row { display: flex; min-height: 57px; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 20px; border-bottom: 1px solid #edf0f5; }
.dashboard-list-row:last-child { border-bottom: 0; }
.dashboard-list-row > div { display: grid; gap: 3px; }
.dashboard-list-row > div:last-child { justify-items: end; }
.dashboard-list-row strong { color: #24324b; font-size: 0.8rem; }
.dashboard-list-row span { color: #7a879b; font-size: 0.69rem; }
.dashboard-empty-message { display: grid; min-height: 250px; margin: 0; place-content: center; padding: 20px; color: #7a879b; font-size: 0.82rem; text-align: center; }

/* Compact account dashboard */
.account-dashboard .dashboard-heading { margin-bottom: 18px; }
.account-dashboard .dashboard-connection { margin: -7px 0 17px; }
.overview-summary { gap: 13px; margin-bottom: 16px; }
.overview-card { position: relative; display: grid; min-height: 116px; grid-template-columns: 38px minmax(0, 1fr); gap: 12px; padding: 15px 14px; overflow: hidden; }
.overview-card > div { min-width: 0; }
.overview-card p { margin: 3px 0 8px; color: #4e5d77; font-size: .71rem; font-weight: 750; }
.overview-card strong { font-size: clamp(1.25rem, 1.65vw, 1.55rem); white-space: nowrap; }
.overview-card > div > span { display: block; margin-top: 8px; color: #8d99ad; font-size: .65rem; }
.overview-card > .overview-card-icon { display: grid; width: 34px; height: 34px; margin-top: 0; place-items: center; border-radius: 9px; font-size: 1.15rem; font-weight: 800; line-height: 1; }
.overview-card-icon svg, .positions-decoration svg, .overview-empty-icon svg { display: block; flex: none; }
.card-portfolio .overview-card-icon { color: #1169eb; background: #dfebff; }
.card-cash .overview-card-icon { color: #06a35e; background: #ddf6e8; }
.card-pnl .overview-card-icon { color: #7535ea; background: #eee3ff; }
.card-positions .overview-card-icon { color: #d75c14; background: #ffe6d6; }
.summary-sparkline { position: absolute; right: 10px; bottom: 10px; display: block; width: 72px; height: 27px; }
.summary-flatline { position: absolute; right: 15px; bottom: 28px; width: 72px; border-top: 2px dashed #925eff; }
.overview-card > .positions-decoration { position: absolute; right: 17px; bottom: 25px; display: grid; width: 38px; height: 38px; margin-top: 0; place-items: center; border-radius: 8px; color: #9aaac1; background: #f1f4f8; font-size: 1.35rem; }
.overview-panels { grid-template-columns: minmax(660px, 1.75fr) minmax(280px, .8fr); gap: 14px; align-items: stretch; }
.account-dashboard .dashboard-panel { overflow: hidden; border-color: #dfe6f0; border-radius: 13px; box-shadow: 0 7px 24px rgba(29, 46, 86, .05); }
.overview-panel-heading { min-height: 68px; gap: 16px; padding: 11px 18px; }
.overview-panel-heading h2 { margin: 0 0 5px; color: #15233e; font-size: .98rem; }
.overview-panel-heading p { margin: 0; color: #8490a4; font-size: .72rem; }
.overview-heading-actions { display: flex; flex: none; align-items: center; gap: 13px; }
.overview-tabs { display: inline-flex; overflow: hidden; border: 1px solid #dce3ee; border-radius: 7px; }
.overview-tabs:empty { display: none; }
.overview-tabs button { min-width: 39px; height: 30px; padding: 0 10px; border: 0; border-right: 1px solid #e2e7ef; color: #53627b; background: #fff; cursor: pointer; font-size: .66rem; font-weight: 700; }
.overview-tabs button:last-child { border-right: 0; }
.overview-tabs button:hover { background: #f2f6fd; }
.overview-tabs button.active { color: #fff; background: #1769e8; }
.overview-table-scroll { width: 100%; overflow: hidden; }
.overview-table { width: 100%; min-width: 0; table-layout: fixed; border-collapse: collapse; }
.overview-col-symbol { width: 16%; } .overview-col-exchange { width: 10%; } .overview-col-value { width: 15%; } .overview-col-day { width: 16%; } .overview-col-pnl { width: 15%; } .overview-col-sparkline { width: 21%; } .overview-col-chart { width: 7%; }
.overview-table thead { color: #68768d; background: #f8faff; font-size: .66rem; font-weight: 750; }
.overview-table th, .overview-table td { height: 40px; padding: 0 8px; text-align: center; vertical-align: middle; }
.overview-table th:first-child, .overview-table td:first-child { padding-left: 18px; text-align: left; }
.overview-table th:last-child, .overview-table td:last-child { padding-right: 18px; }
.account-dashboard .dashboard-list { min-height: 296px; }
.account-dashboard .overview-holding-row { height: 62px; border-bottom: 1px solid #edf0f5; }
.account-dashboard .overview-holding-row:last-child { border-bottom: 0; }
.overview-symbol { display: flex !important; min-width: 0; grid-template-columns: 30px minmax(0, 1fr); align-items: center; gap: 9px !important; }
.overview-symbol > div { display: grid; min-width: 0; gap: 2px; }
.overview-symbol strong { overflow: hidden; font-size: .74rem; text-overflow: ellipsis; white-space: nowrap; }
.stock-mark { display: grid; width: 28px; height: 28px; flex: none; place-items: center; border-radius: 50%; color: #0868e8 !important; background: #dfebff; font-size: .54rem !important; font-weight: 850; }
.overview-holding-row:nth-child(3n+2) .stock-mark { color: #fff !important; background: #101522; }
.overview-holding-row:nth-child(3n) .stock-mark { color: #fff !important; background: #0875ed; }
.overview-exchange { color: #758299 !important; font-size: .67rem !important; text-align: center; }
.overview-current-value { color: #21304a; font-size: .74rem !important; text-align: center; white-space: nowrap; }
.cell-stack { display: inline-flex; max-width: 100%; align-items: center; justify-content: center; gap: 6px; padding: 5px 9px; border-radius: 6px; font-variant-numeric: tabular-nums; text-align: center; white-space: nowrap; }
.holding-metric strong { font-size: .73rem; white-space: nowrap; }
.holding-metric span { font-size: .66rem; }
.holding-metric.positive strong, .holding-metric.positive span { color: #079759; }
.holding-metric.negative strong, .holding-metric.negative span { color: #e12f48; }
.holding-metric.neutral strong, .holding-metric.neutral span { color: #728096; }
.holding-metric.positive { background: #e5f5eb; }
.holding-metric.negative { background: #fde9ec; }
.holding-metric.neutral { background: #eef1f5; }
.holding-sparkline { display: block; width: 100px; max-width: 100%; height: 30px; margin: 0 auto; }
.holding-row-action { display: grid; width: 32px; height: 32px; margin: 0 auto; padding: 0; place-items: center; border: 0; border-radius: 7px; color: #263754; background: transparent; cursor: pointer; text-decoration: none; }
.holding-row-action::before { width: 4px; height: 18px; background: radial-gradient(circle, currentColor 1.5px, transparent 1.7px) center top / 4px 6px repeat-y; content: ""; }
.holding-row-action:hover, .holding-row-action:focus-visible { color: #1769e8; background: #eef3fa; outline: none; }
.overview-empty { display: grid; min-height: 296px; place-content: center; justify-items: center; padding: 24px; color: #8390a5; text-align: center; }
.overview-empty-icon { display: grid; width: 58px; height: 58px; margin-bottom: 14px; place-items: center; border: 8px solid #f0f4fc; border-radius: 50%; color: #7990b4; background: #e4ebf7; font-size: 1.45rem; }
.overview-empty strong { color: #25344e; font-size: .77rem; }
.overview-empty > span:last-child { margin-top: 7px; font-size: .68rem; }

@media (max-width: 940px) { .overview-panels { grid-template-columns: 1fr; } .overview-activity .dashboard-list { min-height: 210px; } }
@media (max-width: 720px) { .overview-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) {
  .overview-panel-heading { min-height: 72px; flex-wrap: wrap; }
  .overview-heading-actions { width: 100%; justify-content: space-between; }
  .overview-table colgroup, .overview-table thead { display: none; }
  .overview-table, .overview-table tbody { display: block; }
  .account-dashboard .overview-holding-row { position: relative; display: grid; width: 100%; height: auto; min-height: 126px; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 10px; padding: 14px 50px 14px 16px; }
  .overview-table td { display: block; height: auto; padding: 0; text-align: left; }
  .overview-table td.portfolio-symbol-cell { grid-column: 1 / -1; padding-left: 0; }
  .overview-table td.exchange-cell, .overview-table td.sparkline-table-cell { display: none; }
  .overview-table td.chart-link-cell { position: absolute; top: 14px; right: 10px; padding-right: 0; }
  .current-value-cell, .day-change-table-cell, .pnl-table-cell { justify-self: stretch; }
  .cell-stack { align-items: center; text-align: center; }
  .overview-current-value { display: grid; gap: 4px; }
  .overview-current-value::before, .day-change-table-cell::before, .pnl-table-cell::before { display: block; margin-bottom: 4px; color: #8793a6; font-size: .58rem; font-weight: 600; }
  .overview-current-value::before { content: "Current Value"; }
  .day-change-table-cell::before { content: "Day Change"; }
  .pnl-table-cell::before { content: "P&L"; }
}
@media (max-width: 480px) { .overview-summary { grid-template-columns: 1fr; } .overview-card { min-height: 106px; } }

/* Multi-timeframe charting workspace */
.charting-heading { align-items: center; margin-bottom: 20px; }
.charting-heading-actions { display: flex; align-items: center; gap: 12px; }
.chart-layout-selector { display: inline-flex; height: 40px; align-items: center; gap: 8px; padding: 0 9px 0 12px; border: 1px solid #d8dfeb; border-radius: 8px; color: #758198; background: #fff; font-size: 0.68rem; font-weight: 700; }
.chart-layout-selector select { min-width: 82px; height: 30px; padding: 0 25px 0 8px; border: 0; border-left: 1px solid #e5e9f0; color: #34425b; background: #fff; font-size: 0.7rem; font-weight: 700; }
.chart-layout-selector select:focus-visible { outline: 2px solid #5274d7; outline-offset: 1px; }
.chart-market-state { padding: 7px 11px; border-radius: 999px; color: #51627d; background: #edf2f9; font-size: 0.72rem; font-weight: 700; }
.charting-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; align-items: start; gap: 16px; }
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; min-width: 0; }
.chart-grid[data-layout="1"] { grid-template-columns: minmax(0, 1fr); }
.chart-grid[data-layout="1"] .chart-canvas { height: clamp(560px, calc(100vh - 310px), 720px); }
.chart-grid[data-layout="1"] .chart-panel-state { min-height: clamp(560px, calc(100vh - 310px), 720px); }
.chart-panel { position: relative; min-width: 0; overflow: hidden; border: 1px solid #dfe5ef; border-radius: 12px; background: #fff; box-shadow: 0 5px 18px rgba(29, 46, 86, 0.04); }
.chart-panel[hidden] { display: none; }
.chart-panel.stale { border-color: #e6c988; }
.chart-panel-header { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px 8px 15px; border-bottom: 1px solid #e7ebf2; }
.chart-panel-identity { display: grid; min-width: 0; gap: 3px; }
.chart-panel-header strong { overflow: hidden; color: #172641; font-size: 0.82rem; text-overflow: ellipsis; white-space: nowrap; }
.chart-panel-header span { color: #8190a5; font-size: 0.66rem; }
.chart-panel.stale .chart-panel-header span { color: #986d18; }
.chart-panel-controls { display: flex; flex: none; flex-wrap: nowrap; align-items: center; gap: 7px; }
.chart-indicator-mode { height: 28px; padding: 0 9px; border: 1px solid #d8e0ed; border-radius: 6px; color: #53637c; background: #fff; cursor: pointer; font-size: 0.65rem; font-weight: 700; }
.chart-indicator-mode:hover { color: #285fc7; border-color: #b9c9e8; }
.chart-panel-header select { height: 34px; padding: 0 28px 0 10px; border: 1px solid #d6deeb; border-radius: 7px; color: #43516a; background: #fff; font-size: 0.7rem; font-weight: 700; }
.chart-zoom-controls { display: inline-flex; overflow: hidden; border: 1px solid #d6deeb; border-radius: 7px; background: #fff; }
.chart-zoom-controls button { width: 29px; height: 32px; padding: 0; border: 0; border-right: 1px solid #e2e7ef; color: #52617a; background: #fff; cursor: pointer; font-size: 0.8rem; font-weight: 750; }
.chart-zoom-controls button:last-child { border-right: 0; }
.chart-zoom-controls button:hover:not(:disabled) { color: #234fa9; background: #f0f5ff; }
.chart-zoom-controls button:focus-visible { position: relative; z-index: 1; outline: 2px solid #5274d7; outline-offset: -2px; }
.chart-zoom-controls button:disabled { color: #b5bdca; cursor: default; background: #f7f8fa; }
.chart-zoom-controls [data-zoom-reset] { width: 34px; color: #3658aa; font-size: 0.65rem; }
.chart-panel-header select:focus-visible,
.instrument-search input:focus-visible { outline: 3px solid rgba(65, 110, 222, 0.2); outline-offset: 1px; }
.chart-legend { display: flex; min-height: 28px; align-items: center; gap: 10px; padding: 5px 14px; overflow: hidden; border-bottom: 1px solid #f0f2f6; color: #8894a7; font-size: 0.61rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chart-legend b { color: #46546b; font-weight: 650; }
.chart-candle-count { flex: none; margin-left: auto; padding: 3px 7px; border: 1px solid #ddd6ff; border-radius: 5px; color: #654fc5 !important; background: #f5f2ff; font-weight: 700; }
.chart-canvas { width: 100%; height: 430px; }
.chart-panel-state { display: grid; min-height: 430px; place-content: center; justify-items: center; gap: 7px; padding: 24px; color: #7d899d; text-align: center; }
.chart-panel-state[hidden], .chart-canvas[hidden] { display: none; }
.chart-panel-state strong { color: #2c3a53; font-size: 0.86rem; }
.chart-panel-state span { max-width: 310px; font-size: 0.72rem; line-height: 1.5; }
.chart-panel-state.loading::before { width: 28px; height: 28px; margin-bottom: 7px; border: 3px solid #e5ebf7; border-top-color: #526bd4; border-radius: 50%; animation: portfolio-spin 800ms linear infinite; content: ""; }
.chart-panel-state.error strong { color: #a83749; }

.watchlist-panel { position: sticky; top: 24px; overflow: visible; border: 1px solid #dfe5ef; border-radius: 12px; background: #fff; box-shadow: 0 5px 18px rgba(29, 46, 86, 0.04); }
.watchlist-panel > header { display: flex; min-height: 58px; align-items: center; padding: 12px 15px; border-bottom: 1px solid #e7ebf2; }
.watchlist-panel > header h2 { margin: 0 0 2px; color: #1d2b46; font-size: 0.9rem; }
.watchlist-panel > header span { color: #8793a5; font-size: 0.66rem; }
.instrument-search { position: relative; padding: 12px; border-bottom: 1px solid #edf0f5; }
.instrument-search label { position: relative; display: block; }
.instrument-search svg { position: absolute; top: 9px; left: 10px; width: 16px; fill: none; stroke: #738198; stroke-width: 1.7; }
.instrument-search input { width: 100%; height: 36px; padding: 0 10px 0 34px; border: 1px solid #d8dfeb; border-radius: 7px; color: #33415a; font-size: 0.72rem; }
.instrument-results { position: absolute; z-index: 20; top: 53px; right: 12px; left: 12px; max-height: 260px; overflow-y: auto; border: 1px solid #d8dfeb; border-radius: 8px; background: #fff; box-shadow: 0 12px 30px rgba(22, 39, 75, 0.16); }
.instrument-results[hidden] { display: none; }
.instrument-results button,
.instrument-results > span { display: block; width: 100%; padding: 10px 11px; border: 0; border-bottom: 1px solid #edf0f5; color: #34425a; background: #fff; font-size: 0.7rem; text-align: left; }
.instrument-results button { cursor: pointer; }
.instrument-results button:hover,
.instrument-results button:focus-visible { color: #244fa8; background: #f2f6ff; outline: none; }
.watchlist-items { max-height: calc(100vh - 330px); overflow-y: auto; }
.watchlist-items[hidden], .watchlist-state[hidden] { display: none; }
.watchlist-items button { display: grid; width: 100%; gap: 3px; padding: 11px 15px; border: 0; border-bottom: 1px solid #edf0f5; color: #25344e; background: #fff; cursor: pointer; text-align: left; }
.watchlist-items button:hover { background: #f7f9fd; }
.watchlist-items button.active { color: #214fae; background: #edf3ff; box-shadow: inset 3px 0 #4b7be6; }
.watchlist-items button strong { font-size: 0.75rem; }
.watchlist-items button span { overflow: hidden; color: #8591a4; font-size: 0.63rem; text-overflow: ellipsis; white-space: nowrap; }
.watchlist-state { display: grid; min-height: 150px; place-content: center; gap: 6px; padding: 20px 16px; color: #7f8b9e; font-size: 0.69rem; line-height: 1.5; text-align: center; }
.watchlist-state strong { color: #34425b; font-size: 0.75rem; }
.watchlist-panel > footer { display: grid; gap: 4px; padding: 11px 15px; border-top: 1px solid #e7ebf2; color: #8a95a6; font-size: 0.59rem; }
.watchlist-panel > footer a { color: #4965ae; text-decoration: none; }

.watchlist-header { position: relative; justify-content: space-between; gap: 8px; }
.watchlist-selector-wrap { position: relative; min-width: 0; }
.watchlist-selector { display: flex; max-width: 205px; align-items: center; gap: 6px; padding: 5px 7px; border: 0; border-radius: 5px; color: #1d2b46; background: transparent; cursor: pointer; font-size: 0.83rem; font-weight: 750; }
.watchlist-selector:hover { background: #f1f4f9; }
.watchlist-selector span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.watchlist-selector-menu,
.watchlist-action-menu { position: absolute; z-index: 30; overflow: hidden; border: 1px solid #d8dfeb; border-radius: 7px; background: #fff; box-shadow: 0 12px 30px rgba(22, 39, 75, 0.17); }
.watchlist-selector-menu { top: 38px; left: 0; width: 220px; }
.watchlist-selector-menu[hidden], .watchlist-action-menu[hidden] { display: none; }
.watchlist-selector-menu button,
.watchlist-action-menu button { display: block; width: 100%; padding: 9px 11px; border: 0; color: #34425a; background: #fff; cursor: pointer; font-size: 0.72rem; text-align: left; }
.watchlist-selector-menu button:hover,
.watchlist-selector-menu button.active,
.watchlist-action-menu button:hover { color: #214fae; background: #edf3ff; }
.watchlist-selector-menu hr { margin: 3px 0; border: 0; border-top: 1px solid #e7ebf2; }
.watchlist-header-actions { position: relative; display: flex; gap: 3px; }
.watchlist-header-actions > button { width: 29px; height: 29px; padding: 0; border: 0; border-radius: 5px; color: #596980; background: transparent; cursor: pointer; font-size: 1rem; }
.watchlist-header-actions > button:hover { color: #214fae; background: #edf3ff; }
.watchlist-action-menu { top: 33px; right: 0; width: 130px; }
.watchlist-action-menu button:last-child { color: #b0374c; }
.watchlist-columns,
.watchlist-row-select { display: grid; grid-template-columns: minmax(82px, 1fr) 61px 55px 59px; align-items: center; font-variant-numeric: tabular-nums; }
.watchlist-columns { min-height: 31px; padding: 0 9px; border-bottom: 1px solid #e2e7ef; color: #7b8799; background: #fafbfc; font-size: 0.61rem; font-weight: 750; }
.watchlist-columns button { padding: 0; border: 0; color: inherit; background: transparent; cursor: pointer; font: inherit; text-align: right; }
.watchlist-columns button:first-child { text-align: left; }
.watchlist-columns > span { text-align: right; }
.watchlist-feedback { margin: 0; padding: 8px 11px; border-bottom: 1px solid #cde9da; color: #176c45; background: #edf9f2; font-size: 0.68rem; }
.watchlist-feedback[data-tone="error"] { border-color: #f1cbd2; color: #a63145; background: #fff1f3; }
.watchlist-row { position: relative; border-bottom: 1px solid #edf0f5; }
.watchlist-items .watchlist-row-select { width: 100%; min-height: 39px; gap: 0; padding: 6px 9px; border: 0; color: #35425a; background: #fff; cursor: pointer; font-size: 0.66rem; text-align: right; }
.watchlist-items .watchlist-row-select:hover { background: #f7f9fd; }
.watchlist-row.active .watchlist-row-select { background: #eaf1ff; box-shadow: inset 3px 0 #4b7be6; }
.watchlist-row-select span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.watchlist-row-select .watchlist-symbol { color: #263550; font-size: 0.69rem; font-weight: 750; text-align: left; }
.watchlist-row-select .positive { color: #168650; }
.watchlist-row-select .negative { color: #c03a4e; }
.watchlist-row-select .neutral { color: #69768b; }
.watchlist-items .watchlist-remove { position: absolute; top: 7px; right: 3px; width: 24px; min-width: 0; height: 24px; padding: 0; border: 0; border-radius: 4px; opacity: 0; color: #a83749; background: #fff0f2; cursor: pointer; pointer-events: none; }
.watchlist-row:hover .watchlist-remove,
.watchlist-remove:focus-visible { opacity: 1; pointer-events: auto; }
.watchlist-row:hover .watchlist-row-select span:last-child { padding-right: 18px; }

.watchlist-dialog { width: min(420px, calc(100vw - 30px)); padding: 0; border: 1px solid #d8dfeb; border-radius: 10px; color: #34425a; background: #fff; box-shadow: 0 22px 60px rgba(19, 35, 69, 0.24); }
.watchlist-dialog::backdrop { background: rgba(13, 28, 58, 0.38); }
.watchlist-dialog form { display: grid; gap: 14px; padding: 20px; }
.watchlist-dialog h2 { margin: 0; color: #1e2d48; font-size: 1rem; }
.watchlist-dialog label { display: grid; gap: 6px; color: #6f7c91; font-size: 0.7rem; font-weight: 700; }
.watchlist-dialog input,
.watchlist-dialog select { height: 38px; padding: 0 11px; border: 1px solid #d5ddea; border-radius: 7px; color: #33415a; background: #fff; }
.watchlist-dialog form > div:last-child { display: flex; justify-content: flex-end; gap: 8px; }
.watchlist-dialog form > div:last-child button { min-height: 34px; padding: 0 13px; border: 1px solid #d7deea; border-radius: 6px; background: #fff; cursor: pointer; }
.watchlist-dialog form > div:last-child .primary-action { border: 0; color: #fff; background: linear-gradient(100deg, #2866d6, #6848d6); box-shadow: 0 8px 18px rgba(56, 79, 190, 0.2); }
.watchlist-dialog form > div:last-child .primary-action:disabled { opacity: 0.65; cursor: wait; }
.dialog-error { margin: -6px 0 0; color: #b0374c; font-size: 0.7rem; }
.symbol-dialog-context { margin: -7px 0 0; color: #6f7c91; font-size: 0.7rem; }
.indicator-dialog { width: min(720px, calc(100vw - 30px)); }
.indicator-dialog form { grid-template-columns: 1fr 1fr; max-height: min(760px, calc(100vh - 40px)); overflow: hidden; }
.indicator-dialog form > header,
.indicator-dialog form > label,
.indicator-dialog .indicator-categories,
.indicator-dialog .indicator-mode-actions,
.indicator-dialog .dialog-error { grid-column: 1 / -1; }
.indicator-dialog form > header,
.indicator-settings-dialog form > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.indicator-dialog form > header p { margin: 4px 0 0; color: #77849a; font-size: 0.68rem; }
.indicator-dialog form > header button,
.indicator-settings-dialog form > header button { width: 30px; height: 30px; border: 0; color: #607089; background: transparent; cursor: pointer; font-size: 1.25rem; }
.indicator-categories { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.indicator-categories button,
.indicator-mode-actions button { padding: 6px 10px; border: 1px solid #dbe2ee; border-radius: 999px; color: #59677e; background: #fff; cursor: pointer; font-size: 0.66rem; }
.indicator-categories button.active,
.indicator-categories button:hover,
.indicator-mode-actions button { color: #fff; border-color: #416ddd; background: #416ddd; }
.indicator-dialog section { min-width: 0; overflow: hidden; border: 1px solid #e1e6ef; border-radius: 8px; }
.indicator-dialog section h3 { margin: 0; padding: 9px 11px; border-bottom: 1px solid #e7ebf2; color: #384760; background: #f8fafc; font-size: 0.7rem; }
.indicator-active,
.indicator-catalogue { max-height: 360px; overflow-y: auto; }
.indicator-active { color: #8490a2; font-size: 0.69rem; }
.indicator-active-row { display: grid; grid-template-columns: 27px minmax(90px, 1fr) auto 27px 27px auto; align-items: center; gap: 4px; min-height: 42px; padding: 4px 7px; border-bottom: 1px solid #edf0f5; }
.indicator-active-row strong { overflow: hidden; color: #34425a; font-size: 0.68rem; text-overflow: ellipsis; white-space: nowrap; }
.indicator-active-row button { min-height: 27px; padding: 0 6px; border: 0; border-radius: 4px; color: #637189; background: transparent; cursor: pointer; font-size: 0.62rem; }
.indicator-active-row button:hover:not(:disabled) { color: #285fc7; background: #edf3ff; }
.indicator-active-row button:disabled { opacity: 0.4; cursor: default; }
.indicator-catalogue > button { display: flex; width: 100%; min-height: 47px; align-items: center; justify-content: space-between; padding: 7px 11px; border: 0; border-bottom: 1px solid #edf0f5; color: #34425a; background: #fff; cursor: pointer; text-align: left; }
.indicator-catalogue > button:hover:not(:disabled) { background: #f4f7fc; }
.indicator-catalogue > button span { display: grid; gap: 2px; }
.indicator-catalogue small { color: #8994a5; font-size: 0.59rem; }
.indicator-catalogue b { color: #315fd1; font-size: 1.05rem; }
.indicator-settings-dialog { width: min(520px, calc(100vw - 30px)); }
.indicator-tabs { display: flex; gap: 17px; border-bottom: 1px solid #e5e9f0; color: #7b8799; font-size: 0.68rem; }
.indicator-tabs button { padding: 7px 2px; border: 0; color: inherit; background: transparent; cursor: pointer; font-size: inherit; }
.indicator-tabs button.active { color: #315fd1; border-bottom: 2px solid #315fd1; font-weight: 700; }
.indicator-fields,
.indicator-style-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.indicator-fields label,
.indicator-style-fields label { display: grid; gap: 5px; }
.indicator-field-group { grid-column: 1 / -1; margin: .35rem 0 0; padding-top: .65rem; border-top: 1px solid #e4eaf3; color: #16233c; font-size: .8rem; }
.indicator-field-group:first-child { border-top: 0; padding-top: 0; }
.indicator-visible { display: flex !important; grid-template-columns: auto 1fr; align-items: center; }
.indicator-visible input { width: 16px; height: 16px; }
.indicator-plot-fields { display: grid; gap: 6px; margin-top: 12px; }
.indicator-plot-setting { display: grid; grid-template-columns: minmax(90px, 1fr) 38px 54px; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid #e3e9f2; border-radius: 7px; }
.indicator-plot-setting label { display: flex; align-items: center; color: #59677e; font-size: 0.68rem; }
.indicator-plot-setting input[type="checkbox"] { width: 15px; height: 15px; }
.indicator-plot-setting input[type="color"] { width: 34px; height: 26px; padding: 2px; }
.indicator-plot-setting input[type="number"] { width: 52px; height: 28px; padding: 4px 6px; }
.indicator-timeframe-visibility { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; padding: 10px; border: 1px solid #e3e9f2; border-radius: 8px; }
.indicator-timeframe-visibility legend { padding: 0 5px; color: #59677e; font-size: 0.7rem; }
.indicator-timeframe-visibility label { display: flex; align-items: center; color: #59677e; font-size: 0.7rem; }
@media (max-width: 680px) {
  .indicator-dialog form { grid-template-columns: 1fr; overflow-y: auto; }
  .indicator-dialog section { grid-column: 1; }
  .indicator-active, .indicator-catalogue { max-height: 250px; }
  .indicator-active-row { grid-template-columns: 27px minmax(80px, 1fr) auto auto; }
  .indicator-active-row button:nth-of-type(3), .indicator-active-row button:nth-of-type(4) { display: none; }
}
.dialog-search-results { max-height: 280px; overflow-y: auto; border: 1px solid #e1e6ef; border-radius: 7px; }
.dialog-search-results:empty::before { display: block; padding: 18px; color: #8792a4; content: "Search for an instrument"; font-size: 0.72rem; text-align: center; }
.symbol-dialog { width: min(680px, calc(100vw - 30px)); }
.symbol-search-row { display: grid; grid-template-columns: minmax(0, 1fr) 48px 38px; align-items: center; min-height: 52px; padding: 6px 10px 6px 13px; border-bottom: 1px solid #edf0f5; }
.symbol-search-row > span:first-child { display: grid; min-width: 0; gap: 2px; }
.symbol-search-row > span:first-child[role="button"] { cursor: pointer; }
.symbol-search-row > span:first-child[role="button"]:hover strong { color: #285fc7; }
.symbol-search-row strong,
.symbol-search-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.symbol-search-row strong { color: #25334d; font-size: 0.76rem; }
.symbol-search-row span { color: #7a879a; font-size: 0.66rem; }
.symbol-search-row > span:nth-child(2) { text-align: center; }
.symbol-search-row .symbol-add-action { width: 30px; height: 30px; padding: 0; border: 0; border-radius: 5px; color: #2e3c54; background: transparent; cursor: pointer; font-size: 1.35rem; line-height: 1; }
.symbol-search-row .symbol-add-action:hover { color: #285fc7; background: #edf3ff; }
.symbol-search-row .symbol-add-action:disabled { color: #238257; background: #edf8f2; cursor: default; }
.add-current-lists button { display: block; width: 100%; padding: 10px 11px; border: 0; border-bottom: 1px solid #edf0f5; color: #34425a; background: #fff; cursor: pointer; font-size: 0.72rem; text-align: left; }
.add-current-lists button:hover { color: #214fae; background: #edf3ff; }
.dialog-feedback { margin: 0; color: #28774f; font-size: 0.72rem; }

@media (max-width: 1280px) {
  .charting-layout { grid-template-columns: 1fr; }
  .watchlist-panel { position: static; grid-row: 1; }
  .watchlist-items { display: block; max-height: 240px; overflow-y: auto; }
  .watchlist-items button { min-width: 0; }
  .watchlist-state { min-height: 78px; }
  .watchlist-panel > footer { display: flex; justify-content: space-between; }
}

@media (max-width: 800px) {
  .charting-heading { align-items: flex-start; }
  .charting-heading-actions { width: 100%; flex-wrap: wrap; justify-content: space-between; }
  .chart-grid { grid-template-columns: 1fr; }
  .chart-canvas { height: 400px; }
  .chart-panel-state { min-height: 400px; }
  .chart-grid[data-layout="1"] .chart-canvas { height: 500px; }
  .chart-grid[data-layout="1"] .chart-panel-state { min-height: 500px; }
}

@media (max-width: 520px) {
  .charting-heading-actions { align-items: stretch; flex-direction: column; }
  .chart-market-state { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .chart-panel-header { align-items: flex-start; flex-wrap: wrap; }
  .chart-panel-header select { max-width: 118px; }
  .chart-panel-controls { margin-left: auto; gap: 5px; }
  .chart-legend { gap: 7px; padding-inline: 10px; }
  .chart-canvas { height: 360px; }
  .chart-panel-state { min-height: 360px; }
  .chart-grid[data-layout="1"] .chart-canvas { height: 420px; }
  .chart-grid[data-layout="1"] .chart-panel-state { min-height: 420px; }
  .watchlist-panel > footer { flex-direction: column; }
  .watchlist-columns,
  .watchlist-row-select { grid-template-columns: minmax(92px, 1fr) 70px 70px; }
  .watchlist-columns > :nth-child(3),
  .watchlist-row-select > :nth-child(3) { display: none; }
}

/* Market heatmap */
.heatmap-workspace [hidden] { display: none !important; }
.heatmap-workspace { min-width: 0; }
.heatmap-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.heatmap-header .eyebrow { margin: 0 0 5px; color: #4b68ad; font-size: .68rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.heatmap-header h1 { margin: 0; color: #0d2045; font-size: clamp(1.7rem, 3vw, 2.25rem); }
.heatmap-header > div > p:last-child { margin: 6px 0 0; color: #697892; }
.heatmap-controls { display: flex; align-items: end; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.heatmap-controls label { display: grid; gap: 5px; color: #68758a; font-size: .68rem; }
.heatmap-controls select, .heatmap-refresh { height: 38px; padding: 0 12px; border: 1px solid #d6deeb; border-radius: 8px; color: #1e2e4a; background: #fff; }
.heatmap-controls fieldset { display: flex; height: 38px; margin: 0; padding: 0; overflow: hidden; border: 1px solid #d6deeb; border-radius: 8px; }
.heatmap-controls legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.heatmap-controls fieldset button { min-width: 45px; border: 0; border-right: 1px solid #e1e7f0; color: #536078; background: #fff; cursor: pointer; }
.heatmap-controls fieldset button:last-child { border-right: 0; }
.heatmap-controls fieldset button.active { color: #fff; background: linear-gradient(135deg, #286bd9, #6445df); }
.heatmap-refresh { cursor: pointer; font-weight: 700; }
.heatmap-status { display: grid; min-height: 420px; place-content: center; gap: 12px; padding: 30px; border: 1px solid #dbe3ef; border-radius: 14px; color: #697892; background: #fff; text-align: center; }
.heatmap-status a { color: #315fd1; font-weight: 800; }
.heatmap-board { display: flex; min-height: 650px; flex-wrap: wrap; align-content: flex-start; gap: 12px; padding: 0; background: transparent; }
.heatmap-sector { display: flex; min-width: min(340px, 100%); min-height: 180px; flex: var(--sector-weight) 1 360px; flex-direction: column; overflow: hidden; border: 1px solid #e1e8f1; border-radius: 12px; background: #fff; box-shadow: 0 5px 14px rgba(31, 52, 86, .08); }
.heatmap-sector h2 { display: flex; align-items: center; gap: 7px; margin: 0; padding: 10px 13px 7px; color: #17243c; background: #fff; font-size: .7rem; font-weight: 800; }
.heatmap-sector-icon { display: inline-grid; width: 18px; height: 18px; flex: 0 0 18px; place-items: center; color: #3874dc; }
.heatmap-sector-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.heatmap-sector-tiles { display: flex; min-height: 0; flex: 1; flex-wrap: wrap; gap: 4px; padding: 4px; }
.heatmap-tile { display: grid; min-width: 78px; min-height: 78px; flex: var(--tile-weight) 1 calc(var(--tile-weight) * 20px); place-content: center; justify-items: center; gap: 3px; padding: 8px; overflow: hidden; border: 1px solid rgba(117, 139, 166, .14); border-radius: 7px; color: #17243c; text-align: center; text-decoration: none; transition: filter .15s ease, transform .15s ease, box-shadow .15s ease; }
.heatmap-tile[data-direction="gain"] b { color: #087443; }
.heatmap-tile[data-direction="loss"] b { color: #b3263b; }
.heatmap-tile[data-direction="neutral"] b,
.heatmap-tile[data-direction="unavailable"] b { color: #59677d; }
.heatmap-tile:hover, .heatmap-tile:focus-visible { z-index: 1; filter: saturate(1.08); outline: 2px solid #5775d7; outline-offset: -2px; box-shadow: 0 4px 10px rgba(31, 52, 86, .14); transform: translateY(-1px); }
.heatmap-logo { display: grid; width: 30px; height: 30px; place-items: center; overflow: hidden; border-radius: 50%; color: #243451; background: rgba(255, 255, 255, .9); font-size: .62rem; font-weight: 900; text-shadow: none; }
.heatmap-logo img { width: 100%; height: 100%; object-fit: contain; }
.heatmap-tile strong { max-width: 100%; overflow: hidden; font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.heatmap-tile small { display: -webkit-box; max-width: 150px; overflow: hidden; opacity: .82; font-size: .58rem; line-height: 1.2; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.heatmap-tile b { font-size: .82rem; }
.heatmap-legend { display: flex; align-items: center; justify-content: center; gap: 0; margin-top: 12px; color: #718097; font-size: .62rem; }
.heatmap-legend i { width: clamp(28px, 5vw, 65px); height: 8px; }
.heatmap-legend .loss-strong { margin-left: 8px; background: hsl(354 64% 67%); }
.heatmap-legend .loss { background: hsl(354 64% 79%); }
.heatmap-legend .neutral { background: hsl(216 18% 86%); }
.heatmap-legend .gain { background: hsl(148 52% 79%); }
.heatmap-legend .gain-strong { margin-right: 8px; background: hsl(148 52% 67%); }
@media (max-width: 760px) {
  .heatmap-header { align-items: stretch; flex-direction: column; }
  .heatmap-controls { justify-content: flex-start; }
  .heatmap-controls label { flex: 1; }
  .heatmap-controls select { width: 100%; }
  .heatmap-board { min-height: 520px; }
  .heatmap-sector { min-width: 100%; flex-basis: 100%; }
  .heatmap-tile { min-width: 68px; min-height: 68px; padding: 6px; }
  .heatmap-tile small, .heatmap-logo { display: none; }
}

/* 52-week-high screener */
.screener-workspace [hidden] { display: none !important; }
.screener-workspace { min-width: 0; color: #102040; }
.screener-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.screener-heading .eyebrow { margin: 0 0 5px; color: #4b68ad; font-size: .68rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.screener-heading h1 { margin: 0; font-size: clamp(1.7rem, 3vw, 2.25rem); }
.screener-heading p:last-child { margin: 6px 0 0; color: #697892; }
.screener-toolbar { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; padding: 13px; border: 1px solid #dbe3ef; border-radius: 12px; background: #fff; box-shadow: 0 5px 15px rgba(26, 50, 88, .05); }
.screener-toolbar > label { display: grid; gap: 5px; color: #68758a; font-size: .67rem; }
.screener-toolbar select, .screener-index-picker summary { min-width: 135px; height: 38px; padding: 0 11px; border: 1px solid #d6deeb; border-radius: 8px; color: #1e2e4a; background: #fff; font: inherit; }
.screener-search-control { position: relative; display: grid; width: min(300px, 100%); gap: 5px; color: #68758a; font-size: .67rem; }
.screener-search-input { position: relative; }
.screener-search-input input { width: 100%; height: 38px; padding: 0 35px 0 11px; border: 1px solid #bdcce2; border-radius: 8px; outline: none; color: #1e2e4a; background: #fff; font: inherit; font-size: .73rem; }
.screener-search-input input:focus { border-color: #4d79df; box-shadow: 0 0 0 3px rgba(65, 110, 222, .12); }
.screener-search-input button { position: absolute; top: 5px; right: 5px; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 6px; color: #6e7d94; background: transparent; cursor: pointer; font-size: 1rem; }
.screener-search-input button:hover { color: #244e9d; background: #edf3ff; }
.screener-search-results { position: absolute; z-index: 30; top: 62px; right: 0; left: 0; max-height: 310px; overflow-y: auto; border: 1px solid #d4deec; border-radius: 9px; background: #fff; box-shadow: 0 14px 32px rgba(20, 42, 78, .2); }
.screener-search-result { display: grid; width: 100%; grid-template-columns: minmax(0, 1.3fr) minmax(100px, .8fr); gap: 3px 12px; padding: 10px 12px; border: 0; border-bottom: 1px solid #edf1f6; color: #243653; background: #fff; cursor: pointer; text-align: left; }
.screener-search-result:last-child { border-bottom: 0; }
.screener-search-result:hover, .screener-search-result:focus-visible { outline: none; background: #f3f7ff; }
.screener-search-identity { display: grid; min-width: 0; grid-row: 1 / span 2; gap: 2px; }
.screener-search-identity strong { color: #172945; font-size: .73rem; }
.screener-search-identity small, .screener-search-facts, .screener-search-numbers { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.screener-search-identity small { color: #748299; font-size: .61rem; }
.screener-search-facts, .screener-search-numbers { color: #62718a; font-size: .59rem; text-align: right; }
.screener-search-numbers { color: #244e87; font-weight: 800; }
.screener-search-message { display: block; padding: 14px; color: #6f7e95; font-size: .66rem; text-align: center; }
.screener-clear { height: 38px; padding: 0 12px; border: 1px solid #d6deeb; border-radius: 8px; color: #3d5274; background: #fff; cursor: pointer; }
.screener-index-picker { position: relative; }
.screener-index-picker summary { display: grid; align-content: center; cursor: pointer; list-style: none; }
.screener-index-picker summary span { color: #68758a; font-size: .6rem; }
.screener-index-picker summary strong { font-size: .72rem; }
.screener-index-picker > div { position: absolute; z-index: 20; top: 43px; left: 0; display: grid; min-width: 220px; gap: 9px; padding: 12px; border: 1px solid #d6deeb; border-radius: 9px; background: #fff; box-shadow: 0 10px 28px rgba(20, 42, 78, .16); }
.screener-index-picker label { display: flex; align-items: center; gap: 8px; font-size: .72rem; }
.screener-view-toggle, .screener-timeframes { display: flex; height: 38px; margin: 0; padding: 0; overflow: hidden; border: 1px solid #d6deeb; border-radius: 8px; }
.screener-view-toggle legend, .screener-timeframes legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.screener-view-toggle button, .screener-timeframes button { min-width: 54px; border: 0; border-right: 1px solid #e1e7f0; color: #536078; background: #fff; cursor: pointer; }
.screener-view-toggle button:last-child, .screener-timeframes button:last-child { border-right: 0; }
.screener-view-toggle button.active, .screener-timeframes button.active { color: #fff; background: #2169e8; }
.screener-inspector { margin-bottom: 14px; overflow: hidden; border: 1px solid #cfdbea; border-radius: 12px; background: #fff; box-shadow: 0 7px 20px rgba(26, 50, 88, .07); }
.screener-inspector-heading { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 20px; padding: 14px 16px; border-bottom: 1px solid #e5eaf2; }
.screener-inspector-heading h2 { margin: 0; color: #142b4e; font-size: 1rem; }
.screener-inspector-heading p { margin: 3px 0; color: #53627a; font-size: .72rem; }
.screener-inspector-heading small { color: #7b889d; font-size: .62rem; }
.screener-inspector-actions { display: flex; align-items: center; gap: 10px; }
.screener-inspector-actions > strong { color: #163c76; font-size: .82rem; white-space: nowrap; }
.screener-inspector-actions a, .screener-inspector-actions button { display: inline-flex; min-height: 32px; align-items: center; justify-content: center; padding: 0 11px; border: 1px solid #d4deeb; border-radius: 7px; background: #fff; cursor: pointer; font-size: .65rem; line-height: 1; text-align: center; text-decoration: none; }
.screener-inspector-actions .screener-apply-criteria { color: #fff; border-color: #2169e8; background: #2169e8; font-weight: 800; }
.screener-apply-feedback { flex-basis: 100%; color: #1f7652; font-size: .62rem; font-weight: 750; }
.screener-filter-match { margin: 12px 16px 0; padding: 10px 12px; border: 1px solid; border-radius: 8px; font-size: .68rem; }
.screener-filter-match.matches { border-color: #bfe3d2; color: #1f6f50; background: #effaf5; }
.screener-filter-match.fails { border-color: #efc5cc; color: #96384a; background: #fff4f5; }
.screener-filter-match ul { margin: 7px 0 0; padding-left: 18px; color: #5f5360; }
.screener-filter-match li + li { margin-top: 3px; }
.screener-criteria { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 14px 16px; }
.screener-criteria > h3 { grid-column: 1 / -1; margin: 0; color: #294a78; font-size: .71rem; text-transform: uppercase; }
.screener-criteria-group { min-width: 0; padding: 10px; border: 1px solid #e1e7f0; border-radius: 8px; }
.screener-criteria-group h4 { margin: 0 0 7px; color: #52617a; font-size: .64rem; }
.screener-criteria-group > div { display: flex; flex-wrap: wrap; gap: 5px; }
.screener-criterion { padding: 4px 6px; border-radius: 5px; font-size: .59rem; font-weight: 750; }
.screener-criterion.pass { color: #16714d; background: #e8f6ee; }
.screener-criterion.fail { color: #a04454; background: #fbecef; }
.screener-criterion.neutral { color: #68758a; background: #edf1f6; }
.screener-criterion.unavailable { color: #68758a; background: #edf1f6; }
.screener-inspector-details { border-top: 1px solid #e4e9f1; }
.screener-inspector-details > summary { padding: 10px 16px; color: #315587; cursor: pointer; font-size: .67rem; font-weight: 800; }
.screener-inspector-details .screener-detail-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid #e9edf3; }
.screener-feedback { display: grid; min-height: 390px; place-content: center; padding: 30px; border: 1px solid #dbe3ef; border-radius: 12px; color: #697892; background: #fff; text-align: center; }
.screener-results { overflow: hidden; border: 1px solid #dbe3ef; border-radius: 12px; background: #fff; box-shadow: 0 7px 20px rgba(26, 50, 88, .06); }
.screener-results > header { padding: 14px 17px; border-bottom: 1px solid #e2e8f1; }
.screener-results h2 { margin: 0; font-size: .88rem; }
.screener-results header p { margin: 3px 0 0; color: #7a88a0; font-size: .65rem; }
.screener-table-wrap { width: 100%; overflow-x: auto; }
.screener-table { width: 100%; min-width: 1180px; border-collapse: collapse; table-layout: fixed; }
.screener-table th { padding: 10px 8px; color: #61708d; background: #f7f9fc; font-size: .58rem; letter-spacing: .04em; text-transform: uppercase; }
.screener-table td { height: 54px; padding: 8px; border-top: 1px solid #e5eaf2; font-size: .7rem; font-weight: 700; }
.screener-table .col-symbol { width: 17%; text-align: left; }
.screener-table .col-category { width: 7%; text-align: center; }
.screener-table .col-history { width: 9%; text-align: center; }
.screener-table .col-breakout { width: 9%; text-align: center; }
.screener-table .col-number { width: 8%; text-align: right; font-variant-numeric: tabular-nums; }
.screener-table .col-chart { width: 6%; text-align: center; }
.screener-symbol-toggle { display: block; padding: 0; border: 0; color: #102040; background: transparent; font: inherit; font-weight: 900; cursor: pointer; }
.screener-symbol-toggle::after { content: " ▾"; color: #8290a6; font-size: .6rem; }
.screener-symbol-toggle[aria-expanded="true"]::after { content: " ▴"; }
.screener-table td small { display: block; margin-top: 2px; overflow: hidden; color: #78869e; font-size: .59rem; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.screener-metric { display: inline-flex; min-width: 58px; justify-content: flex-end; padding: 5px 7px; border-radius: 6px; font-weight: 800; }
.screener-metric.gain { color: #07824b; background: #e5f5ec; }
.screener-metric.loss { color: #d7263d; background: #fde9ec; }
.screener-metric.neutral { color: #61708a; background: #eef2f7; }
.screener-chart-link { color: #2169e8; font-weight: 800; text-decoration: none; }
.screener-score { color: #163c76; font-size: .82rem !important; font-weight: 900 !important; }
.screener-null { color: #8b96a8; }
.col-breakout:not(.breakout-none) { color: #315b87; }
.screener-detail-row > td { height: auto; padding: 0 !important; background: #f8fafd; }
.screener-detail-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; padding: 16px 20px; border-top: 1px solid #dbe4f0; }
.screener-detail-grid h3 { margin: 0 0 8px; color: #294a78; font-size: .67rem; text-transform: uppercase; }
.screener-detail-grid p { display: flex; justify-content: space-between; gap: 10px; margin: 5px 0; color: #748198; font-size: .63rem; font-weight: 500; }
.screener-detail-grid strong { color: #243856; text-align: right; font-variant-numeric: tabular-nums; }
.screener-card-score { color: #163c76; font-size: 1rem; font-variant-numeric: tabular-nums; }
.screener-chart-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 12px; background: #f5f8fc; }
.screener-chart-card { min-width: 0; overflow: hidden; border: 1px solid #dce4ef; border-radius: 10px; background: #fff; }
.screener-chart-card > header { display: flex; align-items: start; justify-content: space-between; gap: 8px; padding: 10px 11px 5px; }
.screener-chart-card header a { display: block; color: #102040; font-size: .76rem; font-weight: 900; text-decoration: none; }
.screener-chart-card header small { display: block; max-width: 130px; margin-top: 2px; overflow: hidden; color: #78869e; font-size: .56rem; text-overflow: ellipsis; white-space: nowrap; }
.screener-chart-card .screener-metric { min-width: 62px; padding: 4px 6px; font-size: .62rem; }
.screener-chart-facts { display: flex; justify-content: space-between; gap: 8px; padding: 0 11px 5px; color: #52617a; font-size: .59rem; }
.screener-mini-chart { position: relative; height: 175px; }
.screener-chart-state { position: absolute; inset: 0; display: grid; place-content: center; color: #7b899f; font-size: .65rem; }
.screener-pagination { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 11px; border-top: 1px solid #e2e8f1; color: #63718a; font-size: .68rem; }
.screener-pagination button { height: 32px; padding: 0 13px; border: 1px solid #d5deeb; border-radius: 7px; color: #25436f; background: #fff; cursor: pointer; }
.screener-pagination button:disabled { opacity: .45; cursor: default; }
@media (max-width: 1200px) { .screener-chart-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) { .screener-chart-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .screener-detail-grid, .screener-inspector-details .screener-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .screener-criteria { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) {
  .screener-heading { align-items: stretch; flex-direction: column; }
  .screener-search-control, .screener-toolbar > label, .screener-toolbar select, .screener-index-picker, .screener-clear { width: 100%; }
  .screener-search-results { top: 62px; }
  .screener-inspector-heading { align-items: flex-start; flex-direction: column; gap: 10px; }
  .screener-inspector-actions { width: 100%; justify-content: space-between; }
  .screener-criteria { grid-template-columns: 1fr; padding: 12px; }
  .screener-index-picker summary { width: 100%; }
  .screener-view-toggle, .screener-timeframes { flex: 1 1 auto; }
  .screener-view-toggle button, .screener-timeframes button { flex: 1; }
  .screener-chart-grid { grid-template-columns: 1fr; }
  .screener-table-wrap { overflow: visible; }
  .screener-table { min-width: 0; table-layout: auto; }
  .screener-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .screener-table tbody, .screener-data-row { display: block; }
  .screener-data-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 10px; padding: 12px; border: 1px solid #e0e6ef; border-radius: 10px; }
  .screener-table .screener-data-row td { display: flex; width: auto; height: auto; min-height: 37px; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 3px; border: 0; text-align: right; }
  .screener-table .screener-data-row td::before { content: attr(data-label); color: #78859a; font-size: .56rem; font-weight: 600; text-transform: uppercase; }
  .screener-table .screener-data-row .col-symbol { grid-column: 1 / -1; text-align: left; }
  .screener-table .screener-data-row .col-symbol::before { display: none; }
  .screener-table .screener-data-row .col-category, .screener-table .screener-data-row .col-history, .screener-table .screener-data-row .col-breakout, .screener-table .screener-data-row .col-chart, .screener-table .screener-data-row .col-number { text-align: right; }
  .screener-detail-row { display: block; margin: -10px 10px 10px; }
  .screener-detail-row > td { display: block; }
  .screener-detail-grid, .screener-inspector-details .screener-detail-grid { grid-template-columns: 1fr; padding: 14px; border: 1px solid #e0e6ef; border-top: 0; border-radius: 0 0 10px 10px; }
}

/* Settings */
.settings-page > header { margin-bottom: 18px; }
.settings-page > header h1 { margin: 0; font-size: 2rem; }
.settings-page > header p { margin: 5px 0 0; color: #697892; }
.settings-card { max-width: 900px; overflow: hidden; border: 1px solid #dbe3ef; border-radius: 12px; background: #fff; box-shadow: 0 7px 20px rgba(26, 50, 88, .06); }
.settings-card-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; padding: 18px; border-bottom: 1px solid #e5eaf2; }
.settings-card-heading h2 { margin: 0; font-size: 1rem; }
.settings-card-heading p { margin: 5px 0 0; color: #718097; font-size: .72rem; }
.settings-card form { padding: 0 18px 18px; }
.settings-row { display: flex; min-height: 64px; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid #edf1f6; color: #243653; font-size: .76rem; }
.settings-row span:first-child { display: grid; gap: 3px; }
.settings-row small { color: #78869e; }
.settings-row input[type="text"], .settings-row input[type="time"] { width: 170px; height: 36px; padding: 0 9px; border: 1px solid #d5deeb; border-radius: 7px; }
.settings-eod-details { display: grid; grid-template-columns: 160px 1fr; gap: 9px 18px; padding: 16px 0; color: #66758d; font-size: .72rem; }
.settings-eod-details strong { color: #172945; }
.settings-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.settings-actions button { min-height: 36px; padding: 0 14px; border: 1px solid #d5deeb; border-radius: 7px; background: #fff; cursor: pointer; }
.settings-actions button:disabled { opacity: .45; cursor: default; }
.settings-actions .primary-action { color: #fff; border-color: #2169e8; background: #2169e8; }
.status-pill { padding: 5px 9px; border-radius: 999px; color: #325382; background: #eef4ff; font-size: .67rem; font-weight: 800; }
@media (max-width: 620px) { .settings-row { align-items: stretch; flex-direction: column; gap: 9px; padding: 13px 0; } .settings-row input[type="text"], .settings-row input[type="time"] { width: 100%; } }

/* Backtests */
.backtest-workspace [hidden] { display: none !important; }
.backtest-workspace { min-width: 0; color: #102040; }
.backtest-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.backtest-heading .eyebrow { margin: 0 0 5px; color: #4b68ad; font-size: .68rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.backtest-heading h1 { margin: 0; font-size: clamp(1.7rem, 3vw, 2.25rem); }
.backtest-heading p:last-child { margin: 6px 0 0; color: #697892; }
.backtest-top-grid { display: grid; grid-template-columns: minmax(360px, .95fr) minmax(0, 1.25fr); gap: 16px; align-items: stretch; }
.backtest-panel { min-width: 0; overflow: hidden; border: 1px solid #dbe3ef; border-radius: 12px; background: #fff; box-shadow: 0 7px 20px rgba(26, 50, 88, .06); }
.backtest-panel > header { display: flex; min-height: 60px; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 16px; border-bottom: 1px solid #e5eaf2; }
.backtest-panel > header h2 { margin: 0; color: #172945; font-size: .9rem; }
.backtest-panel > header p { margin: 3px 0 0; color: #718097; font-size: .66rem; }
.backtest-config-panel form { position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; padding: 16px; }
.backtest-field { display: grid; min-width: 0; gap: 6px; color: #62708a; font-size: .69rem; font-weight: 700; }
.backtest-field input, .backtest-field select { width: 100%; height: 39px; padding: 0 10px; border: 1px solid #d5deeb; border-radius: 8px; outline: none; color: #1e2e4a; background: #fff; font: inherit; font-size: .76rem; }
.backtest-field input:focus, .backtest-field select:focus { border-color: #4d79df; box-shadow: 0 0 0 3px rgba(65, 110, 222, .12); }
.backtest-strategy-field, .backtest-symbol-field { grid-column: 1 / -1; }
.backtest-symbol-field { position: relative; }
.backtest-symbol-field > label { color: #62708a; font-size: .69rem; font-weight: 700; }
.backtest-symbol-field small { color: #66758d; font-size: .62rem; font-weight: 500; }
.backtest-symbol-results { position: absolute; z-index: 20; top: 66px; right: 0; left: 0; max-height: 220px; overflow-y: auto; border: 1px solid #d5deeb; border-radius: 8px; background: #fff; box-shadow: 0 12px 28px rgba(20, 42, 78, .16); }
.backtest-symbol-results button { display: flex; width: 100%; align-items: baseline; justify-content: space-between; gap: 16px; padding: 10px 11px; border: 0; border-bottom: 1px solid #edf1f6; color: #172945; background: #fff; cursor: pointer; text-align: left; }
.backtest-symbol-results button:last-child { border-bottom: 0; }
.backtest-symbol-results button:hover, .backtest-symbol-results button:focus-visible { background: #f3f7ff; }
.backtest-symbol-results button strong { font-size: .73rem; }
.backtest-symbol-results button span { overflow: hidden; color: #748299; font-size: .65rem; text-overflow: ellipsis; white-space: nowrap; }
.backtest-symbol-empty { display: block; padding: 12px; color: #748299; font-size: .68rem; text-align: center; }
.backtest-range-note { grid-column: 1 / -1; margin: -2px 0 0; color: #61708a; font-size: .65rem; }
.backtest-execution-settings { display: grid; grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px 13px; margin: 2px 0 0; padding: 13px; border: 1px solid #dce4ef; border-radius: 9px; }
.backtest-execution-settings legend { padding: 0 5px; color: #314766; font-size: .72rem; font-weight: 800; }
.backtest-toggle { display: flex; align-items: center; gap: 7px; color: #42536e; font-size: .68rem; font-weight: 700; }
.backtest-toggle input { width: 15px; height: 15px; margin: 0; }
.backtest-fill-policy { display: flex; grid-column: 1 / -1; justify-content: space-between; gap: 12px; margin: 0; color: #66758d; font-size: .63rem; }
.backtest-fill-policy strong { color: #42536e; }
.backtest-config-panel .form-error { grid-column: 1 / -1; margin: 0; padding: 9px 11px; border: 1px solid #f0c2ca; border-radius: 7px; color: #962e42; background: #fff4f5; font-size: .68rem; }
.backtest-run-action { grid-column: 1 / -1; justify-self: start; min-width: 145px; }
.backtest-run-action:disabled { opacity: .62; cursor: wait; }
.backtest-history-panel { min-height: 330px; }
.backtest-history-state { display: grid; min-height: 268px; place-content: center; padding: 24px; color: #7a879b; font-size: .75rem; text-align: center; }
.backtest-history-wrap { max-height: 310px; overflow: auto; }
.backtest-history-table { width: 100%; min-width: 750px; border-collapse: collapse; font-size: .68rem; font-variant-numeric: tabular-nums; }
.backtest-history-table th { position: sticky; z-index: 1; top: 0; padding: 8px 10px; color: #6f7d94; background: #f8fafd; font-size: .58rem; letter-spacing: .03em; text-align: left; text-transform: uppercase; }
.backtest-history-table td { height: 51px; padding: 8px 10px; border-top: 1px solid #e8edf4; color: #35425a; }
.backtest-history-table tbody tr { cursor: pointer; }
.backtest-history-table tbody tr:hover, .backtest-history-table tbody tr:focus-within { outline: none; background: #f5f8ff; }
.backtest-history-table td > strong, .backtest-history-table td > span:not(.backtest-status),
.backtest-history-open strong, .backtest-history-open span { display: block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.backtest-history-table td > span:not(.backtest-status), .backtest-history-open span { margin-top: 3px; color: #66758d; font-size: .59rem; }
.backtest-history-open { max-width: 260px; padding: 0; border: 0; color: #35425a; background: transparent; cursor: pointer; font: inherit; text-align: left; }
.backtest-history-open:focus-visible { outline: 2px solid #416ede; outline-offset: 3px; }
.backtest-history-table .numeric, .backtest-trade-table .numeric { text-align: right; }
.backtest-history-table .actions { text-align: center; }
.backtest-history-delete { min-height: 30px; padding: 0 10px; border: 1px solid #efc5cc; border-radius: 7px; color: #a33649; background: #fff7f8; cursor: pointer; font-size: .62rem; font-weight: 750; }
.backtest-history-delete:hover:not(:disabled), .backtest-history-delete:focus-visible { border-color: #dc8795; background: #fdebed; }
.backtest-history-delete:disabled { opacity: .48; cursor: not-allowed; }
.backtest-history-progress { display: grid; width: 90px; gap: 3px; margin-top: 5px; }
.backtest-history-progress small { overflow: hidden; color: #66758d; font-size: .55rem; text-overflow: ellipsis; white-space: nowrap; }
.backtest-history-progress-track, .backtest-progress-track { display: block; overflow: hidden; border-radius: 999px; background: #e5ebf4; }
.backtest-history-progress-track { width: 90px; height: 4px; }
.backtest-history-progress-track > span, .backtest-progress-track > span { display: block; height: 100%; border-radius: inherit; background: #2169e8; transition: width .2s ease; }
.backtest-status { display: inline-flex; align-items: center; justify-content: center; min-width: 70px; padding: 5px 8px; border-radius: 999px; color: #536078; background: #eef2f7; font-size: .61rem; font-weight: 800; text-transform: capitalize; }
.backtest-status.status-completed { color: #13864b; background: #e8f6ec; }
.backtest-status.status-failed { color: #b13549; background: #fdebed; }
.backtest-status.status-running { color: #245db8; background: #eaf1ff; }
.backtest-status.status-pending { color: #8a641b; background: #fff5d9; }
.backtest-results { margin-top: 16px; }
.backtest-results-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 12px; padding: 2px 2px 0; }
.backtest-results-heading h2 { margin: 0; overflow-wrap: anywhere; color: #172945; font-size: 1.05rem; }
.backtest-results-heading p { margin: 4px 0 0; color: #75839a; font-size: .68rem; }
.backtest-failure, .backtest-lifecycle-state { padding: 28px; border: 1px solid #efc5cc; border-radius: 12px; color: #923448; background: #fff7f8; text-align: center; }
.backtest-lifecycle-state { border-color: #d8e1ef; color: #52617a; background: #fff; }
.backtest-failure p, .backtest-lifecycle-state p { margin: 7px 0 0; font-size: .75rem; }
.backtest-lifecycle-state > small { display: block; margin-top: 8px; color: #7a879b; font-size: .62rem; }
.backtest-progress-line { display: flex; width: min(560px, 100%); align-items: center; gap: 12px; margin: 18px auto 0; }
.backtest-progress-track { flex: 1; height: 11px; }
.backtest-progress-line > strong { min-width: 40px; color: #245db8; font-size: .78rem; font-variant-numeric: tabular-nums; text-align: right; }
.backtest-progress-units, .backtest-failure-progress { color: #66758d; font-variant-numeric: tabular-nums; }
.backtest-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.backtest-kpis article { min-width: 0; padding: 14px; border: 1px solid #dfe6f0; border-radius: 10px; background: #fff; box-shadow: 0 4px 13px rgba(26, 50, 88, .04); }
.backtest-kpis span { display: block; margin-bottom: 7px; color: #5f6e86; font-size: .62rem; font-weight: 700; }
.backtest-kpis strong { display: block; overflow: hidden; color: #172945; font-size: clamp(.95rem, 1.6vw, 1.2rem); font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.backtest-workspace .positive { color: #13864b; }
.backtest-workspace .negative { color: #c53447; }
.backtest-workspace .neutral { color: #667185; }
.backtest-price-panel, .backtest-equity-panel, .backtest-drawdown-panel { margin-bottom: 12px; }
.backtest-price-chart { height: 390px; }
.backtest-research-controls { display: flex; min-height: 40px; align-items: center; gap: 12px; padding: 5px 16px; border-bottom: 1px solid #edf1f6; }
.backtest-timeframe-tabs { display: inline-flex; padding: 2px; border: 1px solid #d8e1ee; border-radius: 8px; background: #f4f7fb; }
.backtest-timeframe-tabs button { min-width: 42px; height: 27px; padding: 0 10px; border: 0; border-radius: 6px; color: #65748b; background: transparent; cursor: pointer; font-size: .66rem; font-weight: 750; transition: background-color .16s ease, color .16s ease, box-shadow .16s ease; }
.backtest-timeframe-tabs button:hover { color: #245ac4; background: #eaf1ff; }
.backtest-timeframe-tabs button[aria-selected="true"] { color: #245ac4; background: #fff; box-shadow: 0 1px 4px rgba(45, 74, 118, .12); }
.backtest-timeframe-tabs button:focus-visible { outline: 2px solid #4d7ddd; outline-offset: 2px; }
.backtest-research-controls .backtest-indicator-controls { flex: 1; padding: 0; border: 0; }
.backtest-chart-view-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; color: #596981; font-size: .62rem; }
.backtest-chart-view-controls label { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; cursor: pointer; }
.backtest-chart-view-controls label:has(input:disabled) { opacity: .45; cursor: default; }
.backtest-research-panes { border-top: 1px solid #edf1f6; }
.backtest-indicator-pane { border-top: 1px solid #edf1f6; background: #fff; }
.backtest-indicator-pane:first-child { border-top: 0; }
.backtest-indicator-pane > header { display: flex; min-height: 30px; align-items: center; justify-content: space-between; padding: 4px 16px; color: #596981; font-size: .62rem; }
.backtest-indicator-pane > header span { font-variant-numeric: tabular-nums; }
.backtest-indicator-pane > div { height: 145px; }
.backtest-equity-panel, .backtest-drawdown-panel, .backtest-trades-panel { border-color: #dce5ef; border-radius: 14px; box-shadow: 0 3px 12px rgba(39, 61, 91, .035); }
.backtest-equity-panel > header, .backtest-drawdown-panel > header, .backtest-trades-panel > header { min-height: 52px; padding: 10px 14px; }
.backtest-equity-chart { height: 260px; }
.backtest-drawdown-chart { height: 210px; }
.backtest-info { display: inline-grid; width: 14px; height: 14px; margin-left: 3px; place-items: center; border: 1px solid #91a0b5; border-radius: 50%; color: #74849a; font-size: .52rem; font-style: normal; vertical-align: 1px; }
.backtest-price-status { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.backtest-price-status p { margin: 0; }
.backtest-focus-chip { display: inline-flex; min-height: 25px; align-items: center; gap: 5px; padding: 2px 7px; border: 1px solid #bdd1f5; border-radius: 7px; color: #285db9; background: #edf4ff; font-size: .63rem; white-space: nowrap; }
.backtest-focus-chip[hidden] { display: none; }
.backtest-focus-icon { font-size: .9rem; line-height: 1; }
.backtest-focus-chip strong { font-weight: 750; }
.backtest-focus-divider { align-self: stretch; width: 1px; margin: 1px 2px; background: #b8cbed; }
.backtest-focus-chip button { display: inline-flex; min-height: 20px; align-items: center; gap: 3px; margin: 0; padding: 0 2px; border: 0; appearance: none; color: inherit; background: transparent; box-shadow: none; cursor: pointer; font: inherit; }
.backtest-focus-chip button:hover { text-decoration: underline; }
.backtest-focus-chip button:focus-visible { border-radius: 2px; outline: 1px solid currentColor; outline-offset: 2px; }
.backtest-chart-legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; color: #62708a; font-size: .62rem; font-weight: 700; }
.backtest-chart-legend span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.backtest-chart-legend span::before { width: 8px; height: 8px; border-radius: 50%; content: ""; }
.backtest-chart-legend .short-entry::before { background: #c53447; }
.backtest-chart-legend .short-exit::before { background: #2169e8; }
.backtest-chart-legend .long-entry::before { background: #13864b; }
.backtest-chart-legend .long-exit::before { background: #d97706; }
.backtest-indicator-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; padding: 8px 16px; border-bottom: 1px solid #edf1f6; color: #596981; font-size: .64rem; }
.backtest-indicator-controls > span { display: flex; flex-wrap: wrap; gap: 8px 12px; }
.backtest-indicator-controls label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.backtest-manage-indicators { min-height: 29px; padding: 0 11px; border: 1px solid #cbd7e8; border-radius: 7px; color: #285fc7; background: #f8faff; cursor: pointer; font: inherit; font-weight: 750; }
.backtest-manage-indicators:hover { border-color: #9db6df; background: #edf3ff; }
.backtest-manage-indicators:focus-visible { outline: 2px solid #7aa5ee; outline-offset: 2px; }
.backtest-indicator-dialog .indicator-active-row { grid-template-columns: 27px minmax(90px, 1fr) auto 27px 27px auto; }
.backtest-indicator-settings-dialog form { max-height: min(760px, calc(100vh - 40px)); overflow-y: auto; }
.backtest-indicator-settings-dialog section { display: grid; gap: 9px; }
.backtest-indicator-settings-dialog section h3 { margin: 0; color: #384760; font-size: .72rem; }
.backtest-indicator-settings-dialog footer { display: flex; justify-content: flex-end; gap: 8px; }
.backtest-indicator-settings-dialog footer button { min-height: 34px; padding: 0 13px; border: 1px solid #d7deea; border-radius: 6px; background: #fff; cursor: pointer; }
.backtest-indicator-settings-dialog footer .primary-action { border-color: #315fd1; color: #fff; background: #315fd1; }
.backtest-indicator-warning { margin: 0; padding: 8px 16px; color: #8a641b; background: #fff9e8; font-size: .65rem; }
.backtest-research-values { min-height: 25px; margin: 0; padding: 5px 16px; overflow: hidden; border-bottom: 1px solid #edf1f6; color: #64748b; background: #fbfcfe; font-size: .61rem; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.backtest-chart-state, .backtest-trade-empty { display: grid; min-height: 180px; place-content: center; padding: 24px; color: #7a879b; font-size: .73rem; text-align: center; }
.backtest-trade-wrap { width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; }
.backtest-trades-header { align-items: flex-end; flex-wrap: wrap; }
.backtest-trade-toolbar { display: flex; max-width: 100%; align-items: center; justify-content: flex-end; flex: 1 1 720px; flex-wrap: wrap; gap: 7px; }
.backtest-trade-toolbar input, .backtest-trade-toolbar select, .backtest-reset-sort, .backtest-download-csv { height: 31px; border: 1px solid #d8e1ed; border-radius: 7px; outline: none; color: #53627a; background: #fbfcfe; font: inherit; font-size: .62rem; transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease; }
.backtest-trade-toolbar input:focus, .backtest-trade-toolbar select:focus, .backtest-reset-sort:focus-visible, .backtest-download-csv:focus-visible { border-color: #90a7cf; box-shadow: 0 0 0 2px rgba(75, 110, 174, .12); }
.backtest-trade-toolbar select { min-width: 104px; padding: 0 25px 0 9px; }
.backtest-trade-search { position: relative; display: flex; align-items: center; }
.backtest-trade-search > span[aria-hidden="true"] { position: absolute; left: 9px; color: #8a98aa; pointer-events: none; }
.backtest-trade-search input { width: 170px; padding: 0 10px 0 26px; }
.backtest-trade-dates { display: flex; align-items: center; gap: 4px; color: #8a98aa; }
.backtest-trade-dates input { width: 123px; padding: 0 7px; }
.backtest-sort-status { color: #697991; font-size: .59rem; white-space: nowrap; }
.backtest-reset-sort { display: inline-flex; align-items: center; gap: 5px; padding: 0 9px; cursor: pointer; color: #4e678f; background: transparent; }
.backtest-reset-sort:hover { border-color: #b5c4da; background: #f4f7fb; }
.backtest-download-csv { display: inline-flex; align-items: center; gap: 5px; padding: 0 9px; border-color: #bdd8c9; color: #24704c; background: #f3fbf6; cursor: pointer; font-weight: 750; }
.backtest-download-csv:hover:not(:disabled) { border-color: #8fc0a5; background: #eaf7ef; }
.backtest-download-csv:disabled { opacity: .5; cursor: default; }
.backtest-entry-indicator-toggle { display: inline-flex; height: 31px; align-items: center; gap: 6px; padding: 0 9px; border: 1px solid #d8e1ed; border-radius: 7px; color: #53627a; background: #fbfcfe; cursor: pointer; font-size: .62rem; white-space: nowrap; }
.backtest-entry-indicator-toggle input { width: 14px; height: 14px; margin: 0; accent-color: #315fd1; }
.backtest-entry-indicator-toggle:focus-within { border-color: #90a7cf; box-shadow: 0 0 0 2px rgba(75, 110, 174, .12); }
.backtest-entry-indicator-status { color: #66758c; font-size: .59rem; white-space: nowrap; }
.backtest-trade-table { width: 100%; min-width: 2480px; border-collapse: collapse; color: #35425a; font-size: .68rem; font-variant-numeric: tabular-nums; }
.backtest-trade-wrap.show-entry-indicators .backtest-trade-table { min-width: 5600px; }
.backtest-trade-table th { padding: 8px 10px; color: #63728a; background: #f6f9fc; font-size: .57rem; letter-spacing: .035em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.backtest-trade-table th.entry-indicator-group { border-left: 2px solid #fff; text-align: center; }
.backtest-trade-table .entry-indicator-cell { text-align: right; }
.backtest-trade-table .entry-indicator-5m { background: #f4f1fb; }
.backtest-trade-table .entry-indicator-1h { background: #eef6fa; }
.backtest-trade-table .entry-indicator-1d { background: #f8f4e9; }
.backtest-trade-table tbody tr:hover .entry-indicator-5m, .backtest-trade-table tbody tr:focus-visible .entry-indicator-5m { background: #ece7f8; }
.backtest-trade-table tbody tr:hover .entry-indicator-1h, .backtest-trade-table tbody tr:focus-visible .entry-indicator-1h { background: #e5f1f7; }
.backtest-trade-table tbody tr:hover .entry-indicator-1d, .backtest-trade-table tbody tr:focus-visible .entry-indicator-1d { background: #f3eddf; }
.backtest-trade-table .trade-sort-button { display: inline-flex; align-items: center; justify-content: flex-end; gap: 4px; margin: 0; padding: 0; border: 0; appearance: none; color: inherit; background: none; box-shadow: none; cursor: pointer; font: inherit; letter-spacing: inherit; text-transform: inherit; }
.backtest-trade-table .trade-sort-button:hover { color: inherit; text-decoration: underline; }
.backtest-trade-table .trade-sort-button:focus-visible { border-radius: 2px; outline: 1px solid currentColor; outline-offset: 3px; }
.backtest-trade-table td { height: 42px; padding: 7px 10px; border-top: 1px solid #e8edf4; white-space: nowrap; }
.backtest-trade-table tbody tr { cursor: pointer; }
.backtest-trade-table tbody tr { transition: background-color .18s ease; }
.backtest-trade-table tbody tr:hover, .backtest-trade-table tbody tr:focus-visible { outline: none; background: #f3f7fc; }
.backtest-trade-table tbody tr[aria-selected="true"] { background: #eaf1ff; box-shadow: inset 3px 0 #2169e8; }
.backtest-trade-table .trade-symbol { color: #172945; font-weight: 800; }
.backtest-trade-table .trade-side { font-weight: 800; }
.backtest-trade-table .trade-side.short { color: #b33b50; }
.backtest-trade-table .trade-side.long { color: #156cbb; }
.backtest-trade-table details { position: relative; }
.backtest-trade-table summary { color: #205fc8; cursor: pointer; font-weight: 750; }
.trade-diagnostics { position: absolute; z-index: 8; right: 0; display: grid; grid-template-columns: max-content max-content; gap: 5px 12px; width: max-content; margin: 6px 0 0; padding: 12px; border: 1px solid #dbe3ef; border-radius: 8px; background: #fff; box-shadow: 0 8px 24px rgba(20,39,70,.14); text-align: left; }
.trade-diagnostics dt { color: #708097; font-weight: 650; }
.trade-diagnostics dd { margin: 0; color: #223652; font-weight: 750; text-align: right; }

@media (max-width: 1120px) {
  .backtest-top-grid { grid-template-columns: 1fr; }
  .backtest-history-panel { min-height: 0; }
  .backtest-history-state { min-height: 180px; }
}

@media (max-width: 760px) {
  .backtest-heading { align-items: flex-start; flex-direction: column; }
  .backtest-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .backtest-equity-chart { height: 235px; }
  .backtest-drawdown-chart { height: 195px; }
  .backtest-price-chart { height: 320px; }
  .backtest-research-controls { align-items: flex-start; flex-direction: column; gap: 6px; padding: 7px 10px; }
  .backtest-indicator-pane > div { height: 125px; }
  .backtest-price-panel > header { align-items: flex-start; flex-direction: column; }
  .backtest-chart-legend { justify-content: flex-start; }
  .backtest-trade-toolbar { flex-basis: 100%; justify-content: flex-start; }
  .backtest-trade-search { flex: 1 1 180px; }
  .backtest-trade-search input { width: 100%; }
  .backtest-trade-dates { flex: 1 1 260px; }
  .backtest-trade-dates label { flex: 1; }
  .backtest-trade-dates input { width: 100%; }
}

@media (max-width: 520px) {
  .backtest-config-panel form { grid-template-columns: 1fr; }
  .backtest-strategy-field, .backtest-symbol-field, .backtest-range-note,
  .backtest-config-panel .form-error, .backtest-run-action { grid-column: 1; }
  .backtest-execution-settings { grid-column: 1; grid-template-columns: 1fr; }
  .backtest-fill-policy { grid-column: 1; flex-direction: column; gap: 3px; }
  .backtest-run-action { width: 100%; }
  .backtest-results-heading { align-items: flex-start; flex-direction: column; }
  .backtest-kpis { gap: 8px; }
  .backtest-kpis article { padding: 12px; }
}
