/* Feature tree (package g). Every selector is scoped to .feature-tree so the bare button / h2 / ul rules
 * in studio.css and customer-glass.css cannot leak in. Glass matches .addon-tray (addon-tray.css:1) so the
 * two overlays read as one system: the tray on the right, the tree on the left. Only transform and opacity
 * animate; every control has hover, :focus-visible and :active states. */
.feature-tree {
  --ft-ink: #1d3c57; --ft-meta: #2f4f6b; --ft-line: #d5e4f0; --ft-rail: #345f92; --ft-ease: cubic-bezier(.2,.8,.2,1);
  position: absolute; z-index: 5; left: 16px; top: var(--inset-top, 150px);
  max-height: calc(100% - var(--inset-top, 150px) - var(--inset-bottom, 140px));
  width: min(260px, 36%); min-height: 44px; display: flex; flex-direction: column; color: var(--ft-ink);
  border: 1px solid #ffffffeb; border-radius: 24px; background: linear-gradient(145deg, #ffffffd9, #eaf2f8a8);
  box-shadow: 0 18px 45px #17364b29, 0 3px 8px #17364b0d, inset 0 1px 0 #fff;
  backdrop-filter: blur(22px) saturate(1.4); -webkit-backdrop-filter: blur(22px) saturate(1.4);
}
.feature-tree * { box-sizing: border-box; }

