/* Research: quiet browsing, readable dossiers, and a compact daily reader. */
.investment-study-library-head {
  flex-wrap: wrap;
}
.investment-study-library-head > p {
  flex: 1 1 180px;
}
.investment-study-library-head .investment-study-add-document {
  flex: 0 0 auto;
  min-height: 44px;
}
/* Keep Research creation controls clear of the persistent microphone dock. */
body:has(.notes-capture-dock:not(.is-in-workspace)) .investment-study-fab-add {
  bottom: calc(env(safe-area-inset-bottom) + 86px);
}

.investment-study-shell,
.investment-study-shell :is(section, article, aside, header, footer, label, fieldset, div) {
  min-width: 0;
}

.investment-study-shell :is(h2, h3, h4, p, strong, a, small),
.investment-study-upload-review,
.investment-study-pdf-meta-preview {
  overflow-wrap: anywhere;
}

.investment-study-filterbar {
  grid-template-columns: minmax(180px, 2fr) minmax(0, 5fr);
}
.investment-study-document-filters {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: .4rem;
}
.investment-study-document-filters > * {
  min-width: 0;
}
.investment-study-decision-review-queue button {
  min-width: 0;
  max-width: 100%;
}
.investment-study-filter-toggle,
.investment-study-reader-tools-toggle,
.investment-study-mission-summary {
  display: none;
}
.investment-study-reader-head-actions {
  flex: 0 0 auto;
}
.investment-study-reader-panel-title {
  align-self: center;
}
.investment-study-shell--reader-focus.investment-study-shell--reader-details-open .investment-study-sidepane {
  display: flex;
}
.investment-study-shell--reader-focus.investment-study-shell--reader-details-open .investment-study-workspace--reader {
  grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
}
.investment-study-note-preview-details,
.investment-study-upload-explanation {
  margin: .4rem 0;
  color: var(--text-secondary);
  font-size: .82rem;
}
.investment-study-note-preview-details > summary,
.investment-study-upload-explanation > summary {
  cursor: pointer;
  padding: .4rem 0;
  color: var(--text-secondary);
}
.investment-study-note-preview-details[open] > summary {
  margin-bottom: .4rem;
}
.investment-study-note-card > footer {
  align-items: center;
}
.investment-study-note-card > footer .investment-study-btn {
  margin-left: auto;
}
.investment-study-shell :is(button, a, summary, input, select, textarea):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.investment-study-reader-autoplay:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media screen and (min-width: 761px) {
  .investment-study-panel--reader > .investment-study-panel-head {
    align-items: center;
    padding-bottom: .35rem;
  }
  .investment-study-business-dossier-fields p,
  .investment-study-business-thesis > header strong,
  .investment-study-note-card p {
    line-height: 1.55;
  }
  .investment-study-note-body-preview > span {
    -webkit-line-clamp: 4;
  }
}

