/* ═══ Assessment — demand ═══════════════════════════════════════════
   Demand tab: gas-fired generation inside the acreage's rings.

   Part 9 of 9. The first eight are the split of what was one 3,418-line
   static/css/pages/assessment.css (audit C3); this one is new, and goes
   LAST because it is newest -- the same rule the split follows.
   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.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Demand 탭 · 애크리지 반경 안의 가스화력 수요 ───────────────────────────
   One report page: ring summary strip on top, then a true-north mini-map of the
   fleet (left) beside the ranked roster (right).

   Borrows Region's chart tokens on purpose — the two tabs sit next to each other
   and a second grid/tick grey would read as a different app.

   마커 색은 둘이고 출처가 다르다 (2026-09-23).
   · --dem-op    가동·큐. 값은 여기 없다 — tab-demand.js 가 마운트 때 공용 팔레트
                 (shared/power-layers.js PP_COLORS.gas, 대시보드의 가스 마커와 같은
                 색)에서 읽어 .aoi-dem 에 심는다. CSS 에 한 번 더 적으면 캔버스와
                 범례가 조용히 갈라진다.
   · --dem-planned  계획. 이 탭에만 있는 층이라 이 탭에서만 쓰는 색이고, 범례가
                 이름을 붙인다. NOT --acc: that is the acreage marker at the centre
                 of the map, and two things in one accent read as one thing. */
#aoiDemandContent{ height:100%; }              /* height chain: panel → .aoi-dem */
.aoi-dem{
  --dem-planned:var(--cat-lng);                /* planned — the burn being built */
  --rgn-grid:color-mix(in srgb, var(--t2) 45%, transparent);
  --rgn-tick:var(--t2);
  display:flex; flex-direction:column; gap:var(--space-2xl);
  height:100%; min-height:0; padding:var(--aoi-tab-pad);
}
.aoi-dem-titlesec .aoi-rpt-sec-title{ margin:0; }
.aoi-dem-lead{ font-size:var(--rpt-b); color:var(--t2); margin-top:var(--space-2xs);
  display:flex; align-items:baseline; gap:var(--space-md); flex-wrap:wrap; }
.aoi-dem-src{ font-size:var(--rpt-s); color:var(--t2); opacity:.75; }

/* ── ring summary strip ───────────────────────────────────────────
   Cumulative rings, so these read left-to-right as one widening answer rather
   than three separate facts. Elevation, not borders (house rule).

   THE STRIP IS THE MAP'S, NOT THE PAGE'S. It used to run the full width above
   both columns, which made the roster start halfway down its own section and
   left a band of nothing beside the cards. The cards are a reading of the three
   circles on the map, so they sit on the map's measure — and the roster gets its
   section back, from the top. Narrower measure ⇒ tighter padding and a smaller
   stat: at three-up in half a column the old 26px number wrapped its unit. */
.aoi-dem-rings{ display:grid; grid-template-columns:repeat(3, minmax(0,1fr));
  gap:var(--space-md); flex:none; }
.aoi-dem-ring{ background:color-mix(in srgb, var(--t2) 10%, transparent);
  border-radius:var(--radius); padding:var(--space-md) var(--space-lg);
  box-shadow:var(--sh-raised);
  display:flex; flex-direction:column; gap:1px; min-width:0; }
.aoi-dem-ring-h{ font-size:var(--rpt-s); font-weight:600; color:var(--t2);
  text-transform:uppercase; letter-spacing:.04em; }
.aoi-dem-ring-v{ font-family:var(--font-num); font-size:var(--rpt-statnum, 23px);
  font-weight:600; color:var(--t0); letter-spacing:-.01em; line-height:1.15;
  display:flex; align-items:baseline; gap:var(--space-2xs); }
.aoi-dem-ring-u{ font-family:var(--font-sans); font-size:var(--rpt-s);
  font-weight:500; color:var(--t2); }
/* Both sub-lines wrap at this measure (three cards across half a column), so
   they carry their own line-height rather than inheriting the body's — two tight
   lines read as one fact, two loose ones read as two. */
.aoi-dem-ring-s{ font-size:var(--rpt-b); color:var(--t1); line-height:1.3; }
/* The planned line is the forward-looking half of the card — tinted so the eye
   separates "is burning" from "will burn" without a second card. */
.aoi-dem-ring-p{ font-size:var(--rpt-s); font-weight:500; color:var(--dem-planned);
  line-height:1.3; margin-top:var(--space-2xs); }
