/* ==========================================================================
   INA Platform — App shell
   Loaded ON TOP OF style.css (same design tokens: ink / paper / amber) by
   the five pages in /app/. Gives the Platform its own "product" header,
   footer and auth layout so it reads as a standalone application, distinct
   from the institutional marketing site, while staying visually on-brand.
   ========================================================================== */

.app-body{ display:flex; flex-direction:column; min-height:100vh; min-height:100dvh; }
.app-main{ flex:1 1 auto; background:var(--paper); }

/* ---------- App header ---------- */
.app-header{
  position:sticky; top:0; z-index:50;
  background:var(--ink); color:var(--text-on-dark);
  border-bottom:1px solid var(--ink-line);
}
.app-header-inner{
  max-width:var(--maxw); margin:0 auto; padding:0 32px;
  min-height:64px; display:flex; align-items:center; gap:28px;
}
.app-logo{ display:flex; align-items:center; gap:10px; flex:0 0 auto; }
.app-logo .logo-mark{ color:var(--text-on-dark); }
.app-logo-word{ font-family:var(--serif); font-size:16px; display:flex; align-items:baseline; gap:7px; }
.app-logo-word b{ font-weight:600; color:var(--text-on-dark); }
.app-logo-word i{
  font-style:normal; font-family:var(--mono); font-size:10px; letter-spacing:.09em;
  text-transform:uppercase; color:var(--amber);
}

.app-nav{ display:flex; align-items:center; gap:24px; flex:1 1 auto; min-width:0; }
.app-nav a{
  font-family:var(--sans); font-size:13px; color:var(--muted-on-dark);
  padding:22px 0; border-bottom:2px solid transparent; transition:color .15s ease, border-color .15s ease;
  white-space:nowrap;
}
.app-nav a:hover{ color:var(--text-on-dark); }
.app-nav a.active{ color:var(--text-on-dark); border-bottom-color:var(--amber); }

.app-header-actions{ display:flex; align-items:center; gap:16px; margin-left:auto; flex:0 0 auto; }
.app-header--auth .app-header-inner{ justify-content:space-between; }
.app-back-link{ font-family:var(--mono); font-size:11.5px; color:var(--muted-on-dark); letter-spacing:.03em; white-space:nowrap; }
.app-back-link:hover{ color:var(--amber); }

.app-user{ display:flex; align-items:center; gap:9px; }
.app-user-avatar{
  width:29px; height:29px; border-radius:50%; background:var(--amber); color:var(--ink);
  font-family:var(--serif); font-weight:600; font-size:12.5px;
  display:flex; align-items:center; justify-content:center; flex:0 0 auto;
}
.app-user-name{ font-size:12.5px; color:var(--muted-on-dark); display:none; white-space:nowrap; }
@media (min-width:900px){ .app-user-name{ display:block; } }

@media (max-width:760px){
  .app-nav{ display:none; }
  .app-header-inner{ gap:14px; padding:0 20px; min-height:58px; }
  .app-logo-word i{ display:none; }
}

/* ---------- App footer ---------- */
.app-footer{ background:var(--ink); border-top:1px solid var(--ink-line); padding:20px 0; }
.app-footer-inner{
  max-width:var(--maxw); margin:0 auto; padding:0 32px;
  display:flex; justify-content:space-between; align-items:center; gap:14px; flex-wrap:wrap;
  font-family:var(--mono); font-size:11px; color:var(--muted-on-dark); letter-spacing:.03em;
}
.app-footer-link{ color:var(--muted-on-dark); }
.app-footer-link:hover{ color:var(--amber); }
@media (max-width:640px){ .app-footer-inner{ padding:0 20px; } }

/* ---------- Auth split screen (login / register) ---------- */
.auth-screen{ display:grid; grid-template-columns: 1fr 1fr; }
.auth-screen-brand{
  background:var(--ink); color:var(--text-on-dark); position:relative; overflow:hidden;
  display:flex; align-items:center; padding:64px 56px;
}
.auth-screen-brand::before{
  content:""; position:absolute; inset:0; pointer-events:none;
  background:
    radial-gradient(560px 380px at 18% 12%, rgba(217,146,46,0.18), transparent 60%),
    radial-gradient(480px 360px at 92% 92%, rgba(217,146,46,0.10), transparent 60%);
}
.auth-brand-inner{ position:relative; max-width:420px; min-width:0; }
.auth-brand-points{ margin-top:28px; display:flex; flex-direction:column; gap:15px; }
.auth-brand-points li{ font-size:13.5px; color:var(--muted-on-dark); padding-left:22px; position:relative; line-height:1.5; }
.auth-brand-points li::before{ content:"\2192"; position:absolute; left:0; color:var(--amber); }

.auth-screen-form{ display:flex; align-items:center; justify-content:center; padding:64px 32px; background:var(--paper); }
.auth-screen-form .auth-card{ width:100%; max-width:420px; border:none; padding:0; background:transparent; }

