/* MarketDeck suite shell for F&O Analytics.
   This layer is presentation-only: existing routes, controls and page
   templates remain intact inside the shared workspace. */

html { color-scheme: dark; }

body.md-app {
  min-width: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--md-bg-deep);
  color: var(--md-text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14.5px;
}

body.md-app a { color: var(--md-link); }
body.md-app a:hover { color: var(--md-text); }
body.md-app h1,
body.md-app h2,
body.md-app h3,
body.md-app .brand-word { font-family: inherit; }
body.md-app :focus-visible { outline: 2px solid var(--md-primary); outline-offset: 2px; }
body.md-app input,
body.md-app select,
body.md-app textarea,
body.md-app button { font-family: inherit; }
body.md-app input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
body.md-app select,
body.md-app textarea { min-height: 38px; border-radius: 8px; }
body.md-app .btn { min-height: 36px; border-radius: 8px; }
body.md-app .btn-primary {
  background: var(--md-primary);
  border-color: var(--md-primary);
  color: #fff;
}
body.md-app .btn-primary:hover {
  background: var(--md-primary-hover);
  border-color: var(--md-primary-hover);
  color: #fff;
}
body.md-app table { font-variant-numeric: tabular-nums; }

.md-skip {
  position: fixed;
  left: 12px;
  top: -80px;
  z-index: 120;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--md-primary);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}
