/* Org chart, people directory and profiles. Tokens from app.css only. */

/* ---------- toolbar */
.oc-toolbar { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; margin-bottom: var(--s4); }
.oc-search { position: relative; display: flex; align-items: center; flex: 1 1 280px; max-width: 460px; }
.oc-search > .icon { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.oc-search .input { padding-left: 38px; padding-right: 84px; }
.oc-search-count { position: absolute; right: 12px; pointer-events: none; }
.oc-tools { display: flex; gap: var(--s1); margin-left: auto; }

/* ---------- the frame: the chart scrolls inside it, never the page */
.oc-frame { --line: var(--border-strong); --gap: 22px; --card-w: 224px;
  position: relative; overflow: auto; border: 1px solid var(--border); border-radius: var(--r-xl);
  background-color: var(--surface-2);
  background-image: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--faint) 30%, transparent) 1px, transparent 0);
  background-size: 22px 22px; max-height: 78vh; overscroll-behavior: contain; scrollbar-width: thin; }
.oc-canvas { display: inline-block; min-width: 100%; padding: var(--s8) var(--s6) var(--s10); }
.oc-tree, .oc-children { list-style: none; margin: 0; padding: 0; }
.oc-tree { display: flex; justify-content: center; gap: var(--s10); }

/* ---------- connectors (top-down tree) */
.oc-node { position: relative; display: flex; flex-direction: column; align-items: center; }
.oc-children { display: flex; justify-content: center; position: relative; padding-top: var(--gap); }
.oc-children > .oc-node { padding: var(--gap) 8px 0; }
.oc-children::before { content: ""; position: absolute; top: 0; left: 50%; height: var(--gap); border-left: 1.5px solid var(--line); }
.oc-children > .oc-node::before, .oc-children > .oc-node::after { content: ""; position: absolute; top: 0; right: 50%; width: 50%; height: var(--gap);
  border-top: 1.5px solid var(--line); }
.oc-children > .oc-node::after { right: auto; left: 50%; border-left: 1.5px solid var(--line); }
.oc-children > .oc-node:only-child::before { display: none; }
.oc-children > .oc-node:only-child::after { border-top: 0; }
.oc-children > .oc-node:first-child::before { border: 0; }
.oc-children > .oc-node:first-child::after { border-top-left-radius: 10px; }
.oc-children > .oc-node:last-child::after { border: 0; }
.oc-children > .oc-node:last-child::before { border-right: 1.5px solid var(--line); border-top-right-radius: 10px; }
.oc-children > .oc-node:only-child::after { border-radius: 0; }

/* leaves only: stack them under their manager to keep the chart compact */
.oc-children.stacked { flex-direction: column; align-items: center; gap: 10px; }
.oc-children.stacked::before { bottom: 36px; height: auto; }
.oc-children.stacked > .oc-node { padding: 0; }
.oc-children.stacked > .oc-node::before, .oc-children.stacked > .oc-node::after { display: none; }

/* ---------- branch toggle */
.oc-branch { display: block; text-align: center; }
.oc-branch > summary { list-style: none; position: relative; display: inline-flex; align-items: center; gap: 4px; margin-top: 12px; height: 24px;
  padding: 0 10px 0 6px; border-radius: 999px; font: 600 11.5px/1 var(--font); color: var(--text-2); background: var(--surface);
  border: 1px solid var(--border-strong); cursor: pointer; user-select: none; white-space: nowrap; z-index: 1; }
.oc-branch > summary::-webkit-details-marker { display: none; }
.oc-branch > summary::before { content: ""; position: absolute; left: 50%; top: -13px; height: 12px; border-left: 1.5px solid var(--line); }
.oc-branch > summary:hover { border-color: var(--violet); color: var(--accent-text); }
.oc-toggle-open { display: inline-flex; transition: transform .15s; transform: rotate(-90deg); color: var(--muted); }
.oc-branch[open] > summary .oc-toggle-open { transform: none; }
.oc-branch > .oc-children { text-align: left; }

/* ---------- person cards */
.oc-card { position: relative; width: var(--card-w, 224px); text-align: left; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: var(--s3) var(--s3) 10px; box-shadow: var(--shadow-1); transition: box-shadow .15s, border-color .15s, opacity .15s; }
.oc-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.oc-card.top { border-color: color-mix(in srgb, var(--violet) 45%, var(--border)); }
.oc-card.top::before { content: ""; position: absolute; left: 14px; right: 14px; top: -1px; height: 3px; border-radius: 0 0 3px 3px;
  background: linear-gradient(90deg, var(--violet), var(--lavender)); }