@media screen and (max-width: 1120px) {
  .investment-study-filterbar {
    grid-template-columns: minmax(0, 1fr);
  }
  .investment-study-document-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  }
  .investment-study-shell--reader-focus.investment-study-shell--reader-details-open .investment-study-workspace--reader {
    grid-template-columns: minmax(0, 1fr);
  }
  .investment-study-company-read-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media screen and (max-width: 760px) {
  .investment-study-shell {
    padding: .2rem 0 5rem;
  }
  .investment-study-head {
    gap: .6rem;
  }
  .investment-study-titleline > .investment-study-eyebrow,
  .investment-study-titleline > .investment-study-subhead {
    display: none;
  }
  .investment-study-head h2 {
    font-size: 1.2rem;
    line-height: 1.3;
  }
  .investment-study-metrics {
    display: flex;
    width: 100%;
    gap: .4rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    padding: 2px 0 5px;
    scrollbar-width: thin;
  }
  .investment-study-pill {
    flex: 0 0 auto;
    min-height: 34px;
    max-width: 180px;
    padding: .35rem .55rem;
  }
  .investment-study-pill :is(p, strong) {
    font-size: .76rem;
  }
  .investment-study-tabs {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: .4rem;
    margin: .55rem 0;
  }
  .investment-study-tabs-primary {
    flex: 1 1 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    padding: 3px 1px 6px;
    scrollbar-width: thin;
  }
  .investment-study-tabs-primary > .investment-study-tab {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .investment-study-tab-overflow {
    flex: 0 0 auto;
    width: auto;
    margin: 0;
    align-self: flex-start;
    padding-top: 3px;
  }
  .investment-study-tab,
  .investment-study-tab--overflow {
    min-width: 0;
    min-height: 42px;
    width: auto;
    font-size: .85rem;
    padding: .5rem .7rem;
  }
  .investment-study-overflow-menu {
    left: auto;
    right: 0;
    min-width: 200px;
    max-width: calc(100vw - 2rem);
  }
  .investment-study-overflow-item {
    min-height: 44px;
    font-size: .88rem;
  }
  .investment-study-status {
    font-size: .8rem;
    line-height: 1.5;
    margin-bottom: .5rem;
  }
  .investment-study-status.is-idle {
    display: none;
  }
  .investment-study-mission-overview {
    margin: .25rem 0 .6rem;
    border: 1px solid var(--border-light);
    border-radius: .8rem;
    background: var(--main-surface-secondary);
    padding: .4rem .5rem;
  }
  .investment-study-mission-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: .5rem;
  }
  .investment-study-mission-toggle {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    min-width: 0;
    min-height: 44px;
    padding: .25rem;
    gap: .1rem .35rem;
    border: 0;
    background: none;
    color: var(--text-secondary);
    text-align: left;
    font: inherit;
    cursor: pointer;
  }
  .investment-study-mission-toggle > span:first-child {
    font-size: .7rem;
    color: var(--text-tertiary);
    grid-column: 1;
  }
  .investment-study-mission-toggle > strong {
    display: block;
    font-size: .85rem;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    grid-column: 1;
  }
  .investment-study-mission-toggle > .material-symbols-outlined {
    grid-column: 2;
    grid-row: 1 / 3;
    align-self: center;
  }
  .investment-study-mission-overview:not(.is-expanded) > #research-current-mission {
    display: none;
  }
  .investment-study-mission-overview.is-expanded .investment-study-missionbar {
    margin-top: .5rem;
  }
  .investment-study-panel,
  .investment-study-panel--compact {
    padding: .75rem;
    border-radius: .85rem;
  }
  .investment-study-panel-head {
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: .65rem;
  }
  .investment-study-panel-head h3 {
    font-size: 1rem;
    line-height: 1.4;
  }
  .investment-study-panel-head p {
    font-size: .8rem;
    line-height: 1.5;
  }
  .investment-study-filterbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .5rem;
  }
  .investment-study-filterbar > .investment-study-searchbox {
    grid-column: auto;
  }
  .investment-study-filter-toggle {
    display: inline-flex;
  }
  .investment-study-document-filters {
    display: none;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem;
    padding-top: .25rem;
  }
  .investment-study-filterbar.is-expanded .investment-study-document-filters {
    display: grid;
  }
  .investment-study-document-filters > :last-child {
    grid-column: 1 / -1;
  }
  .investment-study-inline-stats {
    gap: .35rem .75rem;
    margin-top: .65rem;
  }
  .investment-study-inline-stats span {
    border: 0;
    border-radius: 0;
    background: none;
    padding: 0;
    font-size: .78rem;
  }
  .investment-study-shell :is(input, select, textarea):not([type="checkbox"]):not([type="radio"]) {
    min-width: 0;
    max-width: 100%;
    min-height: 44px;
    font-size: 16px;
  }
  .investment-study-btn {
    width: auto;
    max-width: 100%;
    min-height: 44px;
    padding: .55rem .7rem;
    font-size: .85rem;
    white-space: normal;
    justify-content: center;
    text-align: center;
    line-height: 1.35;
  }
  .investment-study-actions {
    flex-direction: row;
    flex-wrap: wrap;
    gap: .5rem;
  }
  .investment-study-actions > .investment-study-btn {
    flex: 1 1 9rem;
  }
  .investment-study-doccard-menu .investment-study-tool-chip,
  .investment-study-tool-chip,
  .investment-study-mini-btn,
  .investment-study-note-edit-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }
  .investment-study-doccard-menu-list {
    min-width: 180px;
    max-width: calc(100vw - 3rem);
  }
  .investment-study-doccard-menu-list button,
  .investment-study-display-limit button {
    min-height: 44px;
    font-size: .8rem;
  }
  .investment-study-doccard-body h4 {
    font-size: .94rem;
    line-height: 1.4;
  }
  .investment-study-doccard-body > p,
  .investment-study-doccard-meta span {
    font-size: .76rem;
    line-height: 1.4;
  }
  .investment-study-doccard-actions {
    grid-template-columns: minmax(0, 1fr);
    gap: .4rem;
  }
  .investment-study-doccard-actions .investment-study-btn {
    font-size: .82rem;
  }
  .investment-study-missionbar {
    padding: .75rem;
    gap: .65rem;
  }
  .investment-study-missionbar-main strong {
    font-size: .95rem;
    line-height: 1.4;
  }
  .investment-study-missionbar-main p {
    font-size: .8rem;
    line-height: 1.5;
  }
  .investment-study-missionbar-actions {
    gap: .5rem;
    flex-wrap: wrap;
  }
  .investment-study-missionbar-actions > .investment-study-btn {
    flex: 1 1 7rem;
  }
  .investment-study-missionbar-stats span {
    padding: .4rem;
  }
  .investment-study-missionbar-stats small {
    font-size: .66rem;
  }
  .investment-study-shell--reader-focus .investment-study-panel--reader {
    padding: .4rem;
  }
  .investment-study-panel--reader > .investment-study-panel-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
  .investment-study-reader-panel-title {
    display: block !important;
    white-space: normal;
    overflow: visible;
    font-size: .98rem;
  }
  .investment-study-reader-panel-title > .material-symbols-outlined {
    vertical-align: middle;
    margin-right: .35rem;
  }
  .investment-study-reader-head-actions {
    justify-content: space-between;
  }
  .investment-study-reader-head-actions .investment-study-btn {
    min-height: 40px;
  }
  .investment-study-shell--reader-focus .investment-study-reader-toolbar {
    top: 0;
    padding: .4rem;
    gap: .4rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .12);
  }
  .investment-study-reader-nav {
    display: grid;
    grid-template-columns: auto minmax(44px, 1fr) auto auto;
    gap: .35rem;
    overflow: visible;
  }
  .investment-study-reader-nav .investment-study-btn {
    min-width: 44px;
    padding: .45rem;
  }
  .investment-study-reader-nav input {
    width: 100%;
    min-width: 0;
    text-align: center;
  }
  .investment-study-reader-tools {
    min-width: 0;
    gap: .4rem;
    overflow: visible;
    flex-wrap: wrap;
    justify-content: flex-start;
  }
  .investment-study-reader-tools-toggle {
    display: inline-flex;
    order: 3;
    margin-left: auto;
  }
  .investment-study-reader-toolbar:not(.is-tools-expanded) .investment-study-reader-tools > :not(.investment-study-reader-tools-toggle):not(.investment-study-tool-chip--readaloud):not(.investment-study-tool-chip--quick-note),
  .investment-study-reader-toolbar:not(.is-tools-expanded) .investment-study-reader-zoom {
    display: none;
  }
  .investment-study-reader-tools .investment-study-reader-voice-select {
    flex: 1 1 calc(50% - .4rem);
    width: calc(50% - .4rem);
    max-width: 100%;
  }
  .investment-study-reader-toolbar.is-tools-expanded .investment-study-reader-tools-toggle {
    order: -1;
    margin-left: 0;
  }
  .investment-study-reader-autoplay {
    min-height: 44px;
    padding: .35rem .6rem;
  }
  .investment-study-reader-zoom {
    gap: .6rem;
  }
  .investment-study-reader-zoom .investment-study-btn {
    min-width: 44px;
  }
  .investment-study-mini-btn--read {
    width: auto;
    font-size: .8rem;
  }
  .investment-study-reader-viewport {
    min-height: 240px;
  }
  .investment-study-shell--reader-focus .investment-study-reader-viewport,
  .investment-study-shell--reader-focus .investment-study-reader-viewport--html,
  .investment-study-shell--reader-focus .investment-study-reader-viewport--html .investment-study-reader-html-document {
    min-height: 240px;
  }
  .investment-study-reader-foot {
    flex-wrap: wrap;
    gap: .5rem;
    font-size: .8rem;
  }
  .investment-study-html-page-paragraph {
    line-height: 1.7;
    text-align: left;
  }
  .investment-study-reader-skip-controls {
    max-width: calc(100vw - 1.5rem);
    gap: .35rem;
    padding: .35rem;
  }
  .investment-study-reader-skip-controls button {
    min-width: 44px;
    min-height: 44px;
  }
  .investment-study-business-dossier-head {
    gap: .75rem;
  }
  .investment-study-business-dossier-head > .investment-study-btn {
    justify-self: start;
  }
  .investment-study-business-dossier-title h3 {
    font-size: 1.2rem;
    line-height: 1.4;
    display: block;
  }
  .investment-study-business-dossier-title p {
    font-size: .8rem;
    line-height: 1.5;
  }
  .investment-study-business-dossier-actions {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
  }
  .investment-study-business-dossier-actions .investment-study-btn {
    flex: 1 1 calc(50% - .5rem);
  }
  .investment-study-business-thesis > header strong,
  .investment-study-business-dossier-fields p,
  .investment-study-note-card p,
  .investment-study-note-preview-details p,
  .investment-study-decision-card p,
  .investment-study-company-summary span,
  .investment-study-subcopy {
    font-size: .94rem;
    line-height: 1.65;
  }
  .investment-study-note-body-preview > span {
    -webkit-line-clamp: 3;
  }
  .investment-study-note-card > header strong {
    font-size: 1rem;
    line-height: 1.4;
  }
  .investment-study-note-preview-details > summary,
  .investment-study-upload-explanation > summary,
  .investment-study-advanced > summary {
    min-height: 44px;
    align-content: center;
    font-size: .88rem;
    line-height: 1.4;
  }
  .investment-study-note-card > footer {
    gap: .5rem;
  }
  .investment-study-note-card > footer > span {
    font-size: .78rem;
  }
  .investment-study-business-kpis,
  .investment-study-business-dossier-kpis,
  .investment-study-decision-kpis,
  .investment-study-mission-kpis,
  .investment-study-activity-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem;
  }
  .investment-study-mission-context,
  .investment-study-grid,
  .investment-study-report-grid,
  .investment-study-company-read-layout,
  .investment-study-decision-options {
    grid-template-columns: minmax(0, 1fr);
  }
  .investment-study-activity-chart {
    width: 100%;
    max-width: 100%;
  }
  .investment-study-activity-table {
    overflow-x: auto;
  }
  .investment-study-activity-table > div {
    grid-template-columns: minmax(100px, 1fr) auto auto auto;
    gap: .5rem;
  }
  .investment-study-activity-table > div > strong::after {
    display: block;
    font-size: .66rem;
    font-weight: 400;
    color: var(--text-tertiary);
  }
  .investment-study-activity-table > div > strong:nth-of-type(1)::after { content: "pages"; }
  .investment-study-activity-table > div > strong:nth-of-type(2)::after { content: "notes"; }
  .investment-study-activity-table > div > strong:nth-of-type(3)::after { content: "time"; }
  .investment-study-modal-backdrop {
    padding: max(.5rem, env(safe-area-inset-top)) .5rem max(.5rem, env(safe-area-inset-bottom));
    overflow: auto;
    overscroll-behavior: contain;
  }
  .investment-study-modal {
    width: min(100%, 680px);
    max-width: 100%;
    max-height: calc(100dvh - 1rem - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }
  .investment-study-modal .investment-study-panel--composer > .investment-study-panel-head {
    position: sticky;
    top: -.75rem;
    z-index: 5;
    padding: .5rem 0;
    background: var(--main-surface-tertiary);
    align-items: center;
    flex-wrap: nowrap;
  }
  .investment-study-modal .investment-study-panel-head > .investment-study-btn {
    flex: 0 0 auto;
  }
  .investment-study-upload-review {
    padding: .65rem;
  }
  .investment-study-upload-review :is(strong, p) {
    line-height: 1.5;
  }
  .investment-study-upload-matches {
    max-height: 35dvh;
  }
  .investment-study-attachment-list > article {
    flex-wrap: wrap;
    gap: .5rem;
  }
  .investment-study-attachment-actions {
    flex-wrap: wrap;
    width: 100%;
  }
  .investment-study-attachment-actions > * {
    flex: 1 1 6rem;
  }
}