@media (max-width:920px){
  .auth-screen{ grid-template-columns:1fr; }
  .auth-screen-brand{ padding:40px 32px 34px; }
  .auth-brand-inner{ max-width:100%; }
  .auth-brand-points{ display:none; }
  .auth-screen-form{ padding:40px 24px 56px; }
}

/* ---------- Small app-page polish (dashboard / new-project / project) ---------- */
.app-main > section.tight:first-of-type{ padding-top:48px; }

/* ---------- Project workflow stepper (app/project.html) ----------
   Shows the project's progress through the 4 Investment Readiness Index™
   stages, reused here as the workflow's states — see
   supabase/migration_v12_workflow.sql. Colors reuse the same
   .status-pill.stage-* palette (style.css) so the stepper visually agrees
   with the status pill shown elsewhere on this same page. */
.wf-stepper{ display:flex; align-items:flex-start; gap:0; margin:18px 0 20px; }
.wf-step{ flex:1 1 0; display:flex; flex-direction:column; align-items:center; text-align:center; min-width:0; position:relative; }
.wf-step-line{
  position:absolute; top:13px; left:-50%; width:100%; height:2px;
  background:var(--paper-line); z-index:0;
}
.wf-step:first-child .wf-step-line{ display:none; }
.wf-step.done .wf-step-line, .wf-step.current .wf-step-line{ background:var(--amber); }
.wf-step-dot{
  position:relative; z-index:1; width:26px; height:26px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  font-family:var(--mono); font-size:11px; font-weight:600;
  background:var(--paper-2); color:var(--muted); border:2px solid var(--paper-line);
}
.wf-step.done .wf-step-dot{ background:var(--amber); color:var(--ink); border-color:var(--amber); }
.wf-step.current .wf-step-dot{ background:var(--ink); color:var(--amber); border-color:var(--ink); }
.wf-step-label{ margin-top:8px; font-size:11.5px; color:var(--muted); max-width:110px; line-height:1.3; }
.wf-step.current .wf-step-label{ color:var(--text); font-weight:600; }

/* Transient "analyzing" state — the leading step while the AI analysis is
   actively running (project.status === 'analyzing'). A soft pulse marks it
   as in-progress rather than a settled "current" state. */
.wf-step.analyzing .wf-step-dot{ animation:wfPulse 1.6s ease-in-out infinite; }
@keyframes wfPulse{
  0%, 100%{ box-shadow:0 0 0 0 rgba(217,146,46,.45); }
  50%{ box-shadow:0 0 0 6px rgba(217,146,46,0); }
}

/* Clickable promote/demote arrows directly on the stepper's connecting
   lines (app/project.html's renderWorkflow()) — an advisor-only shortcut
   onto the same promote_project_workflow()/demote_project_workflow()/
   return_project_to_not_analyzed() RPCs the Actions menu items use (see
   migration_v20_workflow_promote_demote.sql), so they don't have to open
   that menu just to move the project one step. Sits at left:0 of its
   .wf-step (same x-coordinate as .wf-step-line's own midpoint — see that
   rule's -50%/100% math), centered on it via the transform, one z-index
   above the line so it's clickable without disturbing the dot beside it. */
.wf-step-arrow{
  position:absolute; top:13px; left:0; transform:translate(-50%,-50%);
  z-index:2; width:20px; height:20px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  font-family:var(--mono); font-size:13px; line-height:1; font-weight:700;
  background:var(--paper); color:var(--amber-deep); border:1.5px solid var(--amber);
  cursor:pointer; padding:0;
}
.wf-step-arrow:hover{ background:var(--amber); color:var(--ink); }

/* ---------- Action menus (app/project.html) ----------
   Two dropdown menus, both plain text+caret buttons: "Actions" (Save
   PDF / Edit / Delete / Close) sits next to the status pill in the
   platform header. "Analysis" (FSU Scoring / Self-Assessment / AI
   Analysis) sits in its own row directly under the breadcrumb, above
   everything else in the page content — see .page-menu-row below.

   Both are ALSO duplicated in the sticky top nav (#navAnalysisMenu /
   #navActionsMenu, to the left of "Projects") so they stay reachable
   without scrolling back up — see .nav-menu rules further down. The
   nav copies mirror the body ones' state via JS (see app/project.html);
   they're a second way to reach the exact same actions, not a
   replacement for the body ones. */
