/* Margonaut / Financial Navigation — D2.
   Presentation overrides only. Existing 9-view DOM and backend/API contracts unchanged. */
:root {
  --fn-paper: #f4f1e9;
  --fn-paper2: #ebe7dd;
  --fn-white: #fffdfa;
  --fn-ink: #192329;
  --fn-ink2: #26363c;
  --fn-muted: #697477;
  --fn-rule: #d2d1c8;
  --fn-orange: #e35a36;
  --fn-marine: #224e5a;
  --fn-positive: #2f735c;
  --fn-danger: #ae4738;
  --fn-serif: Georgia, 'Times New Roman', serif;
  font-family: Inter, 'Helvetica Neue', Arial, sans-serif;
  background: var(--fn-paper);
  color: var(--fn-ink);
}
html { scrollbar-gutter: stable; }
body { background: var(--fn-paper); color: var(--fn-ink); -webkit-font-smoothing: antialiased; }
::selection { background: #f0ac90; color: var(--fn-ink); }
:where(button, input, select, textarea, a):focus-visible {
  outline: 2px solid var(--fn-orange); outline-offset: 3px;
}

/* Navigation retains all original buttons, role-dependent links and JS listeners. */
.app-layout { background: var(--fn-paper); grid-template-columns: 242px minmax(0, 1fr); }
.app-sidebar {
  width: 242px; height: 100vh; padding: 25px 17px 18px;
  background: var(--fn-ink); color: #f7f3e9; box-shadow: none;
  border-right: 1px solid #34434a; overscroll-behavior: contain;
}
.sidebar-brand { gap: 12px; padding: 0 6px 27px; border-bottom: 1px solid #364248; margin-bottom: 16px; }
.sidebar-brand img.brand-logo { width: 43px; height: 43px; flex: 0 0 43px; border-radius: 11px; box-shadow: none; }
.sidebar-brand strong { font-size: 19px; letter-spacing: -.06em; font-weight: 740; color: #fffdfa; }
.sidebar-brand span { margin-top: 5px; color: #a9b7b6; font-size: 10px; letter-spacing: .11em; text-transform: uppercase; }
.app-nav { display: flex; flex-direction: column; gap: 0; padding: 5px 0 22px; }
.nav-item {
  min-height: 46px; width: 100%; padding: 9px 11px; margin: 2px 0; gap: 13px;
  background: transparent; border-radius: 2px; border-left: 2px solid transparent;
  color: #cad1cd; font-size: 13px; font-weight: 550; letter-spacing: .005em;
  transition: background .16s ease, color .16s ease, border-color .16s ease;
}
.nav-item:hover { color: #fffdfa; background: #2b3940; transform: none; }
.nav-item.active, .nav-item[aria-current="page"] {
  color: #fffdfa; background: #29363b; border-left-color: var(--fn-orange); box-shadow: none;
}
.nav-icon { width: 29px; height: 29px; flex: 0 0 29px; background: transparent; border: 1px solid #46545a; color: #cbd5d1; border-radius: 2px; }
.nav-item.active .nav-icon { background: #35474a; color: #ffb496; border-color: #586165; }
.nav-svg { width: 18px; height: 18px; stroke-width: 1.6; }
.nav-divider { margin: 22px 10px 7px; color: #9aa9aa; border-top: 1px solid #344349; padding-top: 16px; }
.sidebar-account { border-top: 1px solid #344349; padding: 19px 7px 7px; }
.sidebar-account-copy { color: #d7dfda; font-size: 11px; overflow-wrap: anywhere; }
.sidebar-account .button-ghost { border: 1px solid #607078; border-radius: 2px; color: #fffdfa; }

/* Publication-like work area; subsequent D3 will refit individual module interiors. */
.app-content { min-width: 0; margin-left: 0; background: var(--fn-paper); }
.workspace-header {
  top: 0; min-height: 109px; padding: 21px clamp(25px, 3.7vw, 55px);
  border-bottom: 1px solid var(--fn-rule); background: rgba(244,241,233,.97);
  backdrop-filter: blur(12px);
}
.financial-workspace-title { min-width: 0; }
.workspace-kicker { display: block; color: var(--fn-marine); font-size: 10px; font-weight: 800; letter-spacing: .18em; }
.workspace-header h1 { margin: 7px 0 4px; font-size: clamp(28px, 2.65vw, 43px); line-height: 1.08; font-weight: 640; letter-spacing: -.06em; }
.workspace-header .muted { font-size: 12px; color: var(--fn-muted); line-height: 1.55; }
.workspace-header-actions { align-items: center; }
.shell { width: min(1480px, calc(100% - clamp(36px, 6vw, 108px))); margin: 28px auto 70px; }
.eyebrow, .report-kicker { color: var(--fn-marine); }
.card { background: var(--fn-white); border: 1px solid #dddcd3; border-radius: 4px; box-shadow: 0 7px 28px rgba(25,35,41,.025); }
.button, .icon-button { background: var(--fn-ink); border-radius: 3px; padding: 11px 17px; box-shadow: none; color: var(--fn-white); }
.button:hover, .icon-button:hover { background: var(--fn-marine); box-shadow: none; }
.button-light { background: #f3f1eb; color: var(--fn-ink); border: 1px solid #cbd1cd; }
.button-light:hover { background: #e5e6df; }
.button-ghost { background: transparent; }
input, select, textarea { background: #fffefa; color: var(--fn-ink); border-color: #cdd2cc; border-radius: 3px; }
input:focus, select:focus, textarea:focus { border-color: var(--fn-marine); box-shadow: 0 0 0 3px rgba(34,78,90,.1); }
.badge { background: #e7e9e3; color: #435453; border-radius: 2px; }
.access-banner { background: #fff6e8; border: 1px solid #eac6a0; border-left: 3px solid var(--fn-orange); border-radius: 2px; }
.financial-mobile-nav-toggle, .financial-mobile-nav-overlay { display: none; }

/* Authentication: identical live forms and legal checkboxes, completely new editorial frame. */
.auth-gate {
  display: grid; grid-template-columns: minmax(290px, .88fr) minmax(0, 1.12fr);
  align-items: start; justify-items: stretch; gap: 0;
  padding: clamp(16px, 4.5vh, 52px) clamp(18px, 5.2vw, 90px);
  background: #ede9e0; backdrop-filter: none; overflow-y: auto;
}
.auth-gate::before { content: none; }
.financial-auth-aside {
  grid-column: 1; grid-row: 1; position: sticky; top: 4px;
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: min(790px, calc(100vh - 76px)); padding: clamp(28px, 4vw, 56px);
  color: #fffdfa; background: var(--fn-ink);
  background-image: repeating-linear-gradient(0deg, transparent 0, transparent 36px, rgba(255,255,255,.024) 37px);
}
.financial-auth-brand { display: flex; align-items: center; gap: 13px; pointer-events: none; }
.financial-auth-brand img { width: 45px; height: 45px; border-radius: 9px; }
.financial-auth-brand strong, .financial-auth-brand small { display: block; }
.financial-auth-brand strong { font-size: 23px; line-height: 1; letter-spacing: -.06em; }
.financial-auth-brand small { margin-top: 7px; color: #abb7b4; font-size: 10px; text-transform: uppercase; letter-spacing: .14em; }
.financial-index { font-size: 10px; color: #ffc0a5; font-weight: 760; letter-spacing: .17em; }
.financial-auth-intro h2 { max-width: 580px; font-size: clamp(40px, 4vw, 66px); line-height: 1.07; letter-spacing: -.073em; font-weight: 540; margin: 28px 0 24px; }
.financial-auth-intro h2 em { font-family: var(--fn-serif); font-weight: 400; color: #b0d1cc; }
.financial-auth-intro p { max-width: 380px; color: #c2cfc8; line-height: 1.78; font-size: 14px; }
.financial-auth-end { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; border-top: 1px solid #536169; padding-top: 20px; color: #93a6a6; font-size: 9px; letter-spacing: .12em; }
.auth-card {
  grid-column: 2; grid-row: 1; justify-self: stretch; width: 100%; max-width: 780px;
  min-width: 0; margin: 0; padding: clamp(27px, 3.8vw, 65px);
  border: 1px solid #deddd6; background: var(--fn-white); border-radius: 0;
  box-shadow: 14px 14px 0 #dcd9cf; color: var(--fn-ink);
}
.auth-card .eyebrow { display: none; }
.financial-auth-mobile-brand { display: none; }
.financial-auth-context { color: var(--fn-marine); font-size: 10px; letter-spacing: .15em; font-weight: 800; margin: 0 0 20px; }
.auth-card h1 { font-size: clamp(31px, 3.3vw, 52px); line-height: 1.08; letter-spacing: -.065em; font-weight: 620; margin: 0 0 13px; }
.auth-card > .muted { font-size: 13px; color: var(--fn-muted); line-height: 1.68; margin: 0 0 26px; }
.auth-card label { margin-top: 16px; }
.auth-card label > span { font-size: 11px; font-weight: 740; color: #536166; }
.auth-card input:not([type="checkbox"]):not([type="radio"]) { min-height: 48px; background: #fffefa; }
.auth-card .auth-actions { margin-top: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.auth-card .auth-actions .button { min-height: 46px; margin-top: 14px; }
.auth-card .auth-link-button { border: 0; background: transparent; color: var(--fn-marine); font-weight: 740; text-decoration: underline; text-underline-offset: 4px; padding: 8px 0; }
.auth-card .footnote { color: #758181; font-size: 11px; line-height: 1.6; }
.auth-card .footnote.auth-error { color: var(--fn-danger); }
.auth-card .legal-check { display: flex; align-items: flex-start; }
.auth-card .legal-check input { width: 17px; height: 17px; accent-color: var(--fn-marine); }
.auth-card .legal-check span { flex: 1; }
.auth-card .legal-check a { color: #196b7b; text-decoration: underline; text-underline-offset: 3px; }
.register-plan-choice { padding: 16px; margin: 21px 0; border: 1px solid var(--fn-rule); border-radius: 2px; }
.register-plan-choice legend { font-size: 13px; padding: 0 6px; font-weight: 740; }
.register-plan-choice>label { margin: 0 0 6px; padding: 12px; border-radius: 2px; border-color: #d5d9d3; align-items: flex-start; }
.register-plan-choice>label:has(input:checked) { border-color: var(--fn-marine); background: #edf3f0; }
.register-plan-choice input { accent-color: var(--fn-marine); width: 17px; flex: 0 0 17px; margin-top: 3px; }
.register-plan-choice span { flex: 1; }
.register-plan-choice strong { font-size: 13px; }
.register-plan-choice small { margin-top: 3px; font-size: 11px; }
.register-billing-demo { border-radius: 2px; background: #f5f7f1; border: 1px solid #d5ddd4; padding: 16px; }
.register-billing-demo strong { color: var(--fn-ink); }

@media (max-width: 1120px) {
  .app-layout { grid-template-columns: 214px minmax(0, 1fr); }
  .app-sidebar { width: 214px; padding-inline: 11px; }
  .shell { width: calc(100% - 38px); }
  .auth-gate { grid-template-columns: minmax(255px,.85fr) minmax(0,1.15fr); padding: 15px; }
  .financial-auth-aside { padding: 28px; }
}
@media (max-width: 900px) {
  .app-layout { display: block; }
  .app-sidebar {
    display: flex; flex-direction: column; position: fixed; z-index: 102; top: 0; left: 0;
    height: 100dvh; width: min(300px, 86vw); max-width: 86vw; padding: 20px 16px;
    overflow-y: auto; transform: translateX(-105%); transition: transform .24s ease;
    visibility: hidden;
  }
  .app-sidebar.financial-nav-open { transform: translateX(0); visibility: visible; }
  .sidebar-brand { display: flex; }
  .app-nav { display: flex; flex-direction: column; flex-wrap: nowrap; overflow: visible; padding: 7px 0 14px; gap: 0; }
  .nav-item { display: flex; width: 100%; flex: 0 0 auto; padding: 9px 11px; }
  .nav-icon { display: inline-flex; }
  .sidebar-account { display: block; margin-top: auto; }
  .financial-mobile-nav-overlay.financial-nav-open { display: block; position: fixed; inset: 0; z-index: 101; background: rgba(15,28,32,.64); border: 0; width: 100%; height: 100%; }
  body.financial-nav-open { overflow: hidden; }
  .financial-mobile-nav-toggle { display: flex; flex: 0 0 41px; width: 41px; height: 41px; padding: 10px; flex-direction: column; justify-content: space-around; background: #fffefa; border: 1px solid #bfc8c5; border-radius: 2px; }
  .financial-mobile-nav-toggle span { display: block; width: 100%; height: 1.6px; background: var(--fn-ink); }
  .workspace-header { top: 0; min-height: 85px; align-items: center; gap: 16px; padding: 14px 22px; }
  .workspace-kicker { display: block; font-size: 9px; }
  .workspace-header h1 { font-size: 28px; }
  .workspace-header-actions { display: flex; }
  .workspace-header .muted { display: none; }
  .shell { width: calc(100% - 32px); margin: 21px auto 42px; }
  .auth-gate { grid-template-columns: 1fr; gap: 0; padding: 15px; }
  .financial-auth-aside { position: relative; top: auto; grid-column: 1; grid-row: 1; min-height: 230px; padding: 25px 28px; }
  .financial-auth-intro h2 { font-size: 35px; margin: 12px 0 0; }
  .financial-auth-intro p, .financial-auth-end { display: none; }
  .financial-auth-brand img { width: 34px; height: 34px; }
  .financial-auth-brand strong { font-size: 19px; }
  .auth-card { grid-column: 1; grid-row: 2; margin: 0; padding: 30px 35px; box-shadow: 9px 9px 0 #dcd9cf; }
}
@media (max-width: 620px) {
  .workspace-header { padding: 11px 14px; gap: 10px; }
  .workspace-header h1 { font-size: 24px; }
  .workspace-header-actions { max-width: 45%; justify-content: flex-end; }
  .mobile-account-context { max-width: 125px; }
  .workspace-header .workspace-logout { padding: 7px 9px; }
  .shell { width: calc(100% - 22px); }
  .financial-auth-aside { min-height: 176px; padding: 19px 21px; }
  .financial-auth-intro h2 { font-size: 27px; margin: 12px 0 0; }
  .financial-index { font-size: 9px; }
  .auth-card { padding: 25px 21px; }
  .auth-card h1 { font-size: 32px; }
  .auth-card .auth-actions { grid-template-columns: 1fr; gap: 0; }
  .auth-card .auth-actions .button { margin-top: 9px; }
  .register-plan-choice { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .app-sidebar, .nav-item, .button, .icon-button { transition: none !important; }
}


/* Financial Navigation D6: pixel-stable sidebar icon alignment across iOS/Android and desktop. */
.app-sidebar .nav-item { display:flex; align-items:center; justify-content:flex-start; min-width:0; max-width:100%; text-align:left; gap:12px; }
.app-sidebar .nav-item .nav-icon { display:grid; place-items:center; flex:0 0 29px; width:29px; min-width:29px; max-width:29px; height:29px; min-height:29px; max-height:29px; box-sizing:border-box; padding:0; margin:0; line-height:1; align-self:center; }
.app-sidebar .nav-item .nav-icon .nav-svg { display:block; width:18px; height:18px; min-width:18px; max-width:18px; min-height:18px; max-height:18px; flex:none; fill:none; stroke:currentColor; stroke-width:1.55; stroke-linecap:round; stroke-linejoin:round; transform:none; vertical-align:middle; }
.app-sidebar .nav-item > span:last-child:not(.nav-icon) { min-width:0; max-width:100%; overflow-wrap:break-word; line-height:1.25; }
.app-sidebar .sidebar-brand { display:flex; align-items:center; min-width:0; }
.app-sidebar .sidebar-brand .sidebar-brand-copy { flex:1 1 auto; min-width:0; }
.app-sidebar .sidebar-brand-copy :is(strong,span) { overflow-wrap:break-word; }
.workspace-header { min-width:0; }
.workspace-header > * { min-width:0; }
.workspace-header-actions { display:flex; min-width:0; max-width:100%; flex-wrap:wrap; gap:8px; justify-content:flex-end; }
.workspace-header-actions > * { max-width:100%; }
@media(max-width:900px) {
  .app-sidebar { box-sizing:border-box; }
  .app-sidebar .nav-item { flex-shrink:0; }
}
@media(max-width:620px) {
  .workspace-header { flex-wrap:wrap; }
  .workspace-header .financial-workspace-title { flex:1 1 auto; }
  .workspace-header-actions { flex:1 1 auto; max-width:100%; justify-content:flex-end; }
  .workspace-header-actions :is(.button,.workspace-logout) { min-width:0; white-space:normal; overflow-wrap:break-word; }
}


/* Stage 10.6.16: stationary desktop rail, with scrolling confined to the
   navigation list only when the viewport is short. Mobile drawer unchanged. */
@media (min-width: 901px) {
  .app-layout > .app-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 70;
    height: 100vh;
    height: 100dvh;
    width: 242px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    overscroll-behavior: none;
  }
  .app-layout > .app-sidebar .sidebar-brand { flex: 0 0 auto; }
  .app-layout > .app-sidebar .app-nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    overscroll-behavior-y: contain;
  }
  .app-layout > .app-sidebar .sidebar-account {
    flex: 0 0 auto;
    margin-top: 0;
  }
  .app-layout > .app-content { grid-column: 2; min-width: 0; }
}
@media (min-width: 901px) and (max-width: 1120px) {
  .app-layout > .app-sidebar { width: 214px; }
}

/* Stage 10.7: transparent Profit Radar, styled as the existing editorial UI. */
.profit-radar { padding: clamp(22px, 2.5vw, 35px); margin-bottom: 22px; }
.profit-radar .section-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:18px; }
.radar-lead-control { display:flex; flex-direction:column; gap:6px; min-width:138px; font-size:11px; color:var(--fn-muted); }
.radar-lead-control select { min-height:40px; font-size:13px; }
.radar-summary { display:grid;grid-template-columns:1.35fr 1fr 1fr; gap:0; margin:20px 0; border:1px solid var(--fn-rule);background:#fafbf8; }
.radar-summary > div { padding:18px; border-right:1px solid var(--fn-rule); display:flex;flex-direction:column;gap:9px; }
.radar-summary > div:last-child { border-right:0; }
.radar-summary span { font-size:11px; color:var(--fn-muted); line-height:1.5; }
.radar-summary strong { font: 30px/1.13 Georgia,serif; color:var(--fn-ink); }
.radar-subtitle { margin:20px 0 11px;font-size:17px;letter-spacing:-.025em; }
.radar-actions,.radar-stock-list { display:grid;gap:7px; }
.radar-action { width:100%;display:flex;gap:12px;align-items:flex-start;text-align:left;padding:13px 15px; border:1px solid var(--fn-rule);background:#fafbf8;color:var(--fn-ink); cursor:pointer; }
.radar-action strong,.radar-stock-list strong { display:block;font-size:13px;margin-bottom:4px; }
.radar-action small,.radar-stock-list small { color:var(--fn-muted);line-height:1.5;font-size:12px; }
.radar-priority { color:#9d4532; font-weight:700;font-size:10px; text-transform:uppercase;letter-spacing:.08em;min-width:85px; }
.radar-action.severity-setup .radar-priority { color:var(--fn-marine); }
.radar-stock-row { display:grid; grid-template-columns:minmax(140px,2fr) repeat(3,minmax(90px,1fr));gap:12px;align-items:center;padding:13px 15px;border:1px solid var(--fn-rule); }
.radar-stock-row > span { font-size:12px; }
.radar-method { font-size:11px;line-height:1.6;margin:17px 0 0; }
.radar-daily-switch { display:flex;align-items:center;justify-content:space-between;padding:14px 16px;border:1px solid var(--fn-rule); margin:12px 0;gap:18px; }
.radar-daily-switch small { display:block;color:var(--fn-muted);font-size:11px;margin-top:5px; }
@media(max-width:900px) { .radar-summary { grid-template-columns:1fr; }.radar-summary>div {border-right:0;border-bottom:1px solid var(--fn-rule);}.profit-radar .section-heading {flex-wrap:wrap;}.radar-stock-row {grid-template-columns:1fr 1fr;}}
