/* BrainOff workspace controls: compact, quiet, and touch-safe. */

/* Funding list sorting uses one continuous toolbar instead of grouped pills. */
#appShell .funding-sort-bar {
  min-width: 0;
  margin: 2px 0 12px;
  padding: 7px 0;
  gap: 12px;
  border-top: 1px solid var(--workspace-line);
  border-bottom: 1px solid var(--workspace-line);
  justify-content: flex-start;
}

#appShell .funding-sort-caption {
  flex: 0 0 auto;
  color: var(--workspace-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
}

#appShell .funding-sort-desktop {
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
  gap: 2px;
}

#appShell .funding-sort-btn {
  position: relative;
  min-height: 44px;
  padding: 8px 10px;
  gap: 5px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--workspace-muted);
  font-size: 12px;
  font-weight: 600;
}

#appShell .funding-sort-btn::after {
  content: "";
  position: absolute;
  right: 9px;
  bottom: 5px;
  left: 9px;
  height: 2px;
  background: transparent;
}

#appShell .funding-sort-btn:hover {
  border-color: transparent;
  background: var(--workspace-soft);
  color: var(--workspace-ink);
}

#appShell .funding-sort-btn.active {
  border-color: transparent;
  background: transparent;
  color: var(--workspace-green);
}

#appShell .funding-sort-btn.active::after {
  background: var(--workspace-mint-deep);
}

#appShell .funding-sort-indicator {
  width: 12px;
  color: var(--workspace-muted);
  font-size: 12px;
  font-weight: 500;
}

#appShell .funding-sort-btn.active .funding-sort-indicator {
  color: var(--workspace-mint-deep);
}

/* The month picker is the field; the label no longer draws a second box. */
#appShell .earning-tools {
  min-width: 0;
  gap: 9px;
}

#appShell .earning-month-field {
  min-width: 0;
  min-height: 44px;
  padding: 0;
  gap: 7px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--workspace-muted);
  font-size: 11px;
  font-weight: 600;
}

#appShell .earning-month-field input {
  width: 142px;
  min-width: 0;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--workspace-line-strong);
  border-radius: 8px;
  background: var(--workspace-surface);
  color: var(--workspace-ink);
  font-size: 13px;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
}

#appShell #earningRowsCount {
  color: var(--workspace-muted);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

/* Platform category tabs read as a simple section switch. */
#appShell .benefit-tabs {
  width: 100%;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--workspace-line);
  border-radius: 0;
  background: transparent;
  display: flex;
  gap: 22px;
}

#appShell .benefit-tab {
  position: relative;
  min-width: 0;
  min-height: 44px;
  padding: 8px 1px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--workspace-muted);
  font-size: 13px;
  font-weight: 600;
}

#appShell .benefit-tab::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: transparent;
}

#appShell .benefit-tab:hover {
  border-color: transparent;
  background: transparent;
  color: var(--workspace-ink);
}

#appShell .benefit-tab.active {
  border-color: transparent;
  background: transparent;
  color: var(--workspace-green);
}

#appShell .benefit-tab.active::after {
  background: var(--workspace-mint-deep);
}

#appShell .benefit-tab span {
  margin-left: 4px;
  color: var(--workspace-muted);
  font-size: 10px;
  font-weight: 500;
}

/* Keep referral information and the final action aligned across every card. */
#appShell .benefit-card {
  grid-template-rows: auto minmax(94px, 1fr) auto auto;
  align-content: stretch;
}

#appShell .referral-code {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 44px;
  padding: 0 0 0 2px;
  gap: 8px;
  border: 0;
  border-top: 1px solid var(--workspace-line);
  border-radius: 0;
  background: transparent;
}

#appShell .referral-code span {
  color: var(--workspace-muted);
  font-size: 10px;
  font-weight: 550;
  white-space: nowrap;
}

#appShell .referral-code strong {
  min-width: 0;
  color: var(--workspace-ink);
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .01em;
  text-align: right;
}