.oc-card-link { display: flex; align-items: center; gap: 10px; color: var(--text); min-width: 0; }
.oc-card-link:hover { text-decoration: none; }
.oc-card-link:hover .oc-name { color: var(--accent-text); }
.oc-card-text { display: flex; flex-direction: column; min-width: 0; }
.oc-name { font-weight: 600; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.oc-title { font-size: 12.5px; color: var(--muted); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.oc-meta { display: flex; align-items: center; gap: var(--s2); margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); min-height: 18px; }
.oc-dept { font-size: 11.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.oc-count { display: inline-flex; align-items: center; gap: 3px; margin-left: auto; flex: none; font: 600 11.5px/1 var(--font); color: var(--accent-text);
  background: var(--accent-soft); border-radius: 999px; padding: 3px 7px; }
.oc-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.oc-badge { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 6px; font: 600 11px/1 var(--font); white-space: nowrap;
  background: var(--neutral-soft); color: var(--neutral); }
.oc-badge.leave { background: var(--warn-soft); color: var(--warn); }
.oc-badge.cover { background: var(--accent-soft); color: var(--accent-text); }
.oc-badge.invited { background: var(--info-soft); color: var(--info); }
.oc-badge.suspended { background: var(--danger-soft); color: var(--danger); }
.oc-dotted { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; font-size: 11.5px; color: var(--muted); }
.oc-dotted > span { display: inline-flex; align-items: center; gap: 6px; }
.oc-dotted-line { display: inline-block; width: 16px; border-top: 1.5px dashed var(--accent); vertical-align: middle; margin-right: 6px; }
.oc-dotted .oc-dotted-line { margin-right: 0; }

/* open positions */
.oc-card.vacancy { background: transparent; border: 1.5px dashed var(--border-strong); box-shadow: none; }
.oc-card.vacancy .oc-name { color: var(--text-2); }
.oc-card.vacancy .oc-meta { border-top-style: dashed; }
.oc-vacant-avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center; border: 1.5px dashed var(--accent); color: var(--accent); }
.oc-vacant-avatar.small { width: 32px; height: 32px; }

/* search */
.oc-card.dim, .oc-dept-list li.dim { opacity: .35; }
.oc-card.match { border-color: var(--violet); box-shadow: var(--focus); opacity: 1; }

/* legend */
.oc-legend { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); margin-top: var(--s3); font-size: 12.5px; color: var(--muted); align-items: center; }
.oc-legend > span { display: inline-flex; align-items: center; gap: var(--s2); }
.oc-legend-line { display: inline-block; width: 22px; border-top: 1.5px solid var(--border-strong); }
.oc-legend-line.dotted { border-top: 1.5px dashed var(--accent); }
.oc-legend-card { display: inline-block; width: 22px; height: 14px; border-radius: 4px; border: 1.5px dashed var(--border-strong); }

/* ---------- department view */
.oc-depts { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--s4); align-items: start; }
.oc-depts > .card { margin-top: 0; }
.oc-dept-card .card-head .more { font-size: 12.5px; }
.oc-dept-list > li { min-height: 56px; }
.oc-dept-list .badges, .oc-dept-list .oc-badges { margin-top: 0; }
.oc-head-tag { color: var(--accent-text); font-weight: 600; }
.oc-dept-vacancy { background: repeating-linear-gradient(135deg, transparent 0 8px, var(--surface-2) 8px 9px); }
.oc-pos-form { display: inline-flex; gap: var(--s2); align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.oc-pos-form .input { height: 32px; width: auto; min-width: 0; font-size: 13px; }
.oc-pos-form select.input { background-position: calc(100% - 17px) 13px, calc(100% - 12px) 13px; }
.oc-pos-form input.input { width: 140px; }

/* ---------- people directory */
.pp-person { display: flex; align-items: center; gap: var(--s3); color: var(--text); min-width: 0; }
.pp-person:hover { text-decoration: none; }
.pp-person:hover .pp-name { color: var(--accent-text); }
.pp-person > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.pp-name { font-weight: 600; white-space: nowrap; }
.pp-title { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 34ch; }
.pp-roles { display: flex; flex-wrap: wrap; gap: 4px; }
.pp-roles .chip { height: 22px; font-size: 11.5px; padding: 0 8px; }
.pp-roles-pick { border: 0; padding: 0; margin: 0; }
.pp-role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: var(--s2) var(--s4); }

