/* Shared refinement of the established green research workspace. */
:root { --muted: #52635a; --paper: #f2f5f2; --line: #dbe4dd; --shadow: 0 12px 30px rgba(25,49,41,.055); }
body { font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
::selection { background: #c4dfd0; color: #143c2a; }
:is(button, a, input, select, summary, textarea):focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
input, textarea { caret-color: var(--green); }
button:disabled { cursor: wait; opacity: .55; }
a { text-underline-offset: 3px; }
.workspace-nav { background: #f8faf8; color: var(--ink); border-right-color: var(--line); }
.workspace-nav-brand { padding-bottom: 22px; color: var(--green-deep); border-bottom-color: var(--line); }
.workspace-nav-brand small, .workspace-nav-status { color: var(--muted); }
.workspace-nav-brand > span { color: var(--green-deep); }
.workspace-nav-group + .workspace-nav-group { border-top-color: var(--line); }
.workspace-nav-button { border-radius: 8px; color: var(--ink); }
.workspace-nav-button > span { color: var(--green-deep); background: var(--green-soft); }
.workspace-nav-button:hover { color: var(--green-deep); background: #eaf1ec; }
.workspace-nav-button.is-active > span { color: #fff; background: #397760; }
.workspace-nav-button.is-active { background: var(--green-deep); color: #fff; box-shadow: none; }
.workspace-nav-sub a { line-height: 1.6; color: var(--muted); }
.workspace-nav-sub a::before { background: #789486; }
.workspace-nav-sub a.is-current { color: var(--green-deep); background: var(--green-soft); }
.workspace-nav-items { scrollbar-color: #9fb7aa transparent; }
.workspace-nav-items::-webkit-scrollbar-thumb { background: #9fb7aa; }
.workspace-nav-sub { border-left-color: var(--line); }
.bt-home-entry { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 18px; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.bt-home-entry a { display: inline-flex; align-items: center; gap: 8px; color: var(--green-deep); font-weight: 700; text-decoration: none; }
.workspace-nav-sub a:hover { color: var(--green-deep); background: var(--green-soft); }
.workspace-nav-sub a.bt-nav-link { color: var(--green-deep); font-weight: 700; }
.topbar { border-bottom: 1px solid var(--line); }
.button { border-radius: 8px; box-shadow: none; transition: background-color .16s ease, color .16s ease; }
.button:hover { transform: none; }
.button.primary { box-shadow: none; }.button.primary:hover { background: #176b4d; }
.panel { box-shadow: none; border-color: var(--line); }
.panel-header { align-items: center; }
.panel-subtitle { line-height: 1.65; }
.cockpit-card { box-shadow: none; }
.cockpit-card-head { font-weight: 600; }
.hero-panel .hero-note { max-width: 70ch; }
.decision-cockpit .date-row { display: grid; grid-template-columns: minmax(0,1.25fr) minmax(0,1fr) auto; gap: 8px; }
.decision-cockpit .date-row input { min-width: 0; width: 100%; height: 44px; }
.decision-cockpit .date-row .button { padding: 10px 12px; white-space: nowrap; }
.table-wrap tbody tr:hover { background: #f3f8f4; }
.table-wrap th { font-weight: 600; }
.workspace-view { min-width: 0; }
@media (min-width: 1100px) { .shell { padding-left: 32px; padding-right: 32px; }.topbar { padding-top: 20px; padding-bottom: 20px; } }
@media (max-width: 760px) { .topbar { gap: 14px; }.panel-header { gap: 12px; }.panel-subtitle { font-size: 12px; }.button { min-height: 38px; }.workspace-nav-sub a { padding-top: 8px; padding-bottom: 8px; } }
@media(prefers-reduced-motion: reduce) { .button { transition: none; } }

/* Shared actions keep their hierarchy across the research workspaces. */
.app-frame .button.primary {
  color: #fff;
  background: var(--green-deep);
  border-color: var(--green-deep);
}
.app-frame .button.primary:hover:not(:disabled) { background: #176b4d; }
.app-frame .button:is(.secondary, .ghost):not(:where(.top-actions-tools *)) {
  color: var(--green-deep);
  background: #fff;
  border: 1px solid #789588;
}
.app-frame .button:is(.secondary, .ghost):not(:where(.top-actions-tools *)):hover:not(:disabled) {
  background: #edf5f0;
}
.app-frame button:disabled { cursor: not-allowed; transform: none; }
.app-frame .button:disabled {
  color: #53665b;
  background: #edf1ee;
  border-color: #b9c8c0;
  opacity: 1;
  transition: none;
}
.app-frame :is(.button, summary, .rk-row, .t4-mobile-card, .table4-main-row):focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}
.app-frame .home-current-decision :is(.button, a, summary):focus-visible { outline-color: #b4e1c8; }
.app-frame :is(.button, summary, .rk-row, .t4-mobile-card) { -webkit-tap-highlight-color: rgba(23, 107, 77, .14); }

/* Preserve the native summary hit area and use one trailing indicator. */
.app-frame :is(.workspace-view, #muyuOverview, #muyuHoldingsPanel, #muyuView, #article-reading, #sectorLowWatch) details > summary:not(:where(dialog *)) {
  position: relative;
  inline-size: 100%;
  max-inline-size: 100%;
  padding-inline-end: 2rem;
  align-content: center;
  list-style: none;
  cursor: pointer;
  touch-action: manipulation;
}
.app-frame .workspace-view details > summary:not(:where(dialog *))::-webkit-details-marker { display: none; }
.app-frame .workspace-view details > summary:not(:where(dialog *))::marker { content: ""; }
.app-frame .workspace-view details > summary:not(:where(dialog *))::after,
.app-frame .workspace-view .rk-row::after {
  content: "";
  position: absolute;
  inset-inline-end: .75rem;
  inset-block-start: 50%;
  inline-size: .44rem;
  block-size: .44rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
.app-frame .workspace-view details[open] > summary:not(:where(dialog *))::after,
.app-frame .workspace-view .rk-row[aria-expanded="true"]::after {
  transform: translateY(-25%) rotate(225deg);
}
.app-frame #sectorLowWatch details > summary::before,
.app-frame .workspace-view .portfolio-holdings-summary::before { content: none; }
.app-frame .workspace-view details > summary:not(:where(dialog *)) :is(.fold-hint, i[aria-hidden="true"]) { display: none; }
.app-frame .workspace-view .rk-row { position: relative; padding-inline-end: 2rem; touch-action: manipulation; }
.app-frame .workspace-view .rk-row::after { inset-block-start: 1.1rem; }

@media (max-width: 700px) {
  .app-frame .topbar { flex-wrap: nowrap; }
  .app-frame .topbar .brand > :last-child { min-inline-size: 0; }
  .app-frame .topbar .top-actions { flex: 0 0 auto; width: auto; gap: 0; }
  .app-frame #mobileManageButton {
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    min-inline-size: 44px;
    min-block-size: 44px;
  }
  .app-frame #mobileConnectNotice { margin-inline-start: 8px; }
  .app-frame :is(.workspace-view, #muyuOverview, #muyuHoldingsPanel, #muyuView, #article-reading, #sectorLowWatch) details > summary:not(:where(dialog *)) {
    min-block-size: 44px;
  }
}

/* Data direction is distinct from action controls, selection and qualitative ratings. */
:root {
  --data-positive: #08746a;
  --data-negative: #a52a32;
  --data-neutral: #52635a;
  --state-up: var(--data-positive);
  --state-down: var(--data-negative);
}
.data-number {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.data-positive, .app-frame :is(.muyo-up, .market-up, .etfr-up, .mt-up, .battle-up), .backtest-page .bt-positive {
  color: var(--data-positive);
}
.data-negative, .app-frame :is(.muyo-down, .market-down, .etfr-down, .mt-down, .battle-down), .backtest-page .bt-negative {
  color: var(--data-negative);
}
#marketView :is(.timing-value-up, .market-value-up) { color: var(--data-positive) !important; }
#marketView :is(.timing-value-down, .market-value-down) { color: var(--data-negative) !important; }
.data-neutral { color: var(--data-neutral); }
.workspace-nav-sub a:not(.is-current):hover {
  color: var(--green-deep);
  background: transparent;
  text-decoration: underline;
}
.workspace-nav-sub a.is-current {
  font-weight: 700;
}

.workspace-result-status {
  display: grid;
  justify-items: start;
  gap: 4px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf8;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.workspace-result-status[data-result-state="error"] {
  border-color: #e3c7bd;
  background: #fff9f6;
}
.workspace-result-status > p { margin: 0; }
.workspace-result-status .workspace-result-title {
  color: var(--ink);
  font-size: inherit;
  font-weight: 650;
}
.app-frame :is(#article-reading, #etfResearch) .workspace-result-status .workspace-result-action {
  display: inline-flex;
  align-items: center;
  width: auto;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid #789588;
  border-radius: 8px;
  background: #fff;
  color: var(--green-deep);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.app-frame :is(#article-reading, #etfResearch) .workspace-result-status .workspace-result-action:hover:not(:disabled) { background: #edf5f0; }

@media (max-width: 700px) {
  .app-frame :is(#article-reading, #etfResearch) .workspace-result-status .workspace-result-action { min-height: 44px; }

  .app-frame .workspace-page-head .workspace-page-date,
  #muyuOverview .muyo-rec-score-group > small,
  #muyuOverview .muyo-rec-metrics small,
  #muyuOverview .muyo-rec-average-rank,
  #muyuOverview .muyo-week-stat small,
  #muyuOverview .muyo-note {
    font-size: 13px;
    line-height: 1.6;
  }
  #muyuOverview .muyo-rec-metrics small,
  #muyuOverview .muyo-note {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .app-frame #homeHoldingsSection .user-fund > small,
  .app-frame #homePortfolioStrip > small,
  .app-frame #decisionSummaryCard .summary-desc {
    font-size: 14px;
    line-height: 1.6;
  }
}

@media (width > 820px) {
  .workspace-nav-items { gap: 9px; margin-top: 10px; }
  .workspace-nav-section { min-width: 0; }
  .workspace-nav-section + .workspace-nav-section {
    border-top: 1px solid var(--line);
    padding-top: 10px;
  }
  .workspace-nav-section h2 {
    margin: 0 0 4px;
    padding-inline: 10px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
    line-height: 1.5;
  }
  .workspace-nav-section .workspace-nav-group + .workspace-nav-group {
    margin: 0;
    padding: 0;
    border: 0;
  }
  .workspace-nav-section .workspace-nav-button {
    gap: 7px;
    padding-inline: 7px;
    min-height: 44px;
  }
  .workspace-nav-section .workspace-nav-button strong {
    font-size: 14px;
    letter-spacing: 0;
    text-wrap: balance;
  }
}

.decision-desktop-label { display: none; }
@media (width > 820px) {
  .decision-phone-label { display: none; }
  .decision-desktop-label { display: inline; }
  .workspace-nav-group[data-nav-group="decision"] .workspace-nav-sub a {
    padding-inline-end: 4px;
    white-space: normal;
    text-wrap: balance;
  }
}