#appShell .referral-code button {
  min-width: 44px;
  min-height: 44px;
  padding: 0 7px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--workspace-mint-deep);
  font-size: 12px;
  font-weight: 600;
}

#appShell .referral-code button:hover {
  background: var(--workspace-soft);
  color: var(--workspace-green);
}

#appShell .benefit-actions {
  align-self: end;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  gap: 7px;
}

#appShell .benefit-actions a {
  min-width: 0;
  min-height: 44px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 650;
  text-align: center;
  overflow-wrap: anywhere;
}

#appShell .benefit-actions a:first-child {
  flex: 1 1 auto;
}

#appShell .benefit-actions a.text-link {
  flex: 0 1 auto;
}

@media (max-width: 700px) {
  #appShell .funding-sort-bar {
    padding: 12px 0 0;
    margin-bottom: 12px;
    border-bottom: 0;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px;
  }

  #appShell .funding-sort-caption {
    flex-basis: 100%;
  }

  #appShell .funding-sort-desktop {
    display: none;
  }

  #appShell .funding-sort-mobile {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    gap: 8px;
  }

  #appShell .funding-sort-field {
    display: flex;
    position: relative;
    align-items: center;
    flex: 1;
    min-width: 0;
    height: 48px;
    padding: 0 28px 0 12px;
    border: 1px solid var(--workspace-line);
    border-radius: 10px;
    background: var(--workspace-soft);
  }

  #appShell .funding-sort-field::after {
    content: "";
    position: absolute;
    right: 11px;
    width: 5px;
    height: 5px;
    margin-top: -3px;
    border-right: 1px solid var(--workspace-muted);
    border-bottom: 1px solid var(--workspace-muted);
    transform: rotate(45deg);
    pointer-events: none;
  }

  #appShell .funding-sort-value {
    color: var(--workspace-ink);
    font: 600 14px/1.4 var(--workspace-font);
    white-space: nowrap;
    pointer-events: none;
  }

  #appShell .funding-sort-select {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    min-width: 0;
    height: 100%;
    min-height: 48px;
    padding: 0;
    opacity: 0;
    border: 0;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
  }

  #appShell .funding-sort-field:focus-within {
    outline: 2px solid var(--workspace-mint-deep);
    outline-offset: 2px;
  }

  #appShell .funding-sort-direction {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
    height: 48px;
    min-height: 48px;
    padding: 0 8px;
    border: 1px solid var(--workspace-line);
    border-radius: 10px;
    background: var(--workspace-soft);
    color: var(--workspace-mint-deep);
    box-shadow: none;
    font: 600 14px/1.3 var(--workspace-font);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  #appShell .funding-sort-direction-icon {
    flex: 0 0 auto;
    font-size: 20px;
    line-height: 1;
  }

  #appShell .funding-sort-direction:active {
    background: var(--workspace-mint-deep);
    border-color: var(--workspace-mint-deep);
    color: #fff;
    transform: none;
  }

  #appShell .funding-sort-direction:focus-visible {
    outline: 2px solid var(--workspace-mint-deep);
    outline-offset: 2px;
  }

  #appShell .benefit-tabs {
    gap: 18px;
  }
}

@media (max-width: 700px) and (hover: none) {
  #appShell .funding-sort-direction:hover:not(:active) {
    background: var(--workspace-soft);
    border-color: var(--workspace-line);
    color: var(--workspace-mint-deep);
  }
}

@media (max-width: 360px) {
  #appShell .funding-sort-mobile {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 420px) {
  #appShell .account-earnings-panel .section-head {
    gap: 12px;
  }

  #appShell .earning-tools {
    width: 100%;
    justify-content: flex-start;
  }

  #appShell .earning-month-field {
    flex: 1 1 190px;
  }

  #appShell .earning-month-field input {
    width: auto;
    flex: 1 1 auto;
  }

  #appShell .referral-code {
    grid-template-columns: auto minmax(0, 1fr) 44px;
    gap: 6px;
  }

  #appShell .referral-code strong {
    font-size: 12px;
  }

  #appShell .benefit-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
