/* Host/accessibility, app-bar navigation and intrinsic-size containment.
   MuiBlazor still owns the palette, typography tokens, grid and control styling. */
html, body { margin: 0; }
* { box-sizing: border-box; }
.app-shell {
  --daytrader-appbar-offset: calc(var(--wf-mui-appbar-height) + env(safe-area-inset-top, 0px));
  min-height: 100dvh;
}
#main-content { width: 100%; min-width: 0; overflow-wrap: anywhere; }
/* Flex/grid descendants must be allowed to shrink BEFORE their scroll region
   can contain wide tables; a max-width on the table wrapper alone is insufficient. */
#main-content > * { min-width: 0; max-width: 100%; }
/* The pinned WF.MuiBlazor Container combines width:100% with 16px margins
   on both sides. Nested Containers must account for those native margins to
   avoid cumulative horizontal overflow; ma-0 Containers have no such margins.
   Native padding, breakpoints, Items, max sizes and control paint remain intact. */
#main-content .wf-mui-container:not(.ma-0):not(.mx-0) { width: calc(100% - 2rem); }
/* Only native grid Items need their flex min-content constraint relaxed.
   Never globally resize all descendants or override MenuItem styling. */
#main-content .wf-mui-item { min-width: 0; }
/* A DisclosureCard is a native flex Card hosted by a native Item. Its wide
   mounted table descendants must scroll within .data-scroll, not make the
   Card's automatic min-content width expand the entire page. */
#main-content .wf-mui-card,
#main-content .wf-mui-card-content {
  min-width: 0;
  max-width: 100%;
}
/* Native action labels must wrap inside the page column even when the
   desktop sidebar or a nested Mui grid narrows it at tablet/desktop widths.
   Never hide document overflow or discard required financial columns. */