/* ---------- profile */
.pp-hero { display: flex; gap: var(--s4); align-items: center; padding: var(--s5); border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--accent-soft), transparent); border-radius: var(--r-lg) var(--r-lg) 0 0; }
.pp-hero h2 { font-size: 22px; }
.pp-hero-chips { margin-top: var(--s2); }
.pp-chain { list-style: none; margin: 0; padding: var(--s2) 0; }
.pp-chain li { display: flex; flex-direction: column; gap: 2px; padding: var(--s2) var(--s5) var(--s2) calc(var(--s5) + 18px); position: relative; }
.pp-chain li::before { content: ""; position: absolute; left: var(--s5); top: 20px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.pp-chain li:not(:last-child)::after { content: ""; position: absolute; left: calc(var(--s5) + 3.5px); top: 30px; bottom: -10px; border-left: 1.5px solid var(--border-strong); }
.pp-chain a:hover { text-decoration: none; }
.pp-dotted { padding-top: 0; }
.pp-dotted .divider-label { margin-top: 0; }
.pp-checklist + .pp-checklist { border-top: 1px solid var(--border); }
.pp-checklist { display: grid; gap: var(--s3); }
.pp-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.pp-items li { display: flex; align-items: center; gap: var(--s3); padding: 6px 0; flex-wrap: wrap; }
.pp-items li.done .grow { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.pp-check { all: unset; box-sizing: border-box; cursor: pointer; width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--border-strong);
  display: grid; place-items: center; color: var(--surface); background: var(--surface); flex: none; }
.pp-check:hover { border-color: var(--violet); }
.pp-check:focus-visible { box-shadow: var(--focus); }
li.done .pp-check { background: var(--good); border-color: var(--good); }
.pp-check.static { cursor: default; }
.pp-owner { display: inline-flex; align-items: center; gap: 6px; }
.pp-leave { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--s3); }
.pp-leave > div { display: flex; flex-direction: column; }
.pp-leave-n { font: 700 22px/1.2 var(--font-display); font-variant-numeric: tabular-nums; }
.pp-leave-n.strong { color: var(--accent-text); }
.pp-num { max-width: 96px; flex: 0 0 96px !important; }
.pp-reqs { margin: 0 calc(var(--s5) * -1) calc(var(--s5) * -1); border-top: 1px solid var(--border); }
.pp-role-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.pp-role-list li { display: flex; align-items: center; gap: var(--s2); }
.pp-more > summary { cursor: pointer; font-weight: 600; color: var(--accent-text); padding: 4px 0; }
.pp-more[open] > summary { margin-bottom: var(--s3); }
.pp-rm { margin-top: var(--s2); }

/* ---------- phones: the tree becomes an indented list */
@media (max-width: 700px) {
  .oc-frame { overflow: visible; max-height: none; background-image: none; background-color: transparent; border: 0; border-radius: 0; }
  .oc-canvas { display: block; padding: 0; }
  .oc-tree { display: block; }
  .oc-tree > .oc-node + .oc-node { margin-top: var(--s3); }
  .oc-node { display: block; }
  .oc-card { width: auto; }
  .oc-branch { text-align: left; }
  .oc-branch > summary { margin: 6px 0 0 12px; }
  .oc-branch > summary::before { left: 10px; }
  .oc-children, .oc-children.stacked { display: block; padding: 0 0 0 12px; margin-left: 12px; border-left: 1.5px solid var(--line); }
  .oc-children::before, .oc-children.stacked::before { display: none; }
  .oc-children > .oc-node, .oc-children.stacked > .oc-node { padding: 10px 0 0 10px; }
  .oc-children > .oc-node::before { display: block !important; content: ""; position: absolute; left: -12px; top: 34px; width: 20px; height: 0;
    border: 0 !important; border-top: 1.5px solid var(--line) !important; border-radius: 0 !important; }
  .oc-children > .oc-node::after { display: none !important; }
  .oc-tools { display: none; }
  .oc-search { max-width: none; flex-basis: 100%; }
  .pp-leave { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pp-hero { padding: var(--s4); }
  .pp-chain li { padding-left: calc(var(--s4) + 18px); }
  .pp-chain li::before { left: var(--s4); }
  .pp-chain li:not(:last-child)::after { left: calc(var(--s4) + 3.5px); }
  .oc-depts { grid-template-columns: minmax(0, 1fr); }
  .oc-pos-form { justify-content: flex-start; }
}

/* ---------- 2.0: filters, acting, structure, units, positions, succession, restructures */
.oc-filters { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: flex-end; margin: calc(var(--s2) * -1) 0 var(--s4); }
.oc-filters .field { flex: 0 1 200px; margin: 0; }
.oc-filters .oc-filter-go { flex: 0 0 auto; }
.oc-badge.acting { background: var(--good-soft); color: var(--good); }
.oc-badge.vacant { background: var(--accent-soft); color: var(--accent-text); }
.oc-card.context { opacity: .55; border-style: dashed; box-shadow: none; }
.oc-legend-card.context { border-style: dashed; opacity: .6; }

.oc-structure { display: grid; gap: var(--s4); }
.oc-structure > .card { margin-top: 0; }
.oc-units { list-style: none; margin: 0; padding: 0; }
.oc-entity > .oc-units { padding: var(--s2) var(--s4) var(--s4); }
.oc-units .oc-units { margin-left: 22px; padding-left: var(--s3); border-left: 1.5px solid var(--border-strong); }
.oc-unit { position: relative; }
.oc-unit-d > summary { list-style: none; }
.oc-unit-d > summary::-webkit-details-marker { display: none; }
.oc-unit-row { display: flex; align-items: center; gap: var(--s3); min-height: 48px; padding: 8px var(--s3); margin: 4px 0; border-radius: var(--r);
  border: 1px solid var(--border); background: var(--surface); cursor: pointer; flex-wrap: wrap; }
.oc-unit-row.static { cursor: default; }
.oc-unit-row:hover { border-color: var(--border-strong); box-shadow: var(--shadow-1); }
.oc-unit-division > .oc-unit-d > .oc-unit-row, .oc-unit-division > .oc-unit-row { background: linear-gradient(90deg, var(--accent-soft), var(--surface) 70%);
  border-color: color-mix(in srgb, var(--violet) 30%, var(--border)); }
.oc-unit-team > .oc-unit-d > .oc-unit-row, .oc-unit-team > .oc-unit-row { background: var(--surface-2); }
.oc-unit-caret { width: 16px; display: inline-flex; color: var(--muted); transition: transform .15s; transform: rotate(-90deg); flex: none; }
.oc-unit-d[open] > summary .oc-unit-caret { transform: none; }
.oc-unit-kind { flex: none; font: 600 11px/1 var(--font); text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  padding: 4px 7px; border-radius: 6px; background: var(--surface-3); }
.oc-unit-name { font-weight: 600; color: var(--text); min-width: 0; }
a.oc-unit-name:hover { color: var(--accent-text); text-decoration: none; }
.oc-unit-head { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); min-width: 0; }
.oc-unit-figs { display: inline-flex; gap: 6px; align-items: center; margin-left: auto; }
.oc-unit-figs .oc-count { margin-left: 0; }
.oc-unit.changed > .oc-unit-row { border-color: var(--violet); }
.oc-unit.new > .oc-unit-row { border-style: dashed; border-color: var(--good); }
.oc-unit.closing > .oc-unit-row { opacity: .6; text-decoration: line-through; text-decoration-color: var(--faint); }
.oc-units.preview { margin: 0; }