.aoi-dem-ring-p0{ color:var(--t2); font-weight:400; }
/* 큐 줄 — 회색이고, 위의 숫자에 합산되지 않는다(routes/aoi/demand.py: 큐는 예측이
   아니다). "커버 안 함"과 "0건"은 같은 회색이지만 다른 문장이다(demand-view.js). */
.aoi-dem-ring-q{ font-size:var(--rpt-s); color:var(--t2); line-height:1.3;
  margin-top:var(--space-2xs); }
.aoi-dem-ring-q0{ opacity:.8; }
.aoi-dem-ring-qia{ opacity:.8; }

/* ── map + roster ─────────────────────────────────────────────────
   Even columns. The left one now carries the ring strip as well as the map, and
   three cards across a .85fr track were narrower than their own numbers. */
.aoi-dem-grid{ display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr);
  column-gap:clamp(28px, 3vw, 52px); row-gap:var(--space-2xl);
  flex:1; min-height:0; }
.aoi-dem-col{ min-width:0; min-height:0; display:flex; flex-direction:column;
  gap:var(--space-lg); }
/* Section headings are the REGION tab's (.aoi-rgn-colh → .aoi-prof-eyebrow):
   same size, same accent, same hairline under the row. These two tabs sit beside
   each other in the deck and a second heading language reads as a second app.
   The hairline lives on the HEAD ROW, not the h4, so the Fit button and the
   in-view count sit on the title's line and the rule runs the full column. */
.aoi-dem-colh{ font-size:var(--rpt-sec); font-weight:600; letter-spacing:-.005em;
  color:var(--emph-red); margin:0;
  display:flex; align-items:baseline; gap:var(--space-sm); }
.aoi-dem-colh-n{ font-family:var(--font-num); font-weight:600; color:var(--t1); }

/* Leaflet needs a real measured box — flex:1 with min-height:0 gives it the
   column's leftover height, and the min-height floor keeps it usable when the
   column has almost none to give. */
.aoi-dem-map{ flex:1; min-height:320px; border-radius:var(--radius);
  overflow:hidden; background:var(--bg2); }
.aoi-dem-map .leaflet-container{ width:100%; height:100%; background:var(--bg2); }
.aoi-dem-maphead, .aoi-dem-listhead{ display:flex; align-items:baseline;
  justify-content:space-between; gap:var(--space-md); flex:none;
  padding-bottom:9px; border-bottom:1px solid var(--bdr); }
.aoi-dem-listsub{ font-size:var(--rpt-s); color:var(--t2); }
/* "Fit" — the way back after panning off. Text button, no box: the map already
   owns the corner controls and a second bordered control there reads as chrome. */
.aoi-dem-fit{ font:inherit; font-size:var(--rpt-s); font-weight:600; color:var(--acc);
  background:none; border:0; padding:0; cursor:pointer; }
.aoi-dem-fit:hover{ text-decoration:underline; }
.aoi-dem-fit:focus-visible{ outline:none; box-shadow:var(--focus-ring); border-radius:3px; }
/* Standing ring labels. The rings themselves are interactive:false (see the JS)
   so they cannot carry tooltips — these say the distance instead. */
.aoi-dem-ringlbl{ font-family:var(--font-num); font-size:var(--fs-2xs);
  font-weight:600; color:var(--t2); text-align:center; white-space:nowrap;
  text-shadow:0 0 3px var(--bg1), 0 0 3px var(--bg1); pointer-events:none; }
.aoi-dem-ringlbl.edge{ font-weight:500; opacity:.75; }
.aoi-dem-tip{ font-size:var(--rpt-s); }
/* Legend and mix read at the ROSTER's body size (--rpt-b), not the small-label
   size. They sit at the bottom of a tall column, opposite a table set one step
   larger, and at --rpt-s the column looked like it was trailing off rather than
   ending — two panels of the same report should be read at the same distance. */
.aoi-dem-maplegend{ display:flex; gap:var(--space-lg); flex-wrap:wrap;
  font-size:var(--rpt-b); color:var(--t2); margin-top:var(--space-md); }
.aoi-dem-maplegend span{ display:inline-flex; align-items:center; gap:5px; }
.aoi-dem-maplegend i{ width:10px; height:10px; border-radius:50%; flex:none; }
/* 줄마다 지도의 그 마커를 축소한 것 (demand-view.js markerStyle 의 네 가지):
   채움 = 서 있는 것, 옅은 채움 + 실선 = 계획, 빈 링 = 큐 (IA 는 굵게, 심사 중은
   가늘고 옅게). 점선은 없다 — 공용 지도에서 점선은 폐지다. */
