/* ═══ Assessment — overview ═══════════════════════════════════════════
   Overview composition + right rail as a report, Report<->Edit mode, Landing.

   Part 4 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.
   ═══════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════
   Overview — Dashboard-style composition (mirrors the in-map analysis
   panel): full-width stat strip + [ connectivity map | side rail ].
   Existing Route Economics + Key Takeaways cards live in the rail.
   ═══════════════════════════════════════════════════════════════════ */
/* The overview fills the panel height so the map can stretch to the bottom.
   #aoiOverviewContent (renderOverview's host) must carry the height for
   .aoi-ov2's height:100% to resolve. */
#aoiOverviewContent { height: 100%; }
.aoi-ov2 {
  padding:        20px 24px 24px;
  display:        flex;
  flex-direction: column;
  gap:            var(--space-2xl);
  height:         100%;
  box-sizing:     border-box;
}

/* Stat strip (Region · Benchmark · Best Netback) */
.aoi-ov2-stats {
  display:               grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap:                   var(--space-lg);
}
.aoi-ov2-stat {
  background:    var(--bg1);
  border:        1px solid var(--bdr);
  border-radius: var(--radius);
  padding:       var(--space-lg) var(--space-xl);
  min-width:     0;
}
.aoi-ov2-stat.hero { border-color: color-mix(in srgb, var(--acc) 45%, var(--bdr)); }
/* Hub Price card carries a title tooltip explaining how the price is derived */
#ovStatPriceCard { cursor: help; }
.aoi-ov2-stat .s-lbl {
  font-family:    var(--font-sans);
  font-size:      var(--rpt-s, 11px);
  font-weight:    600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color:          var(--t2);
  margin-bottom:  7px;
  white-space:    nowrap;
  overflow:       hidden;
  text-overflow:  ellipsis;
}
.aoi-ov2-stat .s-val {
  font-family:   var(--font-heading);   /* condensed headline for the region name */
  font-size:     var(--rpt-stat, 26px);
  font-weight:   700;
  line-height:   1;
  color:         var(--t0);
  white-space:   nowrap;
  overflow:      hidden;
  text-overflow: ellipsis;
}
.aoi-ov2-stat.num .s-val { font-family: var(--font-sans); font-size: var(--rpt-statnum, 23px); letter-spacing: -.01em; }
.aoi-ov2-stat.hero .s-val { color: var(--acc); }
/* Best-outlet hub name — a small chip beside the hero "Best Netback" label. */
.aoi-ov2-stat .s-hub {
  display:        inline-block;
  margin-left:    var(--space-sm);
  padding:        var(--space-2xs) var(--space-sm);
  font-family:    var(--font-sans);
  font-size:      var(--fs-micro);
  font-weight:    600;
  letter-spacing: 0;
  text-transform: none;
  color:          var(--acc);
  background:     color-mix(in srgb, var(--acc) 14%, transparent);
  border-radius:  var(--radius);
  vertical-align: middle;
}
.aoi-ov2-stat .s-hub:empty { display: none; }
/* Basis vs HH sign colours (higher specificity than the mobile value rules). */
.aoi-ov2-stat.num .s-val.pos { color: var(--ok);  }
.aoi-ov2-stat.num .s-val.neg { color: var(--err); }
.aoi-ov2-stat .s-sub {
  margin-top:    5px;
  font-size:     var(--rpt-b, 12px);
  color:         var(--t2);
  white-space:   nowrap;
  overflow:      hidden;
  text-overflow: ellipsis;
}

/* Main = 3 columns: operator map (~50%) · Operators-in-AOI legend (single
   vertical column, same height as the map) · other info (Route Economics +
   Key Takeaways). All stretch to the panel height; .aoi-ov2 bottom padding
   leaves the gap at the very bottom. */
.aoi-ov2-main {
  flex:                  1;
  min-height:            0;
  display:               grid;
  grid-template-columns: minmax(0, 1fr) 245px minmax(0, 0.95fr);
  gap:                   var(--space-2xl);
  align-items:           stretch;
}
.aoi-ov2-main .aoi-sec-card { margin-bottom: 0; }
.aoi-ov2-mapcard {
  display:        flex;
  flex-direction: column;
  min-height:     0;
}
.aoi-ov2-side {
  display:        flex;
  flex-direction: column;
  gap:            var(--space-2xl);
  min-width:      0;
  min-height:     0;
  overflow-y:     auto;
}