.md-skip:focus { top: 12px; color: #fff; }

.md-shell { display: flex; align-items: flex-start; min-height: 100vh; }

.md-sidebar {
  width: 188px;
  flex: 0 0 188px;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  background: var(--md-sidebar);
  border-right: 1px solid var(--md-border-subtle);
}
.md-sidebar:focus { outline: none; }
.md-sidebar-head { padding: 12px 14px 11px; border-bottom: 1px solid var(--md-border-subtle); }
.md-factory {
  display: block;
  color: var(--md-text);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.025em;
  line-height: 24px;
  text-decoration: none;
}
.md-sidebar-scroll { flex: 1 1 auto; overflow-y: auto; padding: 0 8px 16px; }
.md-rail-label {
  display: block;
  padding: 14px 6px 6px;
  color: var(--md-text-muted);
  font: 500 10px/1.4 "IBM Plex Mono", ui-monospace, Consolas, monospace;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.md-product-list { margin: 0; padding: 0; list-style: none; }
.md-product {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 43px;
  padding: 6px 9px;
  border-radius: 8px;
  color: var(--md-link-muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.25;
  text-decoration: none;
}
.md-product:hover { background: var(--md-surface-3); color: var(--md-text); }
.md-product.is-active {
  background: var(--md-primary-strong-soft);
  color: var(--md-text);
  font-weight: 650;
  box-shadow: inset 0 0 0 1px rgba(19, 146, 253, .12);
}
.md-product.is-active::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 3px;
  background: var(--md-primary);
}
.md-product.is-disabled { color: var(--md-text-faint); cursor: not-allowed; opacity: .62; }
.md-product-icon { display: inline-flex; flex: 0 0 26px; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 6px; background: var(--md-primary-soft); color: var(--md-primary); }
.md-product-icon svg { width: 15px; height: 15px; }
.md-product-desc { display: block; margin-top: 2px; color: var(--md-text-faint); font-size: 10.5px; font-weight: 400; }

.md-sidebar-foot { flex: 0 0 auto; padding: 12px; border-top: 1px solid var(--md-border-subtle); }
.md-account { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; min-width: 0; }
.md-avatar {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--md-primary-soft);
  color: var(--md-primary-hover);
  font: 600 10px/1 "IBM Plex Mono", ui-monospace, monospace;
}
.md-account-name { overflow: hidden; color: var(--md-text); font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.md-sidebar-foot .inline-logout { display: block; }
.md-sidebar-foot .inline-logout .btn { width: 100%; }
.md-sidebar-note { margin: 0; color: var(--md-text-faint); font-size: 11px; line-height: 1.4; }
.md-ops-link { display: block; margin: 0 0 8px; color: var(--md-link-muted); font-size: 12px; text-decoration: none; }

.md-main-column { flex: 1 1 auto; min-width: 0; width: calc(100% - 188px); }
.md-header {
  height: 48px;
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: var(--md-topbar);
  border-bottom: 1px solid var(--md-border-subtle);
}
.md-identity { display: inline-flex; align-items: baseline; gap: 7px; text-decoration: none; white-space: nowrap; }
.md-identity-suite,
.md-identity-product { color: var(--md-text); font-size: 15px; font-weight: 700; letter-spacing: -.015em; }
.md-identity-product { font-weight: 600; }
.md-identity-separator { color: var(--md-border-strong); font-size: 12px; }
.md-header-spacer { flex: 1 1 auto; }
.md-header-actions { display: flex; align-items: center; gap: 8px; }
.md-header-actions a { min-height: 36px; display: inline-flex; align-items: center; padding: 0 11px; border-radius: 8px; text-decoration: none; font-size: 12.5px; }
.md-header-actions .md-create-account { background: var(--md-primary); color: #fff; font-weight: 650; }
.md-header-actions .md-create-account:hover { background: var(--md-primary-hover); color: #fff; }

.md-drawer-toggle {
  display: none;
  min-width: 44px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--md-border);
  border-radius: 8px;
  background: var(--md-surface-1);
  color: var(--md-link);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.md-scrim { display: none; }

.md-suite-rail {
  display: none;
  min-width: 0;
  background: var(--md-topbar);
  border-bottom: 1px solid var(--md-border-subtle);
}
.md-suite-scroll {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  height: 42px;
  padding: 0 20px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--md-border-strong) transparent;
}
.md-suite-link {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 11px;
  border-radius: 8px;
  color: var(--md-link);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}
.md-suite-link:hover { background: var(--md-surface-3); color: var(--md-text); }
.md-suite-link.is-active {
  background: var(--md-primary-soft);
  color: var(--md-text);
  box-shadow: inset 0 -2px 0 var(--md-primary);
}
.md-suite-link.is-disabled { color: var(--md-text-faint); cursor: not-allowed; }

/* The existing F&O navigation remains product-local and keeps every route. */
.md-local-nav.topbar {
  position: sticky;
  top: 48px;
  z-index: 35;
  min-height: 48px;
  gap: 12px;
  padding: 6px 14px;
  background: var(--md-surface-1);
  border-bottom-color: var(--md-border-subtle);
}
.md-local-nav .brand { gap: 7px; }
.md-local-nav .brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--md-primary-soft);
  color: var(--md-primary-hover);
  font-size: 10px;
}
.md-local-nav .brand-word { color: var(--md-text); font-family: inherit; font-size: 14px; font-weight: 650; }
.md-local-nav .nav { min-width: 0; overflow-x: auto; scrollbar-width: thin; }
.md-local-nav .nav a { color: var(--md-link-muted); border-radius: 6px; white-space: nowrap; }
.md-local-nav .nav a:hover { color: var(--md-text); background: var(--md-surface-3); }
.md-local-nav .nav a.active { color: var(--md-text); background: var(--md-primary-soft); box-shadow: inset 0 -2px 0 var(--md-primary); }
.md-local-nav .market-pill { background: var(--md-surface-2); border-color: var(--md-border); }
.md-local-nav .market-pill a { color: var(--md-link-muted); }
.md-local-nav .market-pill a.active { background: var(--md-primary); color: #fff; }

body.md-app main { min-width: 0; }
body.md-app main.home-v2 { background: var(--md-home-bg); }
body.md-app main.home-v2 .panel { border-color: var(--md-home-line); }
body.md-app main.home-v2 .btn:not(.btn-primary) { color: var(--md-link); }

@media (max-width: 1024px) {
  .md-main-column { width: 100%; }
  .md-drawer-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .md-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 70;
    transform: translateX(-100%);
    visibility: hidden;
    box-shadow: 0 12px 36px rgba(0, 0, 0, .5);
    transition: transform 150ms ease, visibility 0s linear 150ms;
  }
  .md-sidebar.is-open {
    transform: translateX(0);
    visibility: visible;
    transition: transform 150ms ease, visibility 0s linear 0s;
  }
  .md-scrim {
    position: fixed;
    inset: 0;
    z-index: 60;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: rgba(0, 0, 0, .62);
    cursor: pointer;
  }
  .md-scrim:not([hidden]) { display: block; }
  .md-suite-rail { display: block; position: sticky; top: 48px; z-index: 34; }
  .md-local-nav.topbar { top: 90px; }
}

@media (max-width: 767px) {
  .md-header { position: static; min-height: 56px; height: auto; padding: 6px 12px; }
  .md-identity-suite,
  .md-identity-separator { display: none; }
  .md-header-actions a { min-height: 44px; padding-inline: 9px; }
  .md-header-actions .md-create-account { display: none; }
  .md-drawer-toggle { min-height: 44px; }
  .md-suite-rail { position: sticky; top: 0; z-index: 39; }
  .md-suite-scroll { height: 48px; padding: 0 12px; }
  .md-suite-link { min-height: 44px; font-size: 13.5px; }
  .md-local-nav.topbar { position: static; padding: 8px 12px; gap: 8px; }
  .md-local-nav .brand { flex: 1 1 auto; }
  .md-local-nav .brand-word { font-size: 14px; }
  .md-local-nav .nav-toggle-btn { width: 44px; height: 44px; }
  .md-local-nav .nav { order: 10; }
  .md-local-nav .nav a { min-height: 44px; display: flex; align-items: center; }
  .md-local-nav .market-pill { order: 4; width: 100%; }
  .md-local-nav .market-pill a { flex: 1 1 0; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; }
  body.md-app main { padding-inline: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .md-sidebar { transition: none; }
}

.md-pa-featured{display:grid;grid-template-columns:25px minmax(0,1fr) 12px;align-items:center;gap:9px;margin:10px 11px;padding:10px 9px;text-decoration:none!important;color:var(--md-text)!important;background:var(--md-surface-1);border:1px solid var(--md-border-subtle);border-radius:6px}
.md-pa-featured:hover,.md-pa-featured:focus-visible{border-color:var(--md-border);background:var(--md-surface-3)}
.md-pa-featured:focus-visible{outline:2px solid var(--md-primary);outline-offset:2px}
.md-pa-featured .md-pa-glyph{width:25px;height:25px;display:grid;place-items:center;border-radius:6px;color:var(--md-primary);background:var(--md-primary-soft)}
.md-pa-featured .md-pa-glyph svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round}
.md-pa-featured .md-pa-label{min-width:0;display:flex;flex-direction:column;gap:2px}
.md-pa-featured small{color:var(--md-text-muted);font:600 8px/1.2 monospace;letter-spacing:.08em}
.md-pa-featured strong{color:var(--md-text);font-size:12px;line-height:1.25}.md-pa-featured .md-pa-label>span{color:var(--md-text-secondary);font-size:9px;line-height:1.3}
.md-pa-featured .md-pa-arrow{align-self:center;color:var(--md-primary);font-size:13px;transition:transform .16s ease}
.md-pa-featured:hover .md-pa-arrow{transform:translate(2px,-2px)}
@media(prefers-reduced-motion:reduce){.md-pa-featured .md-pa-arrow{transition:none}.md-pa-featured:hover .md-pa-arrow{transform:none}}
.md-pa-mobile{font-weight:700!important}


/* Product routes in the desktop left rail; the existing top navigation stays intact. */
.md-local-sections{display:grid;gap:2px;margin-top:18px;padding-top:4px;border-top:1px solid var(--md-border-subtle)}
.md-local-sections .md-rail-label{padding-top:10px}
.md-local-group{margin:8px 9px 2px;color:var(--md-text-faint);font:500 9px/1.4 "IBM Plex Mono",ui-monospace,monospace;letter-spacing:.08em;text-transform:uppercase}
.md-local-link{display:flex;align-items:center;min-height:33px;padding:6px 9px;border:1px solid transparent;border-radius:7px;color:var(--md-link-muted);font-size:12px;font-weight:500;line-height:1.3;text-decoration:none}
.md-local-link:hover,.md-local-link:focus-visible{border-color:var(--md-border-subtle);background:var(--md-surface-3);color:var(--md-text)}
.md-local-link.is-current{border-color:rgba(19,146,253,.18);background:var(--md-primary-strong-soft);color:var(--md-text);font-weight:650}
/* Phones: 16px minimum for every text-entry control so iOS Safari does not zoom the page on focus.
   One floor for this product shell; !important beats page and component rules of 11-14px.
   Widths above 768px are unchanged. */
@media (max-width: 768px) {
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=button]):not([type=submit]):not([type=reset]):not([type=color]):not([type=file]):not([type=image]),
  select,
  textarea { font-size: 16px !important; }
}