#main-content .wf-mui-button {
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}
.data-scroll { min-width: 0; max-width: 100%; overflow-x: auto; }
#main-content pre { max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; }
#main-content img { max-width: 100%; height: auto; }
[hidden] { display: none !important; }
.skip-link { position: absolute; left: -10000px; top: 0; }
.skip-link:focus { left: 1rem; top: .5rem; z-index: 10000; padding: 1rem; background: Canvas; color: CanvasText; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
#blazor-error-ui { display: none; position: fixed; bottom: 0; width: 100%; padding: 1rem; background: Canvas; color: CanvasText; z-index: 10000; }

/* Keep the fixed native AppBar and SideMenu clear of display cutouts. */
.daytrader-shell-appbar.wf-mui-appBar {
  height: var(--daytrader-appbar-offset);
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: max(1rem, env(safe-area-inset-left, 0px));
  padding-right: max(1rem, env(safe-area-inset-right, 0px));
}
.daytrader-desktop-nav {
  width: 17.5rem;
  min-height: 1px;
}
/* SideMenu keeps its library-owned fixed position, width, height and transitions.
   Reserve the native fixed AppBar's vertical space inside the menu contents. */
.daytrader-desktop-nav .wf-mui-menu {
  padding-top: var(--wf-mui-appbar-height);
}
.daytrader-content {
  margin-inline-start: 17.5rem;
  padding-top: calc(var(--daytrader-appbar-offset) + .75rem);
  min-width: 0;
}
.daytrader-mode-cue {
  min-width: 0;
  font-size: .8rem;
  font-weight: 700;
  overflow-wrap: anywhere;
  text-align: right;
}
.daytrader-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.daytrader-sign-out.wf-mui-button {
  flex: 0 0 auto;
  min-height: 44px;
  margin-inline-start: .75rem;
}
.daytrader-theme-toggle button {
  min-width: 44px;
  min-height: 44px;
}
/* Official MaterialSymbols are served locally as masks for isolated offline
   browser tests; do not replace the native ToggleIconButton control. */
.daytrader-theme-toggle .wf-mui-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
}
.daytrader-theme-toggle .wf-mui-icon::before {
  content: "";
  display: block;
  flex: 0 0 1.5rem;
  width: 1.5rem;
  height: 1.5rem;
  background-color: var(--wf-mui-palette-primary);
  -webkit-mask: url("material-dark-mode.svg") center / contain no-repeat;
  mask: url("material-dark-mode.svg") center / contain no-repeat;
}
.theme-dark .daytrader-theme-toggle .wf-mui-icon::before {
  -webkit-mask-image: url("material-light-mode.svg");
  mask-image: url("material-light-mode.svg");
}
@media (forced-colors: active) {
  .daytrader-theme-toggle .wf-mui-icon::before {
    background-color: ButtonText;
  }
}
.daytrader-mobile-nav { display: none; }
.daytrader-hamburger.wf-mui-button {
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
}
.daytrader-hamburger-icon {
  display: inline-grid;
  place-items: center;
  width: 1.25rem;
  height: 1rem;
  border-block: 2px solid currentColor;
}
.daytrader-hamburger-icon::before {
  content: "";
  width: 100%;
  border-top: 2px solid currentColor;
}
/* The drawer starts below the fixed AppBar so the same button can close it. */
.daytrader-drawer-backdrop.wf-mui-button {
  position: fixed;
  inset: var(--daytrader-appbar-offset) 0 0;
  z-index: calc(var(--wf-mui-zindex-appbar) - 2);
  width: 100%;
  height: calc(100dvh - var(--daytrader-appbar-offset));
  margin: 0;
  border: 0;
  border-radius: 0;
  background: rgba(0, 0, 0, .54);
  color: transparent;
  font-size: 0;
  box-shadow: none;
  cursor: default;
  touch-action: none;
}
.daytrader-drawer {
  --daytrader-drawer-max-width: calc(100vw - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px) - 3rem);
  position: fixed;
  z-index: calc(var(--wf-mui-zindex-appbar) - 1);
  top: var(--daytrader-appbar-offset);
  left: env(safe-area-inset-left, 0px);
  width: min(18rem, var(--daytrader-drawer-max-width));
  height: calc(100dvh - var(--daytrader-appbar-offset));
}
.daytrader-drawer .wf-mui-side-menu {
  top: inherit;
  left: inherit;
  height: inherit;
  max-width: var(--daytrader-drawer-max-width);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--wf-mui-palette-menu-background);
}
.daytrader-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .4rem;
  padding: .75rem;
}
.daytrader-drawer-close.wf-mui-button { min-height: 44px; }
@media (min-width: 1100px) {
  /* Avoid a leftover mobile panel blocking navigation after rotation. */
  .daytrader-drawer, .daytrader-drawer-backdrop { display: none !important; }
}
@media (width < 1100px) {
  .daytrader-desktop-nav { display: none; }
  .daytrader-content {
    margin-inline-start: 0;
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .daytrader-shell-appbar.wf-mui-appBar {
    flex-wrap: nowrap;
    padding-left: max(.5rem, env(safe-area-inset-left, 0px));
    padding-right: max(.5rem, env(safe-area-inset-right, 0px));
  }
  .daytrader-mobile-nav { display: inline-flex; flex: 0 0 auto; margin-inline-end: .25rem; }
}
@media (max-width: 599px) {
  /* Keep the signed-in status readable without squeezing the existing menu,
     logout and theme controls. The drawer/content use this same safe offset. */
  .app-shell:has(.trading-status-cue) { --daytrader-appbar-offset: calc(112px + env(safe-area-inset-top, 0px)); }
  .daytrader-shell-appbar.wf-mui-appBar:has(.trading-status-cue) { flex-wrap: wrap; }
  .trading-status-cue { order: 10; flex-basis: 100%; justify-content: center; }
  .daytrader-brand-name { display: none; }
  .daytrader-mode-cue { font-size: .7rem; }
  .daytrader-brand-mark { width: 1.75rem; height: 1.75rem; }
}

.trading-setting-item { align-items: stretch; }
.trading-setting-label { margin-bottom: .15rem; }
.trading-setting-field {
  width: 100%;
  min-width: 0;
  flex: none;
  margin: .2rem 0 .15rem;
}
.trading-setting-field input {
  min-height: 1.5rem;
  font-size: 1rem;
}
.trading-setting-field label:empty { display: none; }
.trading-setting-meta {
  margin-top: .1rem;
  opacity: .8;
  font-weight: 600;
}
.trading-setting-help {
  max-width: 62ch;
  opacity: .82;
}

.daytrader-icon {
  display: inline-block;
  width: 1.35em;
  height: 1.35em;
  flex: 0 0 auto;
  background-color: currentColor;
  -webkit-mask: url("daytrader-mark.svg") center / contain no-repeat;
  mask: url("daytrader-mark.svg") center / contain no-repeat;
}
.daytrader-brand-mark {
  display: block;
  width: 2rem;
  height: 2rem;
  flex: 0 0 auto;
  margin-right: .55rem;
  border-radius: .45rem;
  object-fit: contain;
}

/* P15-C: shared workflow composition. Native components/theme keep appearance;
   there are no viewport-driven component replacements, hidden columns or fixed
   heights for translated content. Dashboard-specific layout remains P15-B. */
.workflow-surface { width: 100%; min-width: 0; }
.workflow-surface .wf-mui-button { min-height: 44px; }
.workflow-surface input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]),
.workflow-surface textarea {
  min-width: 0;
  max-width: 100%;
  font-size: max(1rem, 16px);
}
.workflow-surface label { white-space: normal; overflow-wrap: anywhere; }
.workflow-actions { margin-block: .75rem; }
.workflow-action-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem;
  min-width: 0;
}
.workflow-destructive-actions { margin-block-start: .75rem; }
.workflow-scroll-guide { margin-block: .75rem; }
.workflow-surface .data-scroll {
  overscroll-behavior-x: contain;
  scrollbar-gutter: stable;
  padding-block-end: .5rem;
}
@media (max-width: 599px) {
  /* Size the existing native field host as well as its input; never stretch
     switch/checkbox/radio hit targets into misleading full-width text fields. */
  .workflow-surface div:has(> input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"])),
  .workflow-surface div:has(> textarea),
  .workflow-surface input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]),
  .workflow-surface textarea {
    width: 100%;
  }
  .workflow-surface .wf-mui-button { width: 100%; }
  .workflow-action-group { align-items: stretch; }
  .workflow-action-group > * { width: 100%; }
}

