/* App shell: fixed header, the page itself never scrolls, only content areas do. */
.app { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

/* Header */
.app-header {
  flex: 0 0 var(--header-h);
  background: var(--c-anthracite); color: #fff;
  display: flex; align-items: stretch; gap: 28px; padding: 0 28px;
}
.app-header .logo { height: 40px; width: auto; align-self: center; }
.app-nav { display: flex; align-items: stretch; gap: 2px; }
.app-nav a {
  display: flex; align-items: center; padding: 0 16px;
  color: var(--c-on-dark-muted); font-size: 14px; font-weight: 500; text-decoration: none;
  border-bottom: 3px solid transparent;
}
.app-nav a:hover { color: #fff; }
.app-nav a.active { color: #fff; font-weight: 700; border-bottom-color: var(--c-lime); }
.app-user { margin-left: auto; display: flex; align-items: center; position: relative; }
.avatar-btn {
  width: 40px; height: 40px; border-radius: 20px; border: 0; padding: 0;
  background: var(--c-anthracite-2); color: #fff; font-size: 13px; font-weight: 700; cursor: pointer;
}
.avatar-btn:focus-visible { outline: 2px solid var(--c-lime); outline-offset: 2px; }
.user-menu {
  position: absolute; top: calc(100% - 6px); right: 0; z-index: 50; min-width: 220px;
  background: var(--c-surface); color: var(--c-text); border-radius: 12px; box-shadow: var(--shadow-float);
  padding: 6px; display: none;
}
.user-menu.open { display: block; }
.user-menu .who { padding: 10px 12px 8px; font-size: 12px; color: var(--c-muted); border-bottom: 1px solid var(--c-line-soft); margin-bottom: 4px; }
.user-menu .who strong { display: block; color: var(--c-text); font-size: 14px; }
.user-menu button {
  width: 100%; text-align: left; border: 0; background: transparent; border-radius: 8px;
  padding: 10px 12px; font-size: 14px; cursor: pointer; min-height: 40px;
}
.user-menu button:hover { background: var(--c-surface-2); }

/* Pages */
.pages { flex: 1; min-height: 0; position: relative; }
.page { display: none; height: 100%; }
.page.active { display: flex; }
.page-scroll { flex: 1; overflow-y: auto; min-width: 0; }
.page-inner { max-width: 1240px; margin: 0 auto; padding: 28px 28px 96px; }

/* Valuation workspace */
.workspace { display: flex; width: 100%; height: 100%; min-height: 0; }
.steps-col {
  flex: 0 0 260px; background: var(--c-surface); border-right: 1px solid #DEDCDA;
  display: flex; flex-direction: column; overflow-y: auto;
}
.steps-col .col-title { padding: 14px 16px; border-bottom: 1px solid var(--c-line); }
.step-list { list-style: none; margin: 0; padding: 10px 10px 0; display: flex; flex-direction: column; gap: 2px; }
.step-btn {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px;
  border: 0; border-radius: 10px; background: transparent; text-align: left; cursor: pointer;
}
.step-btn:disabled { cursor: not-allowed; }
.step-btn.current { background: #F4F7E6; box-shadow: inset 4px 0 0 var(--c-olive); }
.step-dot {
  flex: 0 0 26px; height: 26px; border-radius: 13px; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; background: var(--c-surface-3); color: var(--c-muted);
}
.step-btn.current .step-dot { background: var(--c-lime); color: var(--c-anthracite); }
.step-btn.done .step-dot { background: var(--c-anthracite); color: var(--c-lime); }
.step-title { display: block; font-weight: 700; font-size: 13px; }
.step-sub { display: block; font-size: 12px; color: var(--c-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.selection { margin: 14px 16px 16px; padding-top: 14px; border-top: 1px solid var(--c-line); display: flex; flex-direction: column; gap: 8px; }
.sel-row { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.sel-row span:first-child { color: var(--c-muted); }
.sel-row span:last-child { font-family: var(--font-mono); font-size: 12px; text-align: right; overflow-wrap: anywhere; }
.sel-row.override span:last-child { color: var(--c-override); }

.main-col { flex: 1; min-width: 0; overflow-y: auto; }
.step-pane { display: none; padding: 24px 24px 96px; gap: 20px; align-items: flex-start; }
.step-pane.active { display: flex; flex-wrap: wrap; align-content: flex-start; }
.step-main { flex: 999 1 560px; min-width: 0; }
.step-side { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.step-nav { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--c-line); }
.step-nav .right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: flex-end; }
.results-pane { padding: 16px 20px 96px; display: none; flex-direction: column; gap: 12px; }
.results-pane.active { display: flex; }

/* Assistant (fixed, never scrolls away) */
.assistant-dock { position: fixed; right: 24px; bottom: 24px; z-index: 40; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.assistant-toggle {
  height: 44px; padding: 0 16px 0 12px; border: 0; border-radius: 22px;
  background: var(--c-anthracite); color: #fff; font-weight: 600; font-size: 13px;
  display: flex; align-items: center; gap: 8px; box-shadow: 0 4px 12px rgba(35, 31, 32, 0.2); cursor: pointer;
}
.assistant-panel {
  width: 360px; max-width: calc(100vw - 48px); height: 460px; max-height: calc(100vh - 140px);
  background: var(--c-surface); border-radius: 14px; box-shadow: var(--shadow-float);
  display: none; flex-direction: column; overflow: hidden;
}
.assistant-panel.open { display: flex; }
.assistant-head { padding: 10px 14px; background: var(--c-anthracite); color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.assistant-head .t { font-weight: 700; font-size: 13px; }
.assistant-head .s { font-size: 11px; color: var(--c-on-dark-muted); }
.assistant-head button { width: 32px; height: 32px; border: 0; background: transparent; color: #fff; cursor: pointer; font-size: 18px; }

/* Mobile: stack, let the page scroll normally */
@media (max-width: 860px) {
  .app { height: auto; min-height: 100vh; overflow: visible; }
  .app-header { flex-wrap: wrap; padding: 0 16px; gap: 8px 16px; }
  .app-nav { flex-wrap: wrap; }
  .app-nav a { padding: 0 10px; min-height: 48px; }
  .workspace { flex-direction: column; height: auto; }
  .steps-col { flex: none; border-right: 0; border-bottom: 1px solid #DEDCDA; }
  .main-col, .page-scroll { overflow: visible; }
  .page.active { display: block; height: auto; }
  .step-pane, .results-pane { padding: 16px 16px 96px; }
  .page-inner { padding: 20px 16px 96px; }
}