@media screen and (max-width: 900px) {
  .investment-study-company-workspace-backdrop {
    inset: 0;
    padding: 0;
    overflow: hidden;
  }
  .investment-study-company-workspace-modal {
    width: 100%;
    max-width: none;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }
  .investment-study-company-workspace-form {
    padding: max(.55rem, env(safe-area-inset-top)) .55rem max(.55rem, env(safe-area-inset-bottom));
  }
  .investment-study-company-workbench {
    display: block;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .investment-study-company-research-sheet {
    min-height: 52dvh;
    margin-bottom: .7rem;
    padding: .85rem;
  }
  .investment-study-company-research-sheet textarea {
    min-height: 38dvh;
  }
  .investment-study-company-editor-fields {
    overflow: visible;
    padding: 0 0 .4rem;
  }
}

@media screen and (max-width: 600px) {
  .investment-study-docgrid,
  .investment-study-docgrid.investment-study-variant-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: .65rem;
  }
  .investment-study-doccard {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: .65rem;
    padding: .6rem;
  }
  .investment-study-doccard-cover {
    align-self: start;
  }
  .investment-study-doccard-body {
    min-width: 0;
    gap: .4rem;
  }
  .investment-study-doccard-body h4 {
    -webkit-line-clamp: 3;
  }
  .investment-study-doccard-menu {
    margin: -.3rem -.3rem 0 0;
  }
  .investment-study-doccard-actions {
    grid-template-columns: minmax(0, 1fr);
  }
  .investment-study-mission-docgrid {
    grid-template-columns: minmax(0, 1fr);
  }
  .investment-study-filter-toggle {
    padding-inline: .5rem;
    font-size: .8rem;
  }
}