.header-controls{ display:flex; align-items:center; gap:14px; }
.page-menu-row{ display:flex; margin-bottom:20px; }
.menu{ position:relative; }
.menu-trigger{ display:inline-flex; align-items:center; gap:7px; }
.menu-caret{ font-size:9px; transition:transform .15s ease; }
.menu.open .menu-caret{ transform:rotate(180deg); }
.menu-panel{
  position:absolute; top:calc(100% + 8px); left:0; z-index:20; min-width:210px;
  background:var(--paper); border:1px solid var(--paper-line); border-radius:4px;
  box-shadow:0 14px 32px rgba(11,21,38,.16);
  padding:5px; display:none; flex-direction:column; gap:1px;
}
#actionsMenu .menu-panel{ left:auto; right:0; }
.menu.open .menu-panel{ display:flex; }
/* Every item in every dropdown (Project, Analysis, body or nav copy)
   shares this one look — same font, weight, size, color, alignment — on
   purpose. No red "danger" variant, no amber "CTA" variant: the confirm
   dialog on Delete and the always-visible project status already
   communicate what matters, so the menu itself stays uniform. This
   applies equally to <a> and <button> items — see the .app-nav
   .menu-panel a.menu-item override further down, which exists solely to
   stop the plain nav-link style from leaking into <a> items inside a nav
   dropdown and making them look different from their <button> siblings. */
.menu-item{
  display:flex; align-items:center; width:100%; text-align:left; padding:10px 12px;
  font-family:var(--mono); font-size:11.5px; font-weight:600; letter-spacing:.03em;
  background:none; border:none; color:var(--text); cursor:pointer; border-radius:3px;
  line-height:1.3;
}
.menu-item:hover{ background:var(--paper-2); }
.menu-item[disabled]{ opacity:.45; cursor:not-allowed; }
.menu-item[disabled]:hover{ background:none; }
/* Analysis trigger keeps the same amber tint used elsewhere for
   analysis-related controls, so it reads as distinct from a plain button. */
.btn.tint-amber{ border-color:var(--amber-deep); color:var(--amber-deep); }
.btn.tint-amber:hover{ background:var(--amber-deep); border-color:var(--amber-deep); color:var(--paper); }
@media (max-width:560px){
  .menu-panel{ left:0; right:0; min-width:0; }
}

/* Nav copies of the Analysis/Actions menus — styled to match the plain
   nav links (.app-nav a) next to them, since they sit in the same dark
   sticky header row, to the left of "Projects". */
.app-nav .nav-menu{ position:relative; }
.nav-menu-trigger{
  display:inline-flex; align-items:center; gap:6px;
  font-family:var(--sans); font-size:13px; color:var(--muted-on-dark);
  padding:22px 0; border:none; border-bottom:2px solid transparent; background:none;
  cursor:pointer; transition:color .15s ease, border-color .15s ease; white-space:nowrap;
}
.nav-menu-trigger:hover{ color:var(--text-on-dark); }
.nav-menu.open .nav-menu-trigger{ color:var(--text-on-dark); border-bottom-color:var(--amber); }
.app-nav .nav-menu .menu-panel{
  left:0; top:calc(100% + 8px); border-radius:3px; min-width:210px;
  padding:5px; box-shadow:0 14px 32px rgba(11,21,38,.22);
}
/* .app-nav a{...} (the plain nav-link style, light gray on the dark
   header) is a descendant selector that would otherwise leak into every
   <a> menu item inside a nav dropdown panel (New Project/Edit/Close,
   FSU Scoring/Self-Assessment) — its specificity beats plain .menu-item,
   so those items rendered in a different, washed-out color than their
   <button> siblings (Download PDF/Delete/AI Analysis) in the very same
   panel. This re-asserts .menu-item's look for <a> items specifically
   inside a nav panel, so every item — <a> or <button>, body or nav copy —
   is identical: same font, weight, size, color, spacing. */
.app-nav .menu-panel a.menu-item{
  font-family:var(--mono); font-size:11.5px; font-weight:600; letter-spacing:.03em;
  color:var(--text); padding:10px 12px; border-bottom:none;
}
.app-nav .menu-panel a.menu-item:hover{ color:var(--text); background:var(--paper-2); }

.wf-advisor-row{
  display:flex; align-items:center; justify-content:space-between; gap:14px; flex-wrap:wrap;
  padding-top:16px; border-top:1px solid var(--paper-line);
}
.wf-advisor-row p{ font-size:13.5px; color:var(--muted); }
.wf-advisor-row p b{ color:var(--text); font-weight:600; }
.wf-actions{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }

.wf-history{ margin-top:18px; padding-top:16px; border-top:1px solid var(--paper-line); }
.wf-history-item{
  font-size:12.5px; color:var(--muted); padding:6px 0;
  display:flex; align-items:baseline; gap:8px; flex-wrap:wrap;
}
.wf-history-item b{ color:var(--text); font-weight:600; }
.wf-history-note{
  flex-basis:100%; font-size:12px; font-style:italic; color:var(--muted);
  opacity:.85; padding-left:2px;
}
.wf-history-toggle{
  font-family:var(--mono); font-size:11px; text-transform:uppercase; letter-spacing:.05em;
  color:var(--amber-deep); cursor:pointer; background:none; border:none; padding:0;
}