/* ── Overview right rail as a REPORT (not cards) ──────────────────────
   Route Economics + Key Takeaways deliberately break from the bordered
   map/legend cards: no box, an accent-bar heading, and generous vertical
   rhythm so the column reads like a written brief. Left column (map +
   operator legend) keeps the .aoi-sec-card chrome. */
.aoi-ov2-report      { gap: clamp(22px, 1.6vw, 36px); padding: var(--aoi-report-pad); }
.aoi-rpt-sec         { display: flex; flex-direction: column; }
.aoi-rpt-sec-title {
  display:        flex;
  align-items:    center;
  gap:            var(--space-xl);
  margin:         0 0 var(--space-2xl);
  font-family:    var(--font-sans);
  font-size:      var(--rpt-sec, 20px);
  font-weight:    700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color:          var(--t0);
}
.aoi-rpt-sec-title::before {
  content:       "";
  flex-shrink:   0;
  width:         5px;
  height:        1.05em;   /* accent bar tracks the (fluid) title size */
  border-radius: 2px;
  background:    var(--acc);
}
/* Report econ table — flush to the left rule, roomier rows, larger type */
.aoi-rpt-sec .econ-table    { font-size: var(--rpt-lg, 16px); }
.aoi-rpt-sec .econ-table th { font-size: var(--rpt-s, 12px); padding: 0 var(--space-xl) var(--space-md) 0; }
.aoi-rpt-sec .econ-table th:last-child,
.aoi-rpt-sec .econ-table td:last-child { padding-right: 0; }
.aoi-rpt-sec .econ-table td { padding: var(--rpt-row-pad) var(--space-xl) var(--rpt-row-pad) 0; }
.aoi-rpt-sec .econ-row-benchmark,
.aoi-rpt-sec .econ-row-best td { background: none; }   /* no fill — hairlines carry it */

/* Operator map wrapper — fills the card (big, full-height), overlay anchor */
.aoi-ov-mapwrap {
  position:   relative;
  flex:       1;
  min-height: 0;
  background: var(--bg2);
}
.aoi-ov-mapwrap .aoi-ov-map { position: absolute; inset: 0; height: auto; }

/* Map mask / Color toggle / Layers control / operator-legend list styles now
   live in the shared components/analysis-map.css (amap-*) — the factory in
   static/js/shared/analysis-map.js renders those controls. Below: only the
   page-local hosts. */

/* Operator legend — right-rail card. Fills the rail and scrolls its own list
   so Route Economics + Takeaways stay reachable below. */
.aoi-ovleg-card {
  display:        flex;
  flex-direction: column;
  min-height:     0;
}
.aoi-ov-legend {
  display:        flex;
  flex-direction: column;
  gap:            5px;
  padding:        var(--space-md) var(--space-md) var(--space-md);
  min-height:     0;
}

/* Premium caption above the outlet table (was a KPI cell) */
.aoi-ov-econ-cap {
  display:       flex;
  align-items:   flex-start;
  gap:           9px;
  font-size:     var(--rpt-lg, 16px);
  color:         var(--t2);
  margin-bottom: var(--space-2xl);
  line-height:   1.55;
}
.aoi-ov-econ-cap b { color: var(--t0); font-weight: 700; }
.aoi-ov-econ-cap-ic {
  flex-shrink: 0;
  display:     inline-flex;
  align-items: center;
  margin-top:  3px;
  color:       var(--acc);
}
.aoi-ov-econ-cap-ic svg { width: 15px; height: 15px; }

/* Stack on narrow content widths */
@media (max-width: 1180px) {
  #aoiOverviewContent { height: auto; }
  .aoi-ov2 { height: auto; }
  .aoi-ov2-main { grid-template-columns: 1fr; flex: none; align-items: start; }
  .aoi-ov2-side { overflow: visible; }
  .aoi-ovleg-card { max-height: none; }
  .aoi-ov-mapwrap { min-height: 352px; }   /* 80% of the former 440px — shorter map on narrow widths */
}


