/* team-tree-admin-v1: every control is written as "html body …" so a host page's own button / input rules (the back office
   styles every <button> as a pill) cannot restyle it; text on the ink colour uses --tt-on-ink. */
/* team-tree-v1 (owner 2026-11-17, prototype accepted): the reusable team tree (team-tree.js). Colours come from the
   host page through --tt-* (each falls back to the page's own variable), so the same file serves the partner centre
   and, later, the back office. Sheet edge / scrim use the --glass-* variables only. */
.tt{--tt-panel:var(--panel,#fff);--tt-ink:var(--text,#111);--tt-muted:var(--muted,#8a8a90);--tt-line:var(--line,#e3e3e6);--tt-soft:var(--soft,#f4f4f6);--tt-lime:var(--lime,#b8ff3d);--tt-amber:var(--partner-amber,#b7791f);--tt-on-ink:var(--tt-panel);--tt-indent:12px;--tt-gap:14px;display:grid;gap:16px;min-width:0}
.tt .tt-sum{margin:0;color:var(--tt-muted);font-size:13px;line-height:1.5}
.tt .tt-levels{display:flex;gap:8px;overflow-x:auto;padding-bottom:2px;scrollbar-width:thin;overscroll-behavior-x:contain}
html body .tt .tt-level{flex:1 0 148px;display:grid;gap:6px;justify-content:stretch;justify-items:start;height:auto;min-height:0;padding:14px 16px;border:1px solid var(--tt-line);border-radius:20px;background:var(--tt-panel);color:var(--tt-ink);font:inherit;text-align:left;cursor:pointer;min-width:0}
html body .tt .tt-level span{font-size:12px;color:var(--tt-muted)}
html body .tt .tt-level b{font-size:24px;line-height:1.1;font-weight:600;font-variant-numeric:tabular-nums}
html body .tt .tt-level b small{font-size:12px;font-weight:500;color:var(--tt-muted);margin-left:4px}
html body .tt .tt-level em{font-style:normal;font-size:12px;color:var(--tt-muted);overflow-wrap:anywhere}
html body .tt .tt-level[aria-pressed=true]{background:var(--tt-ink);border-color:var(--tt-ink);color:var(--tt-on-ink)}
html body .tt .tt-level[aria-pressed=true] span,html body .tt .tt-level[aria-pressed=true] em,html body .tt .tt-level[aria-pressed=true] b small{color:color-mix(in srgb,var(--tt-on-ink) 70%,var(--tt-ink))}
.tt .tt-bar{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
html body .tt .tt-search{flex:1 1 220px;min-width:0;height:40px;padding:0 16px;border:1px solid var(--tt-line);border-radius:999px;background:var(--tt-soft);color:var(--tt-ink);font:inherit;font-size:16px}
html body .tt .tt-pill{height:40px;min-height:40px;padding:0 16px;border:1px solid var(--tt-line);border-radius:999px;background:var(--tt-panel);color:var(--tt-ink);font:inherit;font-size:13px;font-weight:600;cursor:pointer;max-width:100%;white-space:normal;text-align:left}
html body .tt .tt-pill[aria-pressed=true]{background:var(--tt-ink);border-color:var(--tt-ink);color:var(--tt-on-ink)}
.tt .tt-body{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(0,1fr);gap:20px;align-items:start}
.tt.tt-narrow .tt-body{grid-template-columns:minmax(0,1fr)}
.tt.tt-plain .tt-body{grid-template-columns:minmax(0,1fr)}/* team-tree-admin-v1: no detail panel (the host opens people itself) */
.tt .tt-left{min-width:0}
.tt .tt-tree,.tt .tt-tree ul{list-style:none;margin:0;padding:0}
.tt .tt-tree ul{margin-left:var(--tt-gap);padding-left:var(--tt-indent);border-left:1px solid var(--tt-line)}
.tt .tt-tree ul.tt-flat{margin-left:0;padding-left:0;border-left:0}/* very deep layers: no further indent or line — the level chip on each row says the level */
.tt .tt-tree li{position:relative;padding-top:8px}
.tt .tt-tree>li:first-child{padding-top:0}
.tt .tt-tree ul>li::before{content:"";position:absolute;left:calc(-1 * var(--tt-indent));top:34px;width:var(--tt-indent);border-top:1px solid var(--tt-line)}
.tt .tt-tree ul.tt-flat>li::before{display:none}
.tt .tt-kids{display:grid;grid-template-rows:1fr;transition:grid-template-rows .22s ease,opacity .22s ease}
.tt .tt-kids>ul{overflow:hidden;min-height:0}
.tt .tt-kids[data-open=false]{grid-template-rows:0fr;opacity:0}
.tt .tt-node{display:grid;grid-template-columns:36px minmax(0,1fr) auto auto;gap:12px;align-items:center;min-height:52px;padding:8px 10px 8px 8px;border:1px solid var(--tt-line);border-radius:18px;background:var(--tt-panel)}
.tt .tt-node.is-me{background:var(--tt-soft);border-color:transparent}
.tt .tt-node.is-on{border-color:var(--tt-ink);box-shadow:0 0 0 1px var(--tt-ink)}
.tt .tt-node.is-dim{opacity:.45}
.tt .tt-node.is-hit{background:color-mix(in srgb,var(--tt-lime) 22%,var(--tt-panel))}
.tt-av{width:36px;height:36px;border-radius:50%;display:grid;place-items:center;flex:none;overflow:hidden;background:var(--tt-ink);color:var(--tt-on-ink);font-weight:600;font-size:14px}
.tt-av img{width:100%;height:100%;object-fit:cover;display:block}
.tt-av.tt-av-soft{background:var(--tt-soft);color:var(--tt-ink);border:1px solid var(--tt-line)}
.tt-av.tt-av-big{width:48px;height:48px;font-size:18px}
html body .tt .tt-who{min-width:0;min-height:0;height:auto;display:grid;gap:2px;justify-content:stretch;justify-items:start;text-align:left;background:none;border:0;border-radius:0;box-shadow:none;padding:0;color:var(--tt-ink);font:inherit;cursor:pointer}
html body .tt .tt-who b{font-size:14px;font-weight:600;overflow-wrap:anywhere;display:flex;gap:6px;align-items:center;flex-wrap:wrap}
html body .tt .tt-who small{font-size:12px;color:var(--tt-muted);overflow-wrap:anywhere}
.tt .tt-chip{display:inline-flex;align-items:center;height:20px;padding:0 8px;border-radius:999px;font-size:11px;font-weight:600;background:var(--tt-soft);color:var(--tt-muted);white-space:nowrap}
.tt .tt-chip.is-agent{background:var(--tt-ink);color:var(--tt-on-ink)}
.tt .tt-chip.is-wait{background:color-mix(in srgb,var(--tt-amber) 18%,var(--tt-panel));color:var(--tt-amber)}
.tt .tt-nums{display:flex;gap:16px;font-size:12px;color:var(--tt-muted);white-space:nowrap}
.tt .tt-nums b{display:block;font-size:14px;font-weight:600;color:var(--tt-ink);font-variant-numeric:tabular-nums}
html body .tt .tt-more{min-width:64px;height:32px;min-height:32px;padding:0 12px;border:1px solid var(--tt-line);border-radius:999px;background:var(--tt-soft);color:var(--tt-ink);font:inherit;font-size:12px;font-weight:600;cursor:pointer;white-space:nowrap;font-variant-numeric:tabular-nums}
html body .tt .tt-more[aria-expanded=true]{background:var(--tt-ink);border-color:var(--tt-ink);color:var(--tt-on-ink)}
.tt .tt-none{margin:8px 0 0;padding:20px;border-radius:18px;background:var(--tt-soft);color:var(--tt-muted);text-align:center;font-size:13px}
.tt.tt-narrow{--tt-indent:8px;--tt-gap:6px}
.tt.tt-narrow .tt-node{grid-template-columns:36px minmax(0,1fr) auto;row-gap:6px}
.tt.tt-narrow .tt-nums{grid-column:2 / -1;grid-row:2;gap:14px;flex-wrap:wrap;white-space:normal}
.tt.tt-narrow .tt-nums b{display:inline;margin-right:3px}
/* detail: beside the tree, or (narrow) a bottom sheet hung off <body> — so every rule below is written without .tt in front */
.tt-detail{--tt-panel:var(--panel,#fff);--tt-on-ink:var(--tt-panel);--tt-ink:var(--text,#111);--tt-muted:var(--muted,#8a8a90);--tt-line:var(--line,#e3e3e6);--tt-soft:var(--soft,#f4f4f6);position:sticky;top:16px;border:1px solid var(--tt-line);border-radius:24px;padding:20px;display:grid;gap:16px;min-width:0;color:var(--tt-ink)}
.tt-detail .tt-path{display:flex;gap:6px;flex-wrap:wrap;align-items:center;font-size:12px;color:var(--tt-muted)}
html body .tt-detail .tt-path button{background:none;border:0;padding:0;min-height:0;color:var(--tt-muted);font:inherit;cursor:pointer;text-decoration:underline;text-underline-offset:3px}
.tt-detail .tt-path span[aria-current]{color:var(--tt-ink);font-weight:600}
.tt-detail .tt-dhead{display:grid;grid-template-columns:48px minmax(0,1fr);gap:12px;align-items:center}
.tt-detail .tt-dhead h3{margin:0;font-size:18px;line-height:1.3;font-weight:600;overflow-wrap:anywhere}
.tt-detail .tt-dhead p{margin:2px 0 0;font-size:12px;color:var(--tt-muted);overflow-wrap:anywhere}
.tt-detail .tt-four{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.tt-detail .tt-four div{padding:12px 14px;border-radius:16px;background:var(--tt-soft);min-width:0}
.tt-detail .tt-four span{display:block;font-size:12px;color:var(--tt-muted)}
.tt-detail .tt-four b{font-size:20px;line-height:1.3;font-weight:600;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
.tt-detail .tt-kv{display:grid;grid-template-columns:auto minmax(0,1fr);gap:6px 16px;margin:0;font-size:13px}
.tt-detail .tt-kv dt{color:var(--tt-muted)}.tt-detail .tt-kv dd{margin:0;text-align:right;overflow-wrap:anywhere}
.tt-detail .tt-sub h4{margin:0 0 8px;font-size:13px;font-weight:600}
.tt-detail .tt-sub ul{list-style:none;margin:0;padding:0;display:grid;gap:6px}
html body .tt-detail .tt-sub li button{width:100%;display:flex;justify-content:space-between;gap:12px;min-height:40px;padding:10px 12px;border:1px solid var(--tt-line);border-radius:14px;background:var(--tt-panel);color:var(--tt-ink);font:inherit;font-size:13px;text-align:left;cursor:pointer}
.tt-detail .tt-sub li b{font-weight:600;overflow-wrap:anywhere;min-width:0}
.tt-detail .tt-sub li span{color:var(--tt-muted);white-space:nowrap}
.tt-detail .tt-hint{margin:8px 0 0;font-size:12px;color:var(--tt-muted)}
.tt-detail .tt-acts{display:flex;gap:8px;flex-wrap:wrap}
html body .tt-detail .tt-btn{height:40px;min-height:40px;padding:0 18px;border-radius:999px;border:1px solid var(--tt-line);background:var(--tt-panel);color:var(--tt-ink);font:inherit;font-size:14px;font-weight:600;cursor:pointer}
html body .tt-detail .tt-btn.is-dark{background:var(--tt-ink);border-color:var(--tt-ink);color:var(--tt-on-ink)}
html body .tt-detail .tt-close{display:none}
.tt-detail.tt-sheet{position:fixed;left:0;right:0;bottom:0;top:auto;z-index:121;max-height:86vh;max-height:86dvh;overflow:auto;border:0;border-top:1px solid var(--glass-edge,var(--tt-line));border-radius:24px 24px 0 0;background-color:var(--canvas,#fff);background-image:linear-gradient(var(--tt-panel),var(--tt-panel));padding:20px 16px calc(20px + env(safe-area-inset-bottom,0px));transform:translateY(105%);transition:transform .24s ease;visibility:hidden}
.tt-detail.tt-sheet.is-open{transform:none;visibility:visible}
html body .tt-detail.tt-sheet .tt-close{display:inline-flex;align-items:center;justify-self:end;height:36px;min-height:36px;padding:0 14px;border:1px solid var(--tt-line);border-radius:999px;background:var(--tt-soft);color:var(--tt-ink);font:inherit;font-size:13px;font-weight:600;cursor:pointer}
.tt-scrim{position:fixed;inset:0;z-index:120;background:var(--glass-scrim,rgba(17,17,19,.38))}
.tt-scrim[hidden]{display:none}
.tt :focus-visible,.tt-detail :focus-visible{outline:2px solid var(--tt-ink);outline-offset:2px}
@media (prefers-reduced-motion:reduce){.tt .tt-kids,.tt-detail.tt-sheet{transition:none}}
