/* ═══ Assessment — shell ═══════════════════════════════════════════
   page layout, left sidebar, AOI card, status chips, workspace, tab bar.

   Part 1 of 9 of what was one 3,418-line static/css/pages/assessment.css
   (audit C3). LOAD ORDER IS LOAD-BEARING -- for CSS the cascade IS the
   behaviour, so two rules of equal specificity are decided by which came
   last. templates/base.html links them in exactly this sequence:

     shell -> panels -> tree -> overview -> tabs -> routes -> mobile -> region -> demand

   Moving a rule between these files, or reordering the links, can change
   rendering even though nothing was edited. tests/test_css_split.py holds
   the order and the byte content.
   ═══════════════════════════════════════════════════════════════ */

/* ═══ Assessment — Area of Interest ═══════════════════════════════ */

/* ── Full-page layout ─────────────────────────────────────────── */
.aoi-layout {
  display:    flex;
  height:     calc(100vh - var(--nav-h));
  overflow:   hidden;
  background: var(--bg0);
}

/* ── Left sidebar ─────────────────────────────────────────────── */
/* Floating control-deck card (Pipeline-Studio .lp), on the --bg0 gutter. */
.aoi-sidebar {
  width:           264px;
  flex-shrink:     0;
  display:         flex;
  flex-direction:  column;
  background:      var(--bg1);
  border:          1px solid var(--bdr);
  border-radius:   var(--radius);
  margin:          var(--space-md) 0 var(--space-md) var(--space-md);
  box-shadow:      var(--sh-raised);
  overflow:        hidden;
}
.aoi-sb-head {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  padding:         var(--space-xl) var(--space-xl) var(--space-xl);
  border-bottom:   1px solid var(--bdr);
  flex-shrink:     0;
}
.aoi-sb-title {
  font-family:    var(--font-sans);
  font-size:      var(--fs-2xs);
  font-weight:    600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color:          var(--t2);
}
.aoi-new-btn {
  font-family:  var(--font-sans);
  font-size:    var(--fs-xs);
  color:        var(--acc);
  background:   transparent;
  border:       1px solid var(--acc);
  border-radius: var(--radius);
  padding:      var(--space-2xs) var(--space-md);
  cursor:       pointer;
  transition:   background .12s;
  white-space:  nowrap;
}
.aoi-new-btn:hover { background: color-mix(in srgb, var(--acc) 10%, transparent); }

/* Tree menu wrapper — desktop: transparent flex column filling the sidebar
   (search-tools + scrolling list). Mobile turns it into a dropdown panel. */
.aoi-sb-menu {
  display:        flex;
  flex-direction: column;
  flex:           1;
  min-height:     0;
}
.aoi-list {
  flex:       1;
  overflow-y: auto;
  padding:    var(--space-md);
}
.aoi-list-empty {
  font-family: var(--font-sans);
  font-size:   var(--fs-micro);
  color:       var(--t2);
  padding:     var(--space-xl);
  text-align:  center;
}

/* ── AOI card (sidebar) ───────────────────────────────────────── */
.aoi-card {
  position:      relative;
  padding:       var(--space-lg) var(--space-xl);
  border-radius: var(--radius);
  border:        1px solid var(--bdr);
  background:    var(--bg2);
  cursor:        pointer;
  transition:    border-color .12s, background .12s;
  margin-bottom: var(--space-sm);
}
.aoi-card:hover            { border-color: var(--bdr2); background: var(--bg3); }
.aoi-card.aoi-card-sel     { border-color: var(--acc);  background: color-mix(in srgb, var(--acc) 8%, transparent); }

/* Delete affordance — ghost button top-right, revealed on card hover / focus.
   Matches the Pipeline Extractor image-card remove (.img-remove): transparent
   by default, a light-red tint + red × on its own hover. */
.aoi-card-del {
  position:        absolute;
  top:             5px;
  right:           5px;
  z-index:         2;
  display:         flex;
  align-items:     center;
  justify-content: center;
  width:           20px;
  height:          20px;
  padding:         0;
  color:           var(--t2);
  background:      transparent;
  border:          none;
  border-radius:   var(--radius);
  cursor:          pointer;
  opacity:         0;
  transition:      opacity .15s, color .15s, background .15s;
}
.aoi-card:hover .aoi-card-del,
.aoi-card-del:focus-visible { opacity: 1; }
.aoi-card-del:hover {
  color:      var(--err);
  background: color-mix(in srgb, var(--err) 12%, transparent);
}
.aoi-card-name {
  font-size:     var(--fs-caption);
  font-weight:   600;
  color:         var(--t0);
  margin-bottom: 5px;
  white-space:   nowrap;
  overflow:      hidden;
  text-overflow: ellipsis;
  padding-right: 22px;   /* clear the hover delete button */
}
.aoi-card-meta {
  display:     flex;
  align-items: center;
  gap:         var(--space-sm);
  flex-wrap:   wrap;
}
.aoi-card-basin {
  font-family: var(--font-sans);
  font-size:   var(--fs-2xs);
  color:       var(--t2);
}
.aoi-card-period {
  font-family: var(--font-num);
  font-size:   var(--fs-2xs);
  color:       var(--t2);
  margin-top:  var(--space-xs);
}