.oc-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: var(--s4); font-size: 13px; color: var(--muted); }
.oc-crumbs .icon { color: var(--faint); }
.oc-crumbs [aria-current] { color: var(--text); font-weight: 600; }
.oc-resp, .oc-unit-desc { white-space: pre-line; line-height: 1.6; }
.oc-vacant-avatar.big { width: 56px; height: 56px; }
.oc-vacant-avatar.planned { border-color: var(--faint); color: var(--muted); }

.oc-succ { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--s4); align-items: start; }
.oc-succ > .card { margin-top: 0; }
.oc-succ-card.risk { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.oc-succ-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.oc-succ-list li { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.oc-ready { margin-left: auto; font: 600 11.5px/1 var(--font); padding: 4px 8px; border-radius: 999px; background: var(--neutral-soft); color: var(--neutral); }
.oc-ready.r-now { background: var(--good-soft); color: var(--good); }
.oc-ready.r-1-2 { background: var(--info-soft); color: var(--info); }

.oc-changes { list-style: none; margin: 0; padding: var(--s2) var(--s5) var(--s4); counter-reset: ch; display: grid; gap: var(--s2); }
.oc-changes li { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; padding: var(--s2) 0; border-bottom: 1px solid var(--border); counter-increment: ch; }
.oc-changes li:last-child { border-bottom: 0; }
.oc-changes li::before { content: counter(ch); width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--accent-soft); color: var(--accent-text); font: 700 12px/1 var(--font); }
.oc-change-kind { font: 600 11px/1 var(--font); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.oc-impact { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: 13.5px; }
.oc-impact .icon { color: var(--faint); vertical-align: -2px; }
.oc-add-change .pp-more + .pp-more { border-top: 1px solid var(--border); padding-top: var(--s2); }
.oc-all-positions > summary { list-style: none; cursor: pointer; }
.oc-all-positions > summary::-webkit-details-marker { display: none; }
.oc-all-positions[open] > summary .more { visibility: hidden; }
.pp-routes td { vertical-align: top; }
.pp-route-step { font-weight: 500; }

@media (max-width: 700px) {
  .oc-filters .field { flex: 1 1 140px; }
  .oc-units .oc-units { margin-left: 10px; padding-left: var(--s2); }
  .oc-entity > .oc-units { padding: var(--s2) var(--s3) var(--s3); }
  .oc-unit-head { display: none; }
  .oc-hide-phone { display: none; }
  .oc-succ { grid-template-columns: minmax(0, 1fr); }
}
.oc-legend-structure { margin-bottom: var(--s4); }
.oc-changes li > .grow { flex: 1 1 240px; min-width: 0; }
.oc-changes li > form { margin-left: auto; flex: none; }