@media screen and (max-width: 360px) {
  .investment-study-panel,
  .investment-study-panel--compact {
    padding: .55rem;
  }
  .investment-study-document-filters {
    grid-template-columns: minmax(0, 1fr);
  }
  .investment-study-doccard {
    grid-template-columns: 58px minmax(0, 1fr);
    padding: .45rem;
    gap: .45rem;
  }
  .investment-study-activity-kpis,
  .investment-study-business-dossier-kpis {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .investment-study-shell *,
  .investment-study-shell *::before,
  .investment-study-shell *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}

/* Optional business evidence: a quiet entry point, progressive field comparison. */
.business-lab { border: 1px solid rgba(115,158,180,.25); border-radius: 14px; padding: 16px; }
.business-lab header, .business-lab-toolbar, .business-lab-field { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.business-lab-count, .business-lab-toolbar > span, .business-lab small, .business-lab footer { font-size:11px; opacity:.65; }
.business-lab-intro p, .business-lab-editor > p { font-size:12px; opacity:.75; }
.business-lab-toolbar { margin:12px 0; }
.business-lab h4 { font-size:12px; margin:18px 0 10px; }
.business-lab-row { padding:12px 0; border-top:1px solid rgba(128,148,164,.18); }
.business-lab-field { font-size:12px; margin-bottom:10px; }
.business-lab-field > span { font-size:10px; border:1px solid rgba(128,148,164,.3); border-radius:20px; padding:3px 8px; }
.business-lab-pair { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:14px; }
.business-lab-pair > :last-child { border-left:2px solid rgba(91,177,159,.4); padding-left:12px; }
.business-lab p { white-space:pre-wrap; overflow-wrap:anywhere; line-height:1.6; margin:6px 0 12px; font-size:12px; }
.business-lab label { display:flex; flex-direction:column; gap:6px; font-size:11px; min-width:0; }
.business-lab input, .business-lab select, .business-lab textarea { box-sizing:border-box; max-width:100%; min-width:0; border:1px solid rgba(128,148,164,.3); background:var(--surface, #151c25); color:inherit; padding:9px; border-radius:7px; font:inherit; }
.business-lab textarea { min-height:90px; resize:vertical; width:100%; }
.business-lab-editor { border-top:1px solid rgba(128,148,164,.3); margin-top:12px; }
.business-lab-editor > label, .business-lab-editor > .business-lab-pair { margin:12px 0; }
.business-lab-history { margin-top:16px; font-size:12px; }
.business-lab-history summary { cursor:pointer; }
.business-lab-history article { padding:12px 0; }
.business-lab footer { overflow-wrap:anywhere; }
@media(max-width:480px) { .business-lab { padding:12px; } .business-lab-pair { gap:8px; } .business-lab-toolbar label { width:100%; } }
