/* Research desks (mutual funds, decision journal), shared with the V3
   workspace. Reads the tokens defined once in v3.css and never redefines them:
   a :root override here split the product into two palettes until 2026-09-22. */
.research-nav {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 0 max(var(--gutter), calc((100% - var(--content-width)) / 2 + var(--gutter)));
  border-bottom: 1px solid var(--rule);
  background: color-mix(in srgb, var(--canvas) 90%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  /* Six sections no longer fit a phone (2026-10-18): the strip scrolls
     sideways instead of cutting off "Decision journal" and "Plans". */
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.research-nav::-webkit-scrollbar { display: none; }
.research-nav button {
  flex-shrink: 0;
  white-space: nowrap;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 12px;
  border: 0;
  color: var(--muted-readable);
  background: none;
  font: 500 14px/1 var(--ui);
  transition: color 140ms ease;
}
.research-nav button:first-child { margin-left: -12px; }
.research-nav button:hover { color: var(--text-strong); }
.research-nav button span { display: none; }
.research-nav button[aria-current="page"] { color: var(--text-strong); font-weight: 600; }
.research-nav button[aria-current="page"]::after {
  position: absolute;
  right: 12px;
  bottom: -1px;
  left: 12px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--brand);
  content: "";
}
.research-nav button:focus-visible { outline-offset: -4px; }

.research-desk { width: min(100%, var(--content-width)); margin: 0 auto; padding: 30px var(--gutter) 72px; font-size: 15px; }
.desk-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 32px; margin: 4px 0 28px; }
.desk-heading h1 { margin: 12px 0 14px; color: var(--text-strong); font: 400 clamp(36px, 4.2vw, 54px)/1.04 var(--display); letter-spacing: -.03em; text-wrap: balance; }
.desk-heading p:not(.eyebrow) { max-width: 40rem; margin: 0; color: var(--muted-readable); font-size: 16px; line-height: 1.65; }
.desk-heading-aside { flex: 0 0 auto; min-width: 12rem; max-width: 15rem; margin-top: 14px; padding: 14px 16px; border: 1px solid var(--rule); border-radius: var(--radius); color: var(--muted-readable); background: var(--paper); box-shadow: var(--shadow-xs); font-size: 13px; line-height: 1.5; }
.desk-heading-aside strong { display: block; margin-bottom: 4px; color: var(--text-strong); font-weight: 600; }

.desk-toolbar { display: flex; align-items: end; gap: 14px; padding: 18px; border: 1px solid var(--rule); border-radius: var(--radius-lg); background: var(--paper); box-shadow: var(--shadow-sm); }
.desk-toolbar label { flex: 1; }
.research-desk label { display: grid; gap: 6px; color: var(--text); font: 500 13px/1.3 var(--ui); }
.research-desk input,
.research-desk select,
.research-desk textarea { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--rule-strong); border-radius: var(--radius); color: var(--text); background: var(--paper); font: 400 15px/1.3 var(--ui); transition: border-color 140ms ease, box-shadow 140ms ease; }
.research-desk textarea { min-height: 104px; resize: vertical; line-height: 1.6; }
.research-desk input:focus,
.research-desk select:focus,
.research-desk textarea:focus { border-color: var(--brand); outline: 0; box-shadow: 0 0 0 4px var(--focus-ring); }

.desk-primary,
.desk-secondary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--radius); font: 600 14px/1 var(--ui); cursor: pointer; transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease; }
.desk-primary { border: 1px solid var(--button); color: var(--on-button); background: var(--button); box-shadow: var(--shadow-xs); }
.desk-primary:hover { border-color: var(--button-hover); background: var(--button-hover); box-shadow: var(--shadow-sm); }
.desk-secondary { border: 1px solid var(--rule-strong); color: var(--text); background: var(--paper); box-shadow: var(--shadow-xs); }
.desk-secondary:hover { border-color: var(--rule-hover); background: var(--paper-sunk); }
.desk-primary:disabled,
.desk-secondary:disabled { opacity: .55; cursor: wait; }

