/* Compact workspace: spend the viewport on data while keeping readable type. */
body.gleaner-app {
  --v2-topbar-height: 52px;
  --workspace-gutter: 20px;
}
body.gleaner-app > .gleaner-topbar {
  flex: 0 0 auto;
  flex-wrap: nowrap;
  min-height: var(--v2-topbar-height);
  gap: 20px;
  padding: 0 var(--workspace-gutter);
}
body.gleaner-app .gleaner-brand { gap: 8px; margin-right: 0; }
body.gleaner-app .gleaner-brand-symbol { width: 28px; height: 28px; }
body.gleaner-app .gleaner-brand-name { font-size: 20px; }
body.gleaner-app #workbar-rail.gleaner-nav {
  order: 0;
  flex: 1 1 auto;
  width: auto;
  height: var(--v2-topbar-height);
  gap: 2px;
}
body.gleaner-app #workbar-rail .rail-item {
  height: var(--v2-topbar-height);
  min-height: 0;
  padding: 0 10px;
}
body.gleaner-app .gleaner-workspace-context {
  gap: 8px;
  padding: 5px var(--workspace-gutter);
}
body.gleaner-app #btn-account-directory { min-height: 32px; padding: 3px 8px; }
body.gleaner-app #btn-refresh-all { min-height: 30px; padding: 4px 8px; white-space: nowrap; }
body.gleaner-app #detail.v2-workspace { padding: 8px var(--workspace-gutter) 20px; }
/* Anchor the directory to the shell, independent of nav wrapping and preview banners. */
body.gleaner-app #workbar-panel.v2-context-panel,
body.gleaner-app.gleaner-menu-open #workbar-panel.v2-context-panel {
  position: absolute;
  top: 42px;
  left: var(--workspace-gutter);
  max-width: calc(100% - 2 * var(--workspace-gutter));
  max-height: min(600px, calc(100% - 54px));
}
body.gleaner-app .shell:not(.workbar-collapsed) > .workbar-scrim[aria-hidden="false"] {
  position: absolute;
  inset: 0;
}
body.gleaner-app :is(.gleaner-page-heading, .detail-head) { align-items: center; gap: 8px; margin-bottom: 10px; }
body.gleaner-app .detail-head > div:first-child { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
body.gleaner-app :is(.gleaner-page-heading h1, .detail-head h1, .detail-head h2) { font-size: 21px; }
body.gleaner-app :is(.gleaner-page-heading p, .detail-head p) { margin-top: 2px; }
body.gleaner-app :is(.tabs, .account-subtabs, .config-subtabs, .gleaner-subnav, .pnl-view-tabs) { gap: 3px; margin-bottom: 8px; }
body.gleaner-app .tabs.account-primary-tabs { gap: 4px; margin-bottom: 10px; }
body.gleaner-app :is(.tabs .tab, .account-subtab, .config-subtabs .tab, .pnl-view-tab, .gleaner-subnav > button) { min-height: 32px; padding: 5px 10px; }
body.gleaner-app .detail-symbol-filter { gap: 8px; margin-bottom: 8px; padding: 5px 9px; }
body.gleaner-app :is(.block, .ops-sub, .account-action-stage) { padding: 12px; margin-bottom: 12px; border-radius: 9px; }
body.gleaner-app :is(.block .block, .block .ops-sub) { padding: 10px; }
body.gleaner-app :is(.block h3, .ops-sub-title) { margin-bottom: 8px; }
body.gleaner-app .block-toolbar { gap: 8px; margin-bottom: 8px; }
body.gleaner-app .block-toolbar h3 { margin: 0; }
body.gleaner-app .block:has(> .gleaner-column-settings) { padding: 12px; }
body.gleaner-app .block > .gleaner-column-settings { top: 12px; right: 12px; }
body.gleaner-app .hodl-long-batch-toolbar { margin-bottom: 8px; }
body.gleaner-app .gleaner-overview-summary { gap: 16px; margin-bottom: 12px; padding: 16px 18px; border-radius: 10px; }
body.gleaner-app :is(.gleaner-overview-grid, .ov-grid) { gap: 12px; }
body.gleaner-app .v2-metric-strip { margin-bottom: 12px; }
body.gleaner-app .v2-metric { min-height: 76px; padding: 12px 16px; gap: 4px; }
body.gleaner-app .v2-metric strong { font-size: 23px; }
body.gleaner-app .gleaner-section-heading { margin-bottom: 8px; }
body.gleaner-app #gleaner-research-tools { margin: 0 var(--workspace-gutter); max-height: none; overflow: visible; }
body.gleaner-app .gleaner-research-heading { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
body.gleaner-app .gleaner-research-nav {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  padding: 4px 0;
  overflow-x: auto;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  scrollbar-width: thin;
}
body.gleaner-app .gleaner-research-group { flex: 0 0 auto; padding-right: 10px; border-right: 1px solid var(--border); }
body.gleaner-app .gleaner-research-group:last-child { border-right: 0; padding-right: 0; }
body.gleaner-app .gleaner-research-group > span { display: none; }
body.gleaner-app .gleaner-research-group > div { display: flex; flex-wrap: nowrap; gap: 2px; }
body.gleaner-app .gleaner-research-group button { white-space: nowrap; min-height: 32px; padding: 5px 9px; }
body.gleaner-app :is(.market-data-head, .grid-ob-head) { gap: 10px; margin-bottom: 12px; }
body.gleaner-app :is(.market-control-group, .market-control-actions) { padding: 10px; }
body.gleaner-app .market-control-fields { gap: 8px; }
/* Research disclosures keep their summary in the same row in both states. */
body.gleaner-app #detail .tech-details:not(.tech-details-block),
body.gleaner-app #detail .tech-details:not(.tech-details-block)[open] {
  display: block;
  width: 100%;
  min-width: 0;
  margin: 0 0 4px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow-anchor: none;
}
body.gleaner-app #detail .tech-details:not(.tech-details-block) > summary {
  box-sizing: border-box;
  width: fit-content;
  max-width: 100%;
  min-height: 32px;
  margin: 0;
  padding: 6px 0;
  border: 0;
  line-height: 1.6;
}
body.gleaner-app #detail .tech-details:not(.tech-details-block) > :not(summary) { margin: 6px 0 8px; }
/* The selected research tab already names this view; keep its heading for navigation. */
body.gleaner-app .market-history .mh-heading h2 { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
body.gleaner-app .market-history .mh-mode-switch { flex-shrink: 0; }
body.gleaner-app .market-history .mh-mode-switch button { white-space: nowrap; }

/* Desktop rows are tighter; mobile action targets retain their existing 44px minimum. */
@media (min-width: 761px) {
  body.gleaner-app button { min-height: 32px; padding: 5px 10px; }
  body.gleaner-app :is(input:not([type="checkbox"]):not([type="radio"]), select) { min-height: 32px; padding: 5px 10px; }
  body.gleaner-app button.btn-xs { min-height: 28px; padding: 3px 8px; }
  body.gleaner-app .account-primary-action { min-height: 32px; }
  body.gleaner-app th { height: 34px; padding: 7px 10px; }
  body.gleaner-app td { height: 36px; padding: 4px 10px; }
  body.gleaner-app th.market-data-col-head .market-data-col-inner { min-height: 34px; padding: 5px 8px; }
  body.gleaner-app :is(.market-data-sort-button, .market-data-col-sort, .market-data-col-filter) { min-height: 24px; padding: 2px 4px; }
  body.gleaner-app .sym-refresh-btn { min-width: 27px; min-height: 27px; width: 27px; height: 27px; padding: 0; }
  body.gleaner-app .market-data-head:not(:has(> .market-control-group)) > button,
  body.gleaner-app .market-data-head > .ops-field:has(> button) > button,
  body.gleaner-app .market-data-head > .ops-field > .btn-group-inline,
  body.gleaner-app .market-data-head > .ops-field > .btn-group-inline > button { min-height: 32px; }
}
@media (min-width: 761px) and (max-width: 1000px) {
  body.gleaner-app > .gleaner-topbar { gap: 12px; }
  body.gleaner-app #workbar-rail .rail-item { min-width: 64px; gap: 4px; padding: 0 7px; }
  body.gleaner-app #workbar-rail .rail-glyph { display: none; }
}
@media (max-width: 760px) {
  body.gleaner-app { --v2-topbar-height: 56px; --workspace-gutter: 12px; }
  body.gleaner-app > .gleaner-topbar { flex-wrap: wrap; gap: 6px 10px; padding: 6px var(--workspace-gutter); }
  body.gleaner-app .gleaner-brand { margin-right: auto; }
  body.gleaner-app .gleaner-menu-toggle { min-height: 44px; }
  body.gleaner-app #detail .tech-details:not(.tech-details-block) > summary { min-height: 44px; padding: 10px 0; }
  body.gleaner-app #workbar-rail.gleaner-nav { order: 3; flex: 1 1 100%; width: 100%; height: 44px; margin: 0; }
  body.gleaner-app #workbar-rail .rail-item { height: 44px; min-height: 44px; }
  body.gleaner-app #btn-account-directory { min-height: 44px; max-width: calc(100vw - 110px); }
  body.gleaner-app #btn-refresh-all { min-height: 44px; }
  body.gleaner-app #workbar-panel.v2-context-panel,
  body.gleaner-app.gleaner-menu-open #workbar-panel.v2-context-panel { top: 54px; max-height: calc(100% - 66px); }
  body.gleaner-app .gleaner-research-nav { padding: 2px 0; }
  body.gleaner-app .gleaner-research-group button { min-height: 44px; padding: 9px 10px; }
  body.gleaner-app :is(.tabs, .account-subtabs, .config-subtabs, .gleaner-subnav) { flex-wrap: nowrap; }
  body.gleaner-app :is(.tabs .tab, .account-subtab, .config-subtabs .tab, .pnl-view-tab, .gleaner-subnav > button) { min-height: 44px; padding: 9px 10px; white-space: nowrap; }
  body.gleaner-app .detail-head-actions { gap: 6px; }
  body.gleaner-app .block > .gleaner-column-settings { top: auto; right: auto; }
  body.gleaner-app .gleaner-overview-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 14px; }
  body.gleaner-app .gleaner-equity { grid-column: 1 / -1; }
  body.gleaner-app :is(.gleaner-risk-summary, .gleaner-position-summary) { padding: 10px 0 0; gap: 4px; }
  body.gleaner-app .gleaner-risk-summary strong { font-size: 21px; }
}
