@layer desktop-table-layout {
  @media (min-width: 761px) {
    body #stocks-section#stocks-section#stocks-section :is(
      .stocks-toolbar-select, .stocks-search-control, .stocks-action-btn
    ) {
      box-sizing: border-box !important;
      height: 36px !important;
      min-height: 36px !important;
      max-height: 36px !important;
      align-self: center !important;
    }
    body #stocks-section#stocks-section#stocks-section .stocks-search-control input {
      box-sizing: border-box !important;
      height: 100% !important;
      min-height: 0 !important;
    }
    body :is(.desktop-table-toolbar,.deposits-history-topbar,.dv-desktop-filters) select {
      box-sizing: border-box !important;
      height: 36px !important;
      min-height: 36px !important;
      max-height: 36px !important;
      padding-top: 0 !important;
      padding-bottom: 0 !important;
      line-height: normal !important;
    }
    body #stocks-gains-section .desktop-table-toolbar #add-stock-gain-btn {
      box-sizing: border-box !important;
      height: 36px !important;
      min-height: 36px !important;
      max-height: 36px !important;
    }
    body .desktop-table-toolbar .leaderboard-filter {
      box-sizing: border-box !important;
      height: 36px !important;
      min-height: 36px !important;
      padding-block: 0 !important;
    }
    body .desktop-table-toolbar .leaderboard-filter select {
      height: 34px !important;
      min-height: 34px !important;
      max-height: 34px !important;
    }
    .desktop-table-shell {
      min-width: 0;
      width: 100%;
      box-sizing: border-box;
      border-radius: 12px;
      background: linear-gradient(125deg,#0c3b47,#092534 40%,#081d2c);
    }
    html[data-appearance="light"] .desktop-table-shell { background: #fff; border: 1px solid #dce7ef; }
    .desktop-table-toolbar {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 12px;
      padding: 12px;
      border-bottom: 1px solid rgba(142,191,207,.18);
    }
    /* Stocks toolbar: search and filters stay left; actions finish at the right. */
    body #stocks-section#stocks-section#stocks-section .desktop-table-toolbar:has(.stocks-action-row) {
      display: grid !important;
      grid-template-columns: minmax(140px, 1.2fr) repeat(3, minmax(80px, 1fr)) repeat(4, max-content) !important;
      align-items: center !important;
      gap: 8px !important;
      padding: 12px !important;
    }
    body #stocks-section#stocks-section#stocks-section#stocks-section .desktop-table-toolbar:has(.stocks-action-row) > :is(.stocks-toolbar, .stocks-action-row) {
      display: contents !important;
    }
    body #stocks-section#stocks-section#stocks-section .desktop-table-toolbar .stocks-search-control { grid-column: 1 !important; grid-row: 1 !important; }
    body #stocks-section#stocks-section#stocks-section #stocks-broker-filter { grid-column: 2 !important; grid-row: 1 !important; }
    body #stocks-section#stocks-section#stocks-section #stocks-sector-filter { grid-column: 3 !important; grid-row: 1 !important; }
    body #stocks-section#stocks-section#stocks-section #stocks-risk-filter { grid-column: 4 !important; grid-row: 1 !important; }
    body #stocks-section#stocks-section#stocks-section #stocks-reset-filters {
      grid-column: 5 !important; grid-row: 1 !important;
      display: inline-flex !important; align-items: center !important;
      height: 36px !important; padding: 0 10px !important;
      background: transparent !important; border: 0 !important;
      color: #a8bfce !important; font: inherit; font-size: 14px !important;
      white-space: nowrap !important; cursor: pointer;
    }
    html[data-appearance="light"] body #stocks-section#stocks-section#stocks-section #stocks-reset-filters { color: #55749a !important; }
    body #stocks-section#stocks-section#stocks-section #import-stocks-btn { grid-column: 6 !important; grid-row: 1 !important; order: 0 !important; }
    body #stocks-section#stocks-section#stocks-section #refresh-stocks-btn {
      grid-column: 7 !important;
      grid-row: 1 !important;
      order: 0 !important;
      width: 46px !important;
      min-width: 46px !important;
      max-width: 46px !important;
    }
    body #stocks-section#stocks-section#stocks-section #add-row-btn { grid-column: 8 !important; grid-row: 1 !important; order: 0 !important; }
    body .desktop-table-toolbar .desktop-table-control-group {
      margin: 0 !important;
      padding: 0 !important;
      border: 0 !important;
      background: transparent !important;
      box-shadow: none !important;
      min-width: 0 !important;
    }
    body .desktop-table-toolbar :is(.stocks-toolbar,.realized-pl-desktop-toolbar,.wd-desktop-toolbar,.leaderboard-filters,.admin-users-filters,.chart-history-controls) { flex: 1 1 auto !important; }
    body .desktop-table-toolbar .stocks-action-row { flex: 0 0 auto !important; }
    body .desktop-table-content {
      margin: 0 !important;
      border-top: 0 !important;
      border-radius: 0 0 12px 12px !important;
    }
    body .desktop-table-content > table { margin-top: 0 !important; }
    body :is(.deposits-history-topbar,.dv-desktop-filters) { margin-bottom: 0 !important; }
  }
}
/* Shared desktop light filters, including app-owned expanded lists. */
@layer desktop-table-layout {
 @media (min-width:1101px) {
  html[data-appearance="light"] body .container > .section select {
    background-color: #fff !important;
    background-image: none !important;
    color: #15345c !important;
    border: 1px solid #d5e3ef !important;
    border-radius: 6px !important;
    box-shadow: none !important;
    font-size: 14px !important;
  }
  html[data-appearance="light"] body .container > .section select:is(:focus,[aria-expanded="true"]) {
    border-color: #00a69f !important;
    outline: 2px solid rgba(0,166,159,.1) !important;
    outline-offset: 1px !important;
  }
  html[data-appearance="light"] body :is(.desktop-dark-filter-menu,.column-filter-menu,.chart-history-filter-menu) {
    background: #fff !important;
    color: #15345c !important;
    border: 1px solid #d5e3ef !important;
    border-radius: 10px !important;
    box-shadow: 0 8px 24px rgba(25,55,85,.15) !important;
  }
  html[data-appearance="light"] body .desktop-dark-filter-menu {
    position: fixed !important;
    z-index: 100000 !important;
    box-sizing: border-box !important;
    padding: 8px !important;
    overflow-y: auto !important;
    scrollbar-color: #cbd7e1 #f5f8fb;
  }
  html[data-appearance="light"] body :is(.desktop-dark-filter-option,.column-filter-option) {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
    text-align: left !important;
    padding: 9px 12px !important;
    border: 0 !important;
    border-radius: 6px !important;
    background: transparent !important;
    color: #15345c !important;
    font-size: 14px !important;
    font-weight: 400 !important;
    cursor: pointer;
  }
  html[data-appearance="light"] body :is(.desktop-dark-filter-option,.column-filter-option):is(:hover,:focus-visible) {
    background: #edf3f7 !important;
  }
  html[data-appearance="light"] body :is(.desktop-dark-filter-option[aria-selected="true"],.column-filter-option.active) {
    background: #e4f5f4 !important;
    color: #009d98 !important;
  }
  html[data-appearance="light"] body .desktop-dark-filter-option[aria-selected="true"]::after {
    content: '✓'; float: right; color: #009d98;
  }
  html[data-appearance="light"] body .desktop-filter-search {
    width: 100%; box-sizing: border-box; padding: 8px 12px;
    margin: 0 0 8px; border: 1px solid #d5e3ef; border-radius: 6px;
    background: #fff; color: #15345c; font: inherit; font-size: 14px;
  }
  html[data-appearance="light"] body .desktop-dark-filter-option[hidden] { display:none !important; }
 }
}
@media (max-width: 760px) {
  #stocks-reset-filters { display: none !important; }
}