.desk-switch { display: inline-flex; flex-wrap: wrap; gap: 3px; margin-bottom: 20px; padding: 3px; border-radius: var(--radius); background: var(--canvas-wash); }
.desk-switch button { min-height: 38px; border: 0; color: var(--muted-readable); background: transparent; box-shadow: none; font-size: 13px; }
.desk-switch button:hover { color: var(--text-strong); background: transparent; }
.desk-switch button[aria-pressed="true"] { color: var(--text-strong); background: var(--raised); box-shadow: var(--shadow-seg); }

.desk-message { margin: 16px 0; padding: 14px 16px; border: 1px solid var(--rule); border-left: 3px solid var(--brand); border-radius: var(--radius); color: var(--muted-readable); background: var(--paper); font-size: 14px; line-height: 1.6; }
.desk-message.error { color: var(--negative); border-color: color-mix(in srgb, var(--negative) 22%, transparent); border-left-color: var(--negative); background: var(--negative-soft); }
.desk-message.warning { color: var(--warning); border-color: color-mix(in srgb, var(--brass) 28%, transparent); border-left-color: var(--brass); background: var(--warning-soft); }
.desk-empty { margin: 20px 0; padding: 48px 28px; border: 1px dashed var(--rule-strong); border-radius: var(--radius-lg); background: var(--paper); text-align: center; }
.desk-empty h2 { margin: 0 0 10px; color: var(--text-strong); font: 400 28px/1.15 var(--display); letter-spacing: -.02em; }
.desk-empty p { max-width: 38rem; margin: 6px auto; color: var(--muted-readable); line-height: 1.6; }

.desk-section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 28px 0 14px; }
.desk-section-head h2 { margin: 0; color: var(--text-strong); font: 400 26px/1.15 var(--display); letter-spacing: -.02em; }
.desk-meta { color: var(--muted); font-size: 13px; }

.desk-table-scroll { overflow: auto; border: 1px solid var(--rule); border-radius: var(--radius-lg); background: var(--paper); box-shadow: var(--shadow-sm); }
.desk-table { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 14px; text-align: left; }
.desk-table th { padding: 12px 14px; border-bottom: 1px solid var(--rule); color: var(--muted); background: var(--paper-sunk); font: 600 11px/1.3 var(--ui); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.desk-table td { padding: 14px; border-top: 1px solid var(--rule); vertical-align: top; }
.desk-table tbody tr:first-child td { border-top: 0; }
.desk-table tbody tr:hover td { background: var(--paper-sunk); }
.desk-table tr:has(input:checked) td { background: var(--brand-soft); }
.desk-table .num { font-family: var(--ui); font-size: 14px; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.desk-table .fund-name { min-width: 220px; font-weight: 500; line-height: 1.5; }
.desk-table small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; font-weight: 400; }
.desk-table input[type="checkbox"] { width: 18px; height: 18px; min-height: 18px; padding: 0; accent-color: var(--brand); cursor: pointer; }

.desk-compare { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.comparison-card { padding: 20px; border: 1px solid var(--rule); border-radius: var(--radius-lg); background: var(--paper); box-shadow: var(--shadow-sm); }
.comparison-card h3 { margin: 0 0 14px; color: var(--text-strong); font: 600 15px/1.45 var(--ui); }
.comparison-card dl { margin: 0; }
.comparison-card dl div { padding: 10px 0; border-bottom: 1px solid var(--rule); }
.comparison-card dl div:last-child { border-bottom: 0; }
.comparison-card dt { color: var(--muted); font-size: 12px; }
.comparison-card dd { margin: 4px 0 0; color: var(--text-strong); font-size: 14px; font-weight: 600; }

.desk-disclosure { margin: 18px 0; padding: 14px 18px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper); font-size: 14px; }
.desk-disclosure summary { min-height: 28px; color: var(--text-strong); font-weight: 600; cursor: pointer; }
.desk-disclosure p { color: var(--muted-readable); line-height: 1.7; }

.desk-form { padding: 24px; border: 1px solid var(--rule); border-radius: var(--radius-lg); background: var(--paper); box-shadow: var(--shadow-sm); }
.desk-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.desk-form .wide { grid-column: 1 / -1; }
.desk-form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 20px; }
.desk-allocation { display: flex; gap: 2px; height: 12px; margin: 22px 0; overflow: hidden; border-radius: 999px; background: var(--canvas-wash); }
.desk-allocation span { display: block; }
.desk-stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.desk-stat { padding: 18px; border: 1px solid var(--rule); border-radius: var(--radius-lg); background: var(--paper); box-shadow: var(--shadow-sm); }
.desk-stat strong { display: block; margin: 8px 0; color: var(--text-strong); font: 600 28px/1.1 var(--ui); letter-spacing: -.02em; }
.desk-stat span { color: var(--muted); font-size: 13px; }