.aoi-dem-maplegend i.op{ background:color-mix(in srgb, var(--dem-op) 50%, transparent);
  box-shadow:inset 0 0 0 1px var(--dem-op); }
.aoi-dem-maplegend i.plan{ background:color-mix(in srgb, var(--dem-planned) 20%, transparent);
  box-shadow:inset 0 0 0 1.5px var(--dem-planned); }
.aoi-dem-maplegend i.qia{ box-shadow:inset 0 0 0 1.9px var(--dem-op); }
.aoi-dem-maplegend i.qst{ box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--dem-op) 60%, transparent); }
/* 데이터센터 — 채움 = 지금 먹는 부하, 빈 링 = 예상(shared/dc-layers.js 와 같은 축).
   --dem-dc 도 --dem-op 처럼 JS 가 심는다(DC_COLOR). 켜진 층의 줄만 보인다. */
.aoi-dem-maplegend i.dc{ background:color-mix(in srgb, var(--dem-dc) 45%, transparent);
  box-shadow:inset 0 0 0 1px var(--dem-dc); }
.aoi-dem-maplegend i.dcahead{ box-shadow:inset 0 0 0 1.5px var(--dem-dc); }
.aoi-dem-maplegend span[hidden]{ display:none; }

/* ── AI 데이터센터 레이어 패널 · 레일 ────────────────────────────
   패널의 생김새·hover·접힘은 공용(components/layer-control.css)이고 여기는 자리만
   정한다 — analysis-map.css 의 .map-rail 과 같은 역할인데, 이 지도는 래퍼가 없어
   레일이 Leaflet 컨테이너 안에 산다. z-index 는 Leaflet 컨트롤(1000) 위: 아니면
   패널이 타일과 마커 밑으로 들어간다. 높이 100% 는 곧 지도 안쪽 높이라 긴 목록도
   지도를 넘지 않는다. */
.aoi-dem-rail{ position:absolute; top:8px; left:8px; bottom:8px; z-index:1100;
  pointer-events:none; }
.aoi-dem-rail > .lc{ position:absolute; top:0; left:0; pointer-events:auto; max-height:100%; }
/* square, because the acreage is drawn as its tract rectangles. The two colours
   are TRACT_STYLE's (static/js/assessment/_shared.js) — the app's one tract
   look, shared with Set Area / Overview / Routes. Literals, not tokens: the
   style itself is a literal there, and a swatch that drifts from the shape it
   labels is worse than a hardcoded pair that cannot. */
.aoi-dem-maplegend i.acre{ border-radius:1px;
  background:#f2c94c; opacity:.75; box-shadow:inset 0 0 0 1.2px #c9971c; }
.aoi-dem-maplegend-note{ opacity:.75; }

/* technology mix — the SHAPE of the fleet in view. Combined cycle is baseload
   burn; a neighbourhood of peakers burns in bursts and buys very differently,
   and which one you are looking at flips as you pan. Sits under the map, with
   the legend, because it describes the same thing the map is showing — beside
   the roster it read as a second, contradictory total. */
.aoi-dem-mix{ list-style:none; margin:0; padding:0; display:flex;
  flex-direction:column; flex:none; }
.aoi-dem-mix li{ display:grid; grid-template-columns:1fr auto auto;
  gap:var(--space-md); align-items:baseline; font-size:var(--rpt-b);
  padding:var(--space-sm) var(--space-xs); }
.aoi-dem-mix li+li{ border-top:1px solid var(--bdr); }
.aoi-dem-mix-t{ color:var(--t1); }
.aoi-dem-mix-n{ font-family:var(--font-num); color:var(--t2); }
.aoi-dem-mix-v{ font-family:var(--font-num); color:var(--t1); font-weight:600;
  min-width:5.5em; text-align:right; }

/* ── roster ───────────────────────────────────────────────────────
   Long (300 plants are loaded, however many are in view), so it scrolls inside
   its own box and the page itself never does. */
.aoi-dem-tablewrap{ flex:1; min-height:0; overflow:auto; }
.aoi-dem-empty{ color:var(--t2); padding:var(--space-2xl) 0; text-align:center; }
.aoi-dem-table{ width:100%; border-collapse:collapse; font-size:var(--rpt-b); }
.aoi-dem-table th{ position:sticky; top:0; z-index:1; background:var(--bg1);
  font-size:var(--rpt-s); font-weight:600; color:var(--t2); text-align:left;
  padding:0 var(--space-lg) var(--space-sm) 0; white-space:nowrap;
  box-shadow:inset 0 -1px 0 var(--bdr); }
.aoi-dem-table th.num, .aoi-dem-table td.num{ text-align:right; }
.aoi-dem-table td{ padding:var(--space-sm) var(--space-lg) var(--space-sm) 0;
  border-bottom:1px solid var(--bdr); color:var(--t1); vertical-align:baseline; }
.aoi-dem-table th:last-child, .aoi-dem-table td:last-child{ padding-right:0; }
.aoi-dem-table td.num{ font-family:var(--font-num); font-variant-numeric:tabular-nums; }
.aoi-dem-nm{ font-weight:600; }
.aoi-dem-sub{ display:block; font-size:var(--rpt-s); color:var(--t2); }
.aoi-dem-c-tech, .aoi-dem-c-ba{ color:var(--t2); white-space:nowrap; }
/* generator count — a modifier on the technology, not a column of its own */
.aoi-dem-u{ font-family:var(--font-num); color:color-mix(in srgb, var(--t2) 75%, transparent);
  margin-left:var(--space-xs); }

/* ── planned rows RECEDE ──────────────────────────────────────────
   They used to be the loudest thing in the table: teal name, teal badge. The
   tint was only meant to say "different category from operating", but weight
   and hue both read as EMPHASIS, so the rows we are least sure about — iron
   that does not exist yet and may never be built — pulled the eye first.
   Existing burn is the fact; planned burn is the footnote. So the row goes
   quiet and keeps only enough of the accent (a hairline on the badge) to tie it
   to the teal marker the same plant draws on the map.
   큐 행은 한 단계 더 물러난다: 배지의 헤어라인까지 회색이다 — 지도의 큐 링에 색이
   있는 것은 그것이 가스라는 뜻이지 강조가 아니고, 표에서는 그 뜻을 태그가 맡는다. */
.aoi-dem-tag{ font-family:var(--font-badge); font-size:var(--fs-3xs); font-weight:600;
  text-transform:uppercase; letter-spacing:.05em; color:var(--t2);
  padding:0 4px; border-radius:2px;
  box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--dem-planned) 42%, transparent);
  margin-left:var(--space-sm); vertical-align:1px; }
.aoi-dem-tag-q{ box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--t2) 45%, transparent); }
.aoi-dem-r-plan .aoi-dem-nm, .aoi-dem-r-queue .aoi-dem-nm{ font-weight:500; color:var(--t2); }
.aoi-dem-r-plan td, .aoi-dem-r-queue td{ color:var(--t2); }

.aoi-dem-ph{ display:flex; align-items:center; justify-content:center;
  border-radius:var(--radius);
  background:color-mix(in srgb, var(--t2) 10%, transparent);
  font-size:var(--rpt-b); color:var(--t2); padding:var(--space-2xl); min-height:180px; }

/* ── mobile: one column, map above the roster ─────────────────────*/
@media (max-width:900px){
  /* THE RINGS STAY A ROW. Stacking them was the obvious phone move and it was
     wrong twice over: three full-width cards pushed the map a screen and a half
     down, and — worse — it broke what the strip is FOR. The three cards are one
     widening answer read left to right (25 → 50 → 75), and a vertical stack of
     three big numbers reads as three unrelated facts.

     What gives way instead is the detail. On a phone the strip answers "how much
     is out there, and how far do I have to go for it" — the operating/planned
     breakdown and the burn ceiling are a desktop-width question, and they are
     both still one tab away in the roster. So: keep the distance label and the
     capacity, drop the two sub-lines, and the row fits at 360px. */
  .aoi-dem-rings{ grid-template-columns:repeat(3, minmax(0,1fr)); gap:var(--space-sm); }
  .aoi-dem-ring{ padding:var(--space-sm) var(--space-md); gap:1px; }
  .aoi-dem-ring-s, .aoi-dem-ring-p, .aoi-dem-ring-q{ display:none; }
  /* Both stay on ONE line each — a wrapped "WITHIN 25 / MI" or a unit that drops
     under its number would cost more height than the sub-lines just saved. */
  .aoi-dem-ring-h{ white-space:nowrap; letter-spacing:.02em; }
  .aoi-dem-ring-v{ flex-wrap:nowrap; white-space:nowrap;
    font-size:clamp(15px, 4.4vw, 22px); }
  .aoi-dem-ring-u{ font-size:var(--fs-3xs); }
  .aoi-dem-grid{ grid-template-columns:1fr; flex:none; }
  .aoi-dem-tablewrap{ overflow:visible; }
  .aoi-dem-table .aoi-dem-c-ba{ display:none; }
  .aoi-dem-table th:last-child{ display:none; }
}