/* ---- header ------------------------------------------------------------------------------- */
.feature-tree .ft-head { display: flex; align-items: center; gap: 7px; padding: 10px 8px 6px 14px; flex: none; }
.feature-tree .ft-title { margin: 0; font: 700 11.5px Montserrat, Inter, sans-serif; letter-spacing: .06em; text-transform: uppercase; color: #21455f; }
.feature-tree .ft-total { min-width: 20px; padding: 2px 6px; border-radius: 999px; background: #dbe9f5; font-size: 9.5px; font-weight: 700; color: #3a6488; text-align: center; }
.feature-tree .ft-collapse { margin-left: auto; width: 30px; height: 30px; padding: 0; display: grid; place-items: center; flex: none; }
.feature-tree .ft-chev { width: 9px; height: 9px; border-right: 1.8px solid currentColor; border-bottom: 1.8px solid currentColor; transform: rotate(-135deg); transition: transform .16s var(--ft-ease); }

/* ---- collapsed chip ------------------------------------------------------------------------ */
.feature-tree .ft-chip { display: none; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 0 15px; border-radius: 22px; font: 650 12px Inter, Arial, sans-serif; color: var(--ft-ink); }
.feature-tree .ft-chip-mark { width: 12px; height: 10px; flex: none; border-top: 1.8px solid currentColor; border-bottom: 1.8px solid currentColor; position: relative; }
.feature-tree .ft-chip-mark::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1.8px solid currentColor; }
.feature-tree[data-collapsed="true"] { width: auto; min-width: 128px; max-height: none; border-radius: 22px; }
.feature-tree[data-collapsed="true"] .ft-head, .feature-tree[data-collapsed="true"] .ft-list { display: none; }
.feature-tree[data-collapsed="true"] .ft-chip { display: flex; }

/* ---- lists ------------------------------------------------------------------------------- */
.feature-tree .ft-list { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; margin: 0; padding: 0 9px 11px; list-style: none; }
.feature-tree .ft-children { margin: 0 0 0 11px; padding: 0 0 2px; list-style: none; border-left: 1px solid var(--ft-line); }
.feature-tree .ft-item { margin: 1px 0; list-style: none; }
.feature-tree .ft-item[data-role="building"] + .ft-item[data-role="building"] { margin-top: 7px; padding-top: 6px; border-top: 1px solid #ffffffb5; }
.feature-tree .ft-item[data-active] > .ft-line > .ft-row .ft-label { color: #17395a; }
.feature-tree .ft-item[data-active] > .ft-line::before { content: ""; width: 2px; align-self: stretch; margin-right: 3px; border-radius: 2px; background: var(--ft-rail); }
.feature-tree .ft-line { display: flex; align-items: stretch; gap: 1px; }

/* ---- rows -------------------------------------------------------------------------------- */
.feature-tree .ft-row {
  flex: 1 1 auto; min-width: 0; display: grid; grid-template-columns: 13px minmax(0, 1fr) auto; align-items: start;
  column-gap: 6px; min-height: 32px; padding: 6px 8px; border: 0; border-radius: 11px; background: transparent;
  box-shadow: none; text-align: left; font: 550 11.5px Inter, Arial, sans-serif; color: var(--ft-ink); cursor: pointer;
}
.feature-tree .ft-twist { grid-row: 1; align-self: center; width: 13px; height: 13px; position: relative; }
.feature-tree .ft-row[aria-expanded] .ft-twist::before {
  content: ""; position: absolute; left: 3px; top: 3px; width: 6px; height: 6px;
  border-right: 1.6px solid #6e8ca6; border-bottom: 1.6px solid #6e8ca6; transform: rotate(-45deg); transition: transform .16s var(--ft-ease);
}
.feature-tree .ft-row[aria-expanded="true"] .ft-twist::before { transform: rotate(45deg); }
.feature-tree .ft-text { grid-column: 2; min-width: 0; display: block; }
.feature-tree .ft-label { display: block; font-weight: 650; line-height: 1.35; overflow-wrap: break-word; }
.feature-tree .ft-parts { display: block; margin-top: 1px; font-size: 10px; line-height: 1.45; font-weight: 500; color: var(--ft-meta); overflow-wrap: break-word; }
.feature-tree .ft-parts:empty { display: none; }
/* A group's per-type counts are a summary: they read as clutter once its rows are on screen. */
.feature-tree .ft-row[aria-expanded="true"] .ft-parts { display: none; }
/* Building roots disclose through their own caret, so mirror the rule above off the row's open state:
 * the "40 x 60 x 12 ft" summary is the collapsed stand-in for the Dimensions child below it. */
.feature-tree .ft-item[data-role="building"][data-open="true"] > .ft-line > .ft-row .ft-parts { display: none; }
.feature-tree .ft-badge { grid-column: 3; align-self: center; max-width: 84px; padding: 2px 7px; border-radius: 999px; background: #e4eef7; font-size: 9.5px; font-weight: 700; line-height: 1.4; color: #3d6382; text-align: center; overflow-wrap: break-word; }
.feature-tree .ft-badge:empty { display: none; }
.feature-tree .ft-item[data-role="building"] > .ft-line > .ft-row { font-size: 12.5px; }
.feature-tree .ft-item[data-role="building"] > .ft-line > .ft-row .ft-twist { display: none; }
.feature-tree .ft-item[data-empty="true"] > .ft-line > .ft-row { opacity: .62; }

/* ---- disclosure button on the building roots ---------------------------------------------- */
.feature-tree .ft-caret { flex: none; width: 22px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 9px; background: transparent; box-shadow: none; color: #6e8ca6; }
.feature-tree .ft-caret .ft-chev { width: 7px; height: 7px; border-width: 1.6px; transform: rotate(-45deg); }
.feature-tree .ft-caret[aria-expanded="true"] .ft-chev { transform: rotate(45deg); }

/* ---- states ------------------------------------------------------------------------------- */
.feature-tree .ft-row:hover, .feature-tree .ft-caret:hover, .feature-tree .ft-collapse:hover, .feature-tree .ft-chip:hover { background: #ffffffb8; }
.feature-tree .ft-row:active, .feature-tree .ft-caret:active, .feature-tree .ft-collapse:active, .feature-tree .ft-chip:active { transform: scale(.985); }
.feature-tree .ft-row:focus-visible, .feature-tree .ft-caret:focus-visible, .feature-tree .ft-collapse:focus-visible, .feature-tree .ft-chip:focus-visible { outline: 3px solid #4d8ecc; outline-offset: 1px; }
.feature-tree .ft-row[aria-current="true"] { background: #dcebf7; box-shadow: inset 3px 0 0 var(--ft-rail); }
.feature-tree .ft-row[aria-current="true"] .ft-label { color: #143654; font-weight: 700; }
.feature-tree .ft-row[aria-current="true"] .ft-badge { background: #cbe0f2; }
.feature-tree .ft-collapse, .feature-tree .ft-caret, .feature-tree .ft-chip { border: 0; box-shadow: none; background: transparent; color: inherit; cursor: pointer; }

/* ---- phone: the Features tab inside the sheet ---------------------------------------------- */
.feature-tree[data-mode="tab"] {
  position: static; inset: auto; width: auto; min-height: 0; border: 0; border-radius: 0; background: none;
  box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none;
}
.feature-tree[data-mode="tab"] .ft-chip { display: none; }
.feature-tree[data-mode="tab"] .ft-head { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; padding: 0; }
.feature-tree[data-mode="tab"] .ft-list { overflow: visible; padding: 0 0 12px; }
.feature-tree[data-mode="tab"] .ft-row { border-radius: 13px; font-size: 13px; }
.feature-tree[data-mode="tab"] .ft-parts { font-size: 11px; }
.feature-tree[data-mode="tab"] .ft-badge { font-size: 10.5px; }

@media (pointer: coarse), (max-width: 650px) {
  .feature-tree .ft-row { min-height: 44px; padding: 9px 10px; }
  .feature-tree .ft-caret { width: 34px; }
  .feature-tree .ft-collapse { width: 38px; height: 38px; }
}
@media (max-width: 1050px) and (min-width: 651px) { .feature-tree { left: 12px; width: min(226px, 34%); } }
@media (prefers-reduced-motion: reduce) {
  .feature-tree .ft-chev, .feature-tree .ft-row[aria-expanded] .ft-twist::before { transition: none; }
  .feature-tree .ft-row:active, .feature-tree .ft-caret:active, .feature-tree .ft-collapse:active, .feature-tree .ft-chip:active { transform: none; }
}
/* Blueprint mode keeps the tree: F's z-index contract puts it at 5 over #blueprint (4) and package c
 * lays the sheet out around it ("an open legend reserves drawing width, even with a feature tree on
 * the left", blueprint.e2e). Hiding it here fails two of c's checks, so the residual question -- a
 * panned or zoomed drawing sliding under the tree's rect -- is c's / the owner's call, not a g rule. */
@media print { .feature-tree { display: none !important; } }