/* ── Status chips ─────────────────────────────────────────────── */
.aoi-chip {
  font-family:    var(--font-badge);
  font-size:      var(--fs-3xs);
  font-weight:    600;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding:        var(--space-2xs) var(--space-sm);
  border-radius:  var(--radius);
  white-space:    nowrap;
}
.aoi-chip-screening { background: color-mix(in srgb, var(--acc) 15%, transparent); color: var(--acc); }
.aoi-chip-active    { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.aoi-chip-hold      { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.aoi-chip-closed    { background: var(--bg3);           color: var(--t2); }

/* ── Main area ────────────────────────────────────────────────── */
.aoi-main {
  flex:            1;
  display:         flex;
  flex-direction:  column;
  overflow:        hidden;
  min-width:       0;
  margin:          var(--space-md) var(--space-md) var(--space-md) var(--space-md);   /* matching inset + gap from the deck card */
  background:      var(--bg1);
  border:          1px solid var(--bdr);
  border-radius:   var(--radius);
  box-shadow:      var(--sh-raised);
}

/* ── Empty state ──────────────────────────────────────────────── */
.aoi-empty {
  flex:            1;
  display:         flex;
  flex-direction:  column;
  align-items:     center;
  justify-content: center;
  text-align:      center;
  padding:         48px 40px;
}
.aoi-empty-ic    { font-size: var(--fs-display); margin-bottom: var(--space-2xl); opacity: .45; }
.aoi-empty-title { font-size: var(--fs-md); font-weight: 600; color: var(--t1); margin-bottom: var(--space-md); }
.aoi-empty-sub   { font-size: var(--fs-caption); color: var(--t2); max-width: 360px; line-height: 1.6; }

/* ── Workspace ────────────────────────────────────────────────── */
.aoi-ws {
  display:         none;
  flex-direction:  column;
  flex:            1;
  overflow:        hidden;

  /* Report typography scale — fluid with viewport width so the report grows on
     bigger screens. Ramp tuned so 1920 (1080p @ 100% DPI) sits at ~0.8× of the
     max and the max is only reached around ≥2560 CSS px — the old slopes hit
     max already at ~1900, which made 1080p render the report at full size
     (oversized vs the Extractor-density chrome around it).
       --rpt-h = section headers · --rpt-b = body/tables · --rpt-s = small labels
       --rpt-lg = large body (takeaway rows, report tables, chart titles)
       --rpt-title/-stat/-statnum/-sec/-kpi = masthead + stat band + section heads
     (This block is duplicated on .aoi-land-head — keep the two in sync.) */
  --rpt-h:       clamp(11.5px, 0.61vw + 0.4px,  16px);
  --rpt-b:       clamp(10.5px, 0.55vw + 0.4px,  14.5px);
  --rpt-s:       clamp(9.5px,  0.47vw + 1px,    13px);
  --rpt-lg:      clamp(12.5px, 0.5vw  + 3.2px,  16px);
  --rpt-title:   clamp(24px,   0.97vw + 6.2px,  31px);
  --rpt-stat:    clamp(20px,   0.81vw + 5.2px,  26px);
  --rpt-statnum: clamp(18px,   0.72vw + 4.6px,  23px);
  --rpt-sec:     clamp(15.5px, 0.63vw + 3.9px,  20px);
  --rpt-kpi:     clamp(14.5px, 0.56vw + 3.7px,  18px);
  /* Report econ-table row padding — fluid on the SAME ramp as the type above,
     so at 1920 (1080p) the rows sit at ~0.8× (≈9.5px) and only open to the full
     12px around ≥2560. Fixes the table feeling over-spaced at 1080p while the
     bigger screens still breathe. */
  --rpt-row-pad: clamp(6px,    0.39vw + 2px,    12px);
}

/* workspace header — consulting-report masthead (+ mode switch on the right) */
.aoi-ws-head {
  position:        relative;
  display:         flex;
  align-items:     flex-start;
  justify-content: space-between;
  gap:             var(--space-2xl);
  padding:         var(--space-2xl) 22px 13px;
  border-bottom:   1px solid var(--bdr);
  background:      var(--bg1);
  flex-shrink:     0;
}
/* Close (X) — top-right corner, sits above the Edit / View Report button.
   Returns to the landing (entry) screen via aoiPage.showLanding(). */
.aoi-ws-close {
  position:        absolute;
  top:             10px;
  right:           14px;
  display:         flex;
  align-items:     center;
  justify-content: center;
  width:           28px;
  height:          28px;
  padding:         0;
  color:           var(--t2);
  background:      none;
  border:          none;
  border-radius:   var(--radius);
  cursor:          pointer;
  z-index:         2;
}
.aoi-ws-close:hover { color: var(--t0); background: var(--bg2); }
.aoi-mast-l { min-width: 0; }
.aoi-mast-r {
  flex-shrink: 0;
  display:     flex;
  align-items: center;
  gap:         var(--space-md);
  padding-top: 31px;   /* clears the corner X and aligns with the big title line */
}
.aoi-mast-r .btn { display: inline-flex; align-items: center; gap: var(--space-sm); }
/* Study run-control — the "as of" stamp floats ABOVE the Reassess button
   (absolute, so it never pushes the button down: Edit · Reassess · Clone stay
   aligned on one row) and the row stays compact. */
.aoi-reassess-wrap {
  position: relative;
  display:  inline-flex;      /* height = the button → aligned with Edit / Clone */
}
.aoi-run-stamp {
  position:    absolute;
  bottom:      calc(100% + 2px);
  left:        2px;
  white-space: nowrap;
  font-family: var(--font-sans);
  font-size:   var(--fs-2xs, 11px);
  color:       var(--t2);
}
.aoi-run-stale { color: #d0872b; font-weight: 600; }   /* inputs drifted → Re-run */
.aoi-mast-r .btn.aoi-rerun-due {                        /* nudge Re-run when stale */
  border-color: #d0872b;
  color:        #d0872b;
}
.aoi-rpt-eyebrow {
  font-family:    var(--font-sans);
  font-size:      var(--rpt-s, 11px);
  font-weight:    600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color:          var(--acc);
  margin-bottom:  7px;
}
.aoi-rpt-title {
  font-family:    var(--font-heading);   /* Barlow Semi Condensed — brand headline */
  font-size:      var(--rpt-title, 31px);
  font-weight:    700;
  line-height:    1.02;
  letter-spacing: -.005em;
  color:          var(--t0);
}
.aoi-rpt-sub {
  margin-top:     var(--space-md);
  font-family:    var(--font-sans);
  font-size:      var(--rpt-s, 11px);
  font-weight:    500;
  letter-spacing: .04em;
  text-transform: uppercase;
  color:          var(--t2);
}
.aoi-rpt-dot { margin: 0 var(--space-md); opacity: .45; }
.aoi-ws-name {
  font-size:     var(--rpt-lg, 16px);
  font-weight:   600;
  color:         var(--t0);
  margin-bottom: var(--space-sm);
}
.aoi-ws-badges {
  display:     flex;
  align-items: center;
  gap:         var(--space-md);
  flex-wrap:   wrap;
}
.aoi-basin-badge {
  font-family:   var(--font-badge);
  font-size:     var(--fs-2xs);
  color:         var(--t2);
  background:    var(--bg3);
  border:        1px solid var(--bdr);
  border-radius: var(--radius);
  padding:       var(--space-2xs) var(--space-sm);
}
.aoi-ws-period {
  font-family: var(--font-num);
  font-size:   var(--fs-2xs);
  color:       var(--t2);
}
.aoi-ws-desc {
  font-size:   var(--fs-micro);
  color:       var(--t2);
  margin-top:  var(--space-sm);
  line-height: 1.5;
  max-width:   680px;
}

/* ── Tab bar ──────────────────────────────────────────────────── */
.aoi-tabs {
  display:       flex;
  align-items:   center;
  gap:           var(--space-2xs);
  padding:       0 20px;
  border-bottom: 1px solid var(--bdr);
  background:    var(--bg1);
  flex-shrink:   0;
}
.aoi-tab {
  font-family:    var(--font-sans);
  font-size:      var(--fs-xs);
  font-weight:    500;
  color:          var(--t2);
  background:     transparent;
  border:         none;
  border-bottom:  2px solid transparent;
  padding:        var(--space-lg) var(--space-xl) var(--space-md);
  cursor:         pointer;
  transition:     color .12s, border-color .12s;
  white-space:    nowrap;
}
.aoi-tab:hover     { color: var(--t1); }
.aoi-tab.aoi-tab-active {
  color:        var(--acc);
  border-bottom-color: var(--acc);
}

/* ── Tab panels ───────────────────────────────────────────────── */
.aoi-tab-body {
  flex:     1;
  overflow: hidden;
  position: relative;
}
.aoi-panel {
  display:    none;
  height:     100%;
  overflow-y: auto;
}
.aoi-panel.aoi-panel-active { display: block; }