.journal-list { display: grid; gap: 14px; }
.journal-entry { padding: 24px; border: 1px solid var(--rule); border-radius: var(--radius-lg); background: var(--paper); box-shadow: var(--shadow-sm); }
.journal-entry.is-due { border-color: color-mix(in srgb, var(--brass) 45%, transparent); box-shadow: 0 0 0 3px var(--brass-soft), var(--shadow-sm); }
.journal-entry h2 { margin: 8px 0 14px; color: var(--text-strong); font: 400 26px/1.15 var(--display); letter-spacing: -.02em; }
.journal-entry p { line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.journal-entry .journal-risk { padding: 12px 14px; border-radius: var(--radius-sm); color: var(--warning); background: var(--warning-soft); }
.journal-entry .desk-form-actions { margin-top: 10px; }
.desk-badge { display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 999px; color: var(--brand-strong); background: var(--brand-soft); font: 600 12px/1.2 var(--ui); }
.desk-badge.due { color: var(--warning); background: var(--warning-soft); }
.decision-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; padding: 16px 18px; border: 1px solid var(--rule); border-radius: var(--radius-lg); background: var(--paper); box-shadow: var(--shadow-sm); }
.decision-toolbar p { margin: 4px 0; color: var(--muted-readable); font-size: 14px; }
.decision-toolbar strong { color: var(--text-strong); font-weight: 600; }
.decision-toolbar button { flex-shrink: 0; }
.desk-status { min-height: 1.5rem; margin: 8px 0; color: var(--muted-readable); font-size: 14px; }
.research-desk a { color: var(--brand); text-underline-offset: 3px; }

@media (max-width: 760px) {
  .research-nav {
    gap: 0;
    padding: 0 16px;
    /* A fade at the right edge says the strip goes on. */
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  }
  .research-nav button { padding: 0 10px; font-size: 14px; }
  .research-nav button:first-child { margin-left: -10px; }
  .research-nav button[aria-current="page"]::after { right: 10px; left: 10px; }
  .research-desk { padding: 22px 16px 48px; }
  .desk-heading { display: block; margin-bottom: 22px; }
  .desk-heading-aside { max-width: none; margin: 16px 0 0; }
  .desk-toolbar { flex-direction: column; align-items: stretch; }
  .desk-form-grid,
  .desk-compare { grid-template-columns: 1fr; }
  .desk-form { padding: 18px 16px; }
  .desk-stat-grid { gap: 8px; }
  .desk-stat { padding: 12px; }
  .desk-stat strong { font-size: 22px; }
  .desk-section-head,
  .decision-toolbar { flex-direction: column; align-items: flex-start; }
  .desk-table-scroll { max-width: 100%; }
  .desk-empty { padding: 32px 18px; }
}
@media (prefers-reduced-motion: reduce) { .research-desk * { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }
