/* ═══ Assessment — tree ═══════════════════════════════════════════
   project register + folder tree (the Pipeline-Studio shell).

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

/* ═══════════════════════════════════════════════════════════════════
   AOI redesign — Pipeline-Studio shell
   · Left  = project register + folder tree (ported from the Dashboard AOI
             navigator: search + Basin/State/Recent group-by + collapsible
             folders). Class names mirror .dap-* / .asmt-* but are
             assessment-local (home.css is not loaded on this page).
   · Body  = report section edit-bar styled like the Studio .etb toolbar.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Left tree: search + group-by toggle ──────────────────────────── */
.aoi-tree-tools {
  flex-shrink:    0;
  display:        flex;
  flex-direction: column;
  gap:            7px;
  padding:        var(--space-md) var(--space-lg) var(--space-md);
  border-bottom:  1px solid var(--bdr);
}
.aoi-tree-search { position: relative; display: flex; align-items: center; }
.aoi-tree-search-ic {
  position:       absolute;
  left:           8px;
  display:        inline-flex;
  color:          var(--t2);
  pointer-events: none;
}
.aoi-tree-search-in {
  width:         100%;
  box-sizing:    border-box;
  padding:       var(--space-sm) 26px;
  font-family:   inherit;
  font-size:     var(--fs-micro);
  color:         var(--t0);
  background:    var(--bg2);
  border:        1px solid var(--bdr);
  border-radius: var(--radius);
  outline:       none;
  transition:    border-color .12s;
}
.aoi-tree-search-in::placeholder { color: var(--t2); }
.aoi-tree-search-in:focus { border-color: var(--acc); }
.aoi-tree-search-in::-webkit-search-cancel-button { -webkit-appearance: none; }
.aoi-tree-search-clear {
  position:        absolute;
  right:           4px;
  display:         flex;
  align-items:     center;
  justify-content: center;
  width:           20px;
  height:          20px;
  padding:         0;
  color:           var(--t2);
  background:      none;
  border:          none;
  border-radius:   var(--radius);
  cursor:          pointer;
}
.aoi-tree-search-clear:hover { color: var(--t0); background: var(--bg3); }

.aoi-tree-modes { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.aoi-tree-modes button {
  flex:          1 1 0;
  min-width:     46px;
  padding:       var(--space-xs) 0;
  font-family:   inherit;
  font-size:     var(--fs-micro);
  font-weight:   500;
  color:         var(--t1);
  background:    var(--bg2);
  border:        1px solid var(--bdr);
  border-radius: var(--radius);
  cursor:        pointer;
  transition:    color .12s, background .12s, border-color .12s;
}
.aoi-tree-modes button:hover { color: var(--t0); border-color: var(--bdr2); }
.aoi-tree-modes button.on {
  color:        var(--acc);
  background:    color-mix(in srgb, var(--acc) 14%, transparent);
  border-color: var(--acc);
}

/* ── Tree list (reuses .aoi-list flex container above) ─────────────── */
.aoi-list.aoi-tree-flat { gap: var(--space-sm); }

/* Folder header (region / date group) */
.aoi-folder {
  display:     flex;
  align-items: center;
  gap:         var(--space-2xs);
  margin-top:  var(--space-xs);
}
.aoi-folder:first-child { margin-top: 0; }
.aoi-folder-tog {
  flex:          1;
  min-width:     0;
  display:       flex;
  align-items:   center;
  gap:           var(--space-sm);
  padding:       var(--space-xs);
  font-family:   inherit;
  color:         var(--t0);
  background:    none;
  border:        none;
  border-radius: var(--radius);
  cursor:        pointer;
  text-align:    left;
}
.aoi-folder-tog:hover { background: var(--bg2); }
.aoi-folder-chev {
  display:     inline-flex;
  flex-shrink: 0;
  color:       var(--t2);
  transition:  transform .16s ease;
}
.aoi-folder.col .aoi-folder-chev { transform: rotate(-90deg); }
.aoi-folder-ic   { display: inline-flex; flex-shrink: 0; color: var(--acc); }
.aoi-folder-name {
  flex:          1;
  min-width:     0;
  font-size:     var(--fs-caption);
  font-weight:   600;
  color:         var(--t0);
  white-space:   nowrap;
  overflow:      hidden;
  text-overflow: ellipsis;
}
.aoi-folder-n {
  flex-shrink: 0;
  font-family: var(--font-sans);
  font-size:   var(--fs-xs);
  color:       var(--t2);
}
.aoi-folder-body {
  display:        flex;
  flex-direction: column;
  gap:            3px;
  padding:        var(--space-2xs) 0 var(--space-xs) var(--space-md);
  margin-left:    9px;
  border-left:    1px solid var(--bdr);
}

/* Project card (tree node) */
.aoi-node {
  position:       relative;
  display:        flex;
  flex-direction: column;
  gap:            var(--space-2xs);
  text-align:     left;
  cursor:         pointer;
  background:     var(--bg2);
  border:         1px solid var(--bdr);
  border-radius:  var(--radius);
  padding:        7px 26px 7px 9px;
  font-family:    inherit;
  transition:     border-color .12s, background .12s, box-shadow .12s;
}
.aoi-node:hover { border-color: var(--bdr2); background: var(--bg3); }
.aoi-node.sel {
  border-color: var(--acc);
  box-shadow:   inset 0 0 0 1px var(--acc);
}
.aoi-node-name {
  min-width:     0;
  font-size:     var(--fs-micro);
  font-weight:   600;
  line-height:   1.3;
  color:         var(--t0);
  white-space:   nowrap;
  overflow:      hidden;
  text-overflow: ellipsis;
}
.aoi-node-sub {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  gap:             var(--space-sm);
  font-size:       var(--fs-xs);
  color:           var(--t2);
  font-family:     var(--font-sans);
}
.aoi-node-sub-l {
  min-width:     0;
  white-space:   nowrap;
  overflow:      hidden;
  text-overflow: ellipsis;
}
.aoi-node-date { flex-shrink: 0; }
.aoi-node-del {
  position:        absolute;
  top:             5px;
  right:           5px;
  display:         flex;
  align-items:     center;
  justify-content: center;
  width:           18px;
  height:          18px;
  padding:         0;
  color:           var(--t2);
  background:      none;
  border:          none;
  border-radius:   var(--radius);
  cursor:          pointer;
  opacity:         0;
  transition:      opacity .12s, color .12s, background .12s;
}
.aoi-node:hover .aoi-node-del { opacity: 1; }
.aoi-node-del:hover { color: var(--err); background: var(--bg1); }

/* Archived-view node — not clickable to open (row is archived); a Restore
   pill sits inline at the right. */
.aoi-node-arch {
  flex-direction: row;
  align-items:    center;
  gap:            var(--space-sm);
  padding:        7px 9px;
  cursor:         default;
}
.aoi-node-arch:hover { background: var(--bg2); border-color: var(--bdr); }
.aoi-node-arch-txt {
  display:        flex;
  flex-direction: column;
  gap:            var(--space-2xs);
  min-width:      0;
  flex:           1;
}
.aoi-node-arch-actions { flex-shrink: 0; display: flex; align-items: center; gap: var(--space-2xs); }
.aoi-node-restore {
  flex-shrink:   0;
  display:       inline-flex;
  align-items:   center;
  gap:           4px;
  padding:       3px 8px;
  font-family:   var(--font-sans);
  font-size:     var(--fs-micro);
  font-weight:   500;
  color:         var(--acc);
  background:    color-mix(in srgb, var(--acc) 12%, transparent);
  border:        1px solid color-mix(in srgb, var(--acc) 34%, transparent);
  border-radius: var(--radius);
  cursor:        pointer;
  transition:    background .12s, border-color .12s;
}
.aoi-node-restore:hover {
  background:    color-mix(in srgb, var(--acc) 22%, transparent);
  border-color:  var(--acc);
}
.aoi-node-purge {
  flex-shrink:     0;
  display:         inline-flex;
  align-items:     center;
  justify-content: center;
  width:           24px;
  height:          24px;
  padding:         0;
  color:           var(--t2);
  background:      none;
  border:          1px solid var(--bdr);
  border-radius:   var(--radius);
  cursor:          pointer;
  transition:      color .12s, background .12s, border-color .12s;
}
.aoi-node-purge:hover {
  color:        var(--err);
  background:   color-mix(in srgb, var(--err) 12%, transparent);
  border-color: color-mix(in srgb, var(--err) 40%, transparent);
}

.aoi-hl {
  background:    color-mix(in srgb, var(--acc) 30%, transparent);
  color:         var(--t0);
  border-radius: 2px;
}

/* ── Report section edit-bar (Studio .etb style) ──────────────────── */
.aoi-secbar {
  display:       flex;
  align-items:   center;
  gap:           var(--space-xs);
  padding:       0 var(--space-xl);
  height:        44px;
  background:    var(--bg1);
  border-bottom: 1px solid var(--bdr);
  flex-shrink:   0;
  overflow-x:    auto;
}
.aoi-secbar::-webkit-scrollbar { height: 0; }
.aoi-sec-sep {
  width:       1px;
  height:      20px;
  background:  var(--bdr);
  flex-shrink: 0;
  margin:      0 var(--space-xs);
}
.aoi-sec-btn {
  display:       inline-flex;
  align-items:   center;
  gap:           7px;
  padding:       var(--space-sm) var(--space-xl);
  border:        none;
  border-radius: var(--radius);
  background:    transparent;
  color:         var(--t1);
  font-family:   var(--font-sans);
  font-size:     var(--fs-caption);
  font-weight:   600;
  line-height:   1;
  white-space:   nowrap;
  cursor:        pointer;
  flex-shrink:   0;
  transition:    background .12s, color .12s;
}
.aoi-sec-btn svg { width: 15px; height: 15px; opacity: .7; transition: opacity .12s; }
.aoi-sec-btn:hover { background: var(--bg2); color: var(--t0); }
.aoi-sec-btn:hover svg { opacity: 1; }
.aoi-sec-active,
.aoi-sec-active:hover {
  background: color-mix(in srgb, var(--acc) 14%, transparent);
  color:      var(--acc);
}
.aoi-sec-active svg { opacity: 1; }

/* ── Section placeholder (Price History / Winter Stress stubs) ────── */
.aoi-stub {
  display:         flex;
  flex-direction:  column;
  align-items:     center;
  justify-content: center;
  gap:             var(--space-xl);
  min-height:      340px;
  padding:         40px 24px;
  text-align:      center;
}
.aoi-stub-ic {
  display:         inline-flex;
  align-items:     center;
  justify-content: center;
  width:           52px;
  height:          52px;
  border-radius:   var(--radius);
  color:           var(--acc);
  background:      color-mix(in srgb, var(--acc) 12%, transparent);
}
.aoi-stub-title { font-size: var(--fs-md); font-weight: 700; color: var(--t0); }
.aoi-stub-sub {
  max-width:   440px;
  font-size:   var(--fs-body);
  line-height: 1.6;
  color:       var(--t2);
}
.aoi-stub-tag {
  font-family:    var(--font-badge);
  font-size:      var(--fs-xs);
  letter-spacing: .08em;
  text-transform: uppercase;
  color:          var(--acc);
  background:      color-mix(in srgb, var(--acc) 12%, transparent);
  border:         1px solid color-mix(in srgb, var(--acc) 30%, transparent);
  border-radius:  20px;
  padding:        var(--space-2xs) var(--space-xl);
}


/* ── Control-deck mode header (Studio .lp-mode-hdr) ────────────────── */
.aoi-lp-hdr {
  display:       flex;
  align-items:   center;
  gap:           9px;
  padding:       var(--space-md) var(--space-xl);
  background:    color-mix(in srgb, var(--acc) 9%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--acc) 22%, transparent);
  flex-shrink:   0;
}
.aoi-lp-badge {
  width:           20px;
  height:          20px;
  border-radius:   50%;
  background:      var(--acc);
  color:           var(--on-acc);
  display:         flex;
  align-items:     center;
  justify-content: center;
  flex-shrink:     0;
}
.aoi-lp-hbody { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.aoi-lp-name {
  font-size:      var(--fs-caption);
  font-weight:    700;
  color:          var(--acc);
  letter-spacing: .2px;
  font-family:    var(--font-sans);
}
.aoi-lp-sub {
  font-size:     var(--fs-xs);
  color:         var(--t2);
  white-space:   nowrap;
  overflow:      hidden;
  text-overflow: ellipsis;
}

/* ── "Add New Area" action card (Studio image-dropzone slot) ───────── */
.aoi-add-area {
  margin:        var(--space-lg) var(--space-lg) var(--space-md);
  display:       flex;
  align-items:   center;
  gap:           11px;
  padding:       var(--space-lg);
  border:        1.5px dashed var(--bdr2);
  border-radius: var(--radius);
  background:    var(--bg2);
  cursor:        pointer;
  text-align:    left;
  font-family:   inherit;
  transition:    border-color .15s, background .15s;
}
.aoi-add-area:hover {
  border-color: var(--acc);
  background:   color-mix(in srgb, var(--acc) 6%, transparent);
}
.aoi-add-ic {
  width:           44px;
  height:          44px;
  flex-shrink:     0;
  border-radius:   var(--radius);
  border:          1px dashed var(--bdr2);
  background:      var(--bg3);
  display:         flex;
  align-items:     center;
  justify-content: center;
  color:           var(--bdr2);
  transition:      color .15s, border-color .15s;
}
.aoi-add-area:hover .aoi-add-ic { color: var(--acc); border-color: var(--acc); }
.aoi-add-body {
  flex:           1;
  min-width:      0;
  display:        flex;
  flex-direction: column;
  gap:            var(--space-2xs);
}
.aoi-add-label { font-size: var(--fs-body); font-weight: 700; color: var(--t1); }
.aoi-add-area:hover .aoi-add-label { color: var(--t0); }
.aoi-add-sub { font-size: var(--fs-micro); color: var(--t2); line-height: 1.3; }