/* ═══ Report ↔ Edit mode ═════════════════════════════════════════════ */
/* hidden attr must beat display:flex on the section bars */
.aoi-secbar[hidden] { display: none; }

/* Edit bar — accent-tinted strip (Studio .lp-mode-hdr tone) so the mode
   reads instantly. */
.aoi-secbar-edit {
  background:          color-mix(in srgb, var(--acc) 7%, transparent);
  border-bottom-color: color-mix(in srgb, var(--acc) 28%, transparent);
}
.aoi-editbar-tag {
  font-family:    var(--font-badge);
  font-size:      var(--fs-2xs);
  font-weight:    700;
  letter-spacing: .14em;
  color:          var(--on-acc);
  background:     var(--acc);
  border-radius:  var(--radius);
  padding:        var(--space-2xs) var(--space-md);
  margin-right:   var(--space-sm);
  flex-shrink:    0;
}

/* Edit · Area & Basics — Studio-style edit toolbar on top, then
   metadata form (left) + boundary map (right, fills) */
#aoiAreaContent { height: 100%; display: flex; flex-direction: column; }

/* Toolbar — reuses the Pipeline Studio .etb/.rgroup/.rtool kit (loaded
   globally from extractor.css); only page-local layout lives here. */
.aoi-etb { flex-shrink: 0; }
.aoi-etb-hint {
  margin-left:   auto;
  font-family:   var(--font-sans);
  font-size:     var(--fs-xs);
  color:         var(--t2);
  white-space:   nowrap;
  overflow:      hidden;
  text-overflow: ellipsis;
  padding-left:  var(--space-xl);
}
/* Corner drag handle on the selected tract — small vector-editor square. */
.aoi-tract-handle {
  background:    #fff;
  border:        2px solid #8a6410;
  border-radius: 2px;
  box-shadow:    0 1px 3px rgba(0,0,0,.4);
  cursor:        nwse-resize;
}
/* Focus-region corner handle — same square, accent-blue (always visible on
   the edit map so the region can be resized without redrawing). */
.aoi-focus-handle {
  background:    #fff;
  border:        2px solid var(--acc);
  border-radius: 2px;
  box-shadow:    0 1px 3px rgba(0,0,0,.4);
  cursor:        nwse-resize;
}
/* Focus-region centre MOVE handle — drag shifts the whole frame; click
   selects it (enables Delete). Round to read differently from the square
   resize corners. */
.aoi-focus-move {
  display:         flex;
  align-items:     center;
  justify-content: center;
  background:      #fff;
  border:          2px solid var(--acc);
  border-radius:   50%;
  box-shadow:      0 1px 4px rgba(0,0,0,.45);
  color:           var(--acc);
  cursor:          move;
}

.aoi-area-wrap {
  display:               grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap:                   var(--space-2xl);
  align-items:           stretch;
  flex:                  1;
  min-height:            0;
  box-sizing:            border-box;
  padding:               var(--space-2xl) 24px 24px;
}
.aoi-area-form { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
.aoi-area-fields {
  display:        flex;
  flex-direction: column;
  gap:            var(--space-xl);
  padding:        var(--space-xl);
}
.aoi-area-mapcard {
  display:        flex;
  flex-direction: column;
  min-height:     0;
}
@media (max-width: 1180px) {
  #aoiAreaContent { height: auto; }
  .aoi-area-wrap { grid-template-columns: 1fr; height: auto; }
  .aoi-area-mapcard .aoi-ov-mapwrap { min-height: 420px; }
}


/* ═══ Landing (entry) — all areas on a clustered plays map ═══════════ */
.aoi-land {
  display:        flex;   /* default entry view; selectAoi() sets display:none */
  flex-direction: column;
  flex:           1;
  min-height:     0;
  overflow:       hidden;
}
.aoi-land-head {
  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;
  /* report typography tokens (this block is outside .aoi-ws — mirror of the
     .aoi-ws block above; 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);
  --rpt-row-pad: clamp(6px,    0.39vw + 2px,    12px);
}
.aoi-land-head .aoi-mast-r { padding-top: var(--space-2xl); }
.aoi-land-mapwrap {
  position:  relative;
  flex:      1;
  min-height:0;
  margin:    var(--space-xl);
  border:    1px solid var(--bdr);
  border-radius: var(--radius);
  overflow:  hidden;
  background: var(--bg2);
}
.aoi-land-map { position: absolute; inset: 0; }

/* Entry-map controls stack down the left edge — search box on top, Layers
   button directly beneath it, both flush at 8px.

   They arrive wanting the same seat: map-search.css parks the box at 14/14 and
   the shared layer control mounts at 8/8. The Dashboard solves the same clash
   by sliding its search sideways past the button, but that map's search is a
   collapsed pill; this one is a full-width field, so pushing it right just
   trades the overlap for a cramped box. Stacking keeps both at full size and
   gives them one shared left edge to line up on.

   The search keeps the higher z-index (1000 vs 500), so its results dropdown
   falls OVER the Layers button while you type instead of behind it. */
.aoi-land-map .map-search-wrap {
  top:   8px;
  left:  8px;
  width: min(280px, calc(100% - 16px));
}
/* 8 (search top) + 36 (box height) + 8 (gap) = 52. 레일이 통째로 검색창 아래에서
   시작한다 — 그 안의 Layers·Filter 는 서로 밀 뿐 겹치지 않는다. 셀렉터를 한 칸 더
   구체적으로 둔 건 components/analysis-map.css 의 `.amap-host > .map-rail` 과
   특정도가 같아 로드 순서에 기대게 되기 때문 — 순서가 아니라 규칙으로 이기게 한다. */
.aoi-land-mapwrap.amap-host .map-rail {
  top:        52px;
  left:       8px;
  max-height: calc(100% - 60px);
}

/* 좁은 화면에서는 검색창이 상단 줄을 통째로 쓴다(width: 100% - 16px). 기본 자리가
   상단 중앙인 Color 토글과 상단 우측인 Operators 는 그 밑으로 깔린다 — 안 그러면
   검색창 위에 얹힌다. 세로 순서: 검색(8) → Color·Operators(52) → 레일(94).
   Color 는 왼쪽, Operators 는 오른쪽 — 패널이 열리면 왼쪽으로 자라지만 폰 폭에서도
   둘이 만나지 않는다. */
@media (max-width: 900px) {
  .aoi-land-mapwrap .amap-cmp { top: 52px; left: 8px; right: auto; transform: none; }
  .aoi-land-mapwrap .amap-ops { top: 52px; }
  .aoi-land-mapwrap.amap-host .map-rail { top: 94px; max-height: calc(100% - 102px); }
}


/* Single-area marker — status-coloured dot with a soft ring */
.aoi-land-dot {
  display:       block;
  width:         14px;
  height:        14px;
  border-radius: 50%;
  background:    var(--c, var(--acc));
  border:        2px solid var(--bg1);
  box-shadow:    0 0 0 1px var(--c, var(--acc)), 0 1px 4px rgba(0,0,0,.35);
  cursor:        pointer;
  transition:    transform .12s;
}
.aoi-land-mk:hover .aoi-land-dot { transform: scale(1.25); }

/* Cluster badge — count of areas grouped at this zoom */
.aoi-land-cl { cursor: pointer; }
.aoi-land-cl-inner {
  display:         flex;
  align-items:     center;
  justify-content: center;
  width:           100%;
  height:          100%;
  border-radius:   50%;
  font-family:     var(--font-sans);
  font-weight:     700;
  color:           var(--on-acc);
  background:      color-mix(in srgb, var(--acc) 88%, #000);
  border:          2px solid var(--bg1);
  box-shadow:      0 2px 8px rgba(0,0,0,.35);
  transition:      transform .12s;
}
.aoi-land-cl:hover .aoi-land-cl-inner { transform: scale(1.08); }
.aoi-land-cl-sm { font-size: var(--fs-sm); }
.aoi-land-cl-md { font-size: var(--fs-md); background: color-mix(in srgb, var(--acc) 80%, #000); }
.aoi-land-cl-lg { font-size: var(--fs-lg); background: color-mix(in srgb, var(--acc) 72%, #000); }

/* Sidebar deck header → clickable "home" affordance */
.aoi-lp-hdr-btn { cursor: pointer; transition: background .12s; }
.aoi-lp-hdr-btn:hover { background: color-mix(in srgb, var(--acc) 14%, transparent); }

