/* Map view ("The Big Picture"): the business tree with live work attached to each branch. */

/* ---- toolbar: small secondary buttons; pressed = quiet fill, never primary ---- */
.pmv-map-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.pmv-map-tools .btn { background: transparent; border-color: var(--btn-border, rgba(255, 255, 255, .22)); color: var(--text); }
.pmv-map-tools .btn[aria-pressed="true"] { border-color: var(--text); background: rgba(255, 255, 255, .1); color: var(--text); }
@media (hover: hover) { .pmv-map-tools .btn:hover { background: rgba(255, 255, 255, .06); } }

/* ---- tree box ---- */
.pmv-map-box { padding: 24px 24px 24px; border: 1px solid var(--line); border-radius: var(--r-lg, 20px); background: var(--glass); }
.pmv-map-root { display: inline-flex; flex-direction: column; gap: 4px; padding: 12px 16px; border: 2px solid var(--accent); border-radius: var(--r-md, 14px); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.pmv-map-root span { font-family: var(--display); font-size: 32px; line-height: .9; font-weight: 400; letter-spacing: .01em; }
.pmv-map-root small { color: var(--muted); font-size: var(--fs-cap, 11px); font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.pmv-map-blank { margin: 16px 0 0; color: var(--faint, rgba(255, 255, 255, .28)); font-size: var(--fs-body, 14px); }

/* indented tree: each level hangs off a vertical line in the division colour,
   with a short tick into every row. --c is set on each division and inherited. */
.pmv-map-kids { --tick: 19px; margin: 0; padding: 8px 0 0 24px; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.pmv-map-top { --c: var(--muted); padding-left: 24px; }
.pmv-map-li { position: relative; min-width: 0; padding-left: 16px; }
.pmv-map-li::before { content: ""; position: absolute; left: 0; top: var(--tick); width: 12px; border-top: 2px solid color-mix(in srgb, var(--c, var(--muted)) 55%, transparent); }
.pmv-map-li::after { content: ""; position: absolute; left: 0; top: -6px; bottom: 0; border-left: 2px solid color-mix(in srgb, var(--c, var(--muted)) 55%, transparent); }
.pmv-map-li:last-child::after { bottom: auto; height: calc(var(--tick) + 7px); }

/* wide screens: divisions flow into two columns; the top spine would break across
   columns, so divisions drop it and stand as their own trees */
@media (min-width: 1100px) {
  .pmv-map-top { display: block; columns: 2 420px; column-gap: 40px; padding: 16px 0 0; }
  .pmv-map-top > .pmv-map-li { break-inside: avoid; padding: 0 0 8px; }
  .pmv-map-top > .pmv-map-li::before, .pmv-map-top > .pmv-map-li::after { display: none; }
}

/* ---- branch rows ---- */
.pmv-map-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pmv-map-node { display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; min-height: 36px; padding: 6px 12px; border: 1px solid var(--line); border-radius: var(--r-md, 14px); background: var(--surface); color: var(--text); font: inherit; font-size: var(--fs-body, 14px); font-weight: 600; line-height: 20px; text-align: left; }
button.pmv-map-node { cursor: pointer; transition: border-color .15s; }
@media (hover: hover) { button.pmv-map-node:hover { border-color: var(--c, var(--accent)); } }
.pmv-map-node:focus-visible, .pmv-map-add:focus-visible, .pmv-map-card:focus-visible, .pmv-map-ws:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pmv-map-node.d1 { min-height: 40px; font-size: var(--fs-item, 16px); font-weight: 600; border: 2px solid var(--c); background: color-mix(in srgb, var(--c) 12%, var(--surface)); }
.pmv-map-node.d2 { border-color: color-mix(in srgb, var(--c) 55%, var(--line)); }
.pmv-map-node.empty { opacity: 1; color: var(--muted); border-style: dashed; }
.pmv-map-node.d1.empty { background: none; }
.pmv-map-car { flex: none; width: 10px; color: var(--muted); font-size: 11px; }
.pmv-map-name { min-width: 0; overflow-wrap: anywhere; text-wrap: balance; }
.pmv-map-count { flex: none; padding: 0 8px; border-radius: 999px; background: var(--c, var(--accent)); color: #0b1324; font-size: 11px; font-weight: 700; line-height: 18px; }
.pmv-map-none { flex: none; color: var(--faint, rgba(255, 255, 255, .28)); font-size: 11px; font-weight: 500; }
.pmv-map-add { display: grid; place-items: center; flex: none; width: 28px; height: 28px; padding: 0; border: 1px dashed var(--c, var(--accent)); border-radius: 50%; background: none; color: var(--c, var(--accent)); font: inherit; font-size: 16px; line-height: 1; cursor: pointer; transition: opacity .15s, background .15s, color .15s; }
@media (hover: hover) {
  .pmv-map-add { opacity: 0; }
  .pmv-map-row:hover .pmv-map-add { opacity: 1; }
  .pmv-map-add:hover { border-style: solid; background: var(--c, var(--accent)); color: #0b1324; }
}
.pmv-map-add:focus-visible { opacity: 1; }
@media (hover: none) { .pmv-map-add { width: 32px; height: 32px; opacity: .9; } }

/* ---- attached items ---- */
.pmv-map-leaf { --tick: 22px; }
.pmv-map-item { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; }

/* task: a small poster card, the picture fading in from the right */
.pmv-map-card { position: relative; display: block; width: 260px; max-width: 100%; min-height: 64px; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-md, 14px); background: #0a0f1c; color: #fff; font: inherit; text-align: left; cursor: pointer; transition: transform .15s; }
@media (hover: hover) { .pmv-map-card:hover { transform: scale(1.02); } }
.pmv-map-vis { position: absolute; inset: 0; }
.pmv-map-vis svg { display: block; width: 100%; height: 100%; }
.pmv-map-card::after { content: ""; position: absolute; inset: 0; background: var(--scrim, linear-gradient(90deg, rgba(7, 12, 24, .97) 0%, rgba(7, 12, 24, .85) 55%, rgba(7, 12, 24, .35) 100%)); }
.pmv-map-card-in { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 2px; min-height: 62px; padding: 10px 12px 10px 16px; box-shadow: inset 4px 0 0 var(--sc); }
.pmv-map-lab { color: var(--muted); font-size: var(--fs-cap, 11px); font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.pmv-map-hd { font-size: var(--fs-body, 14px); font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; text-wrap: balance; }

/* workstream: outlined, its colour as an inset bar that follows the radius */
.pmv-map-ws { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 260px; max-width: 100%; padding: 10px 12px 10px 16px; border: 1px solid var(--line); border-radius: var(--r-md, 14px); box-shadow: inset 4px 0 0 var(--wc); background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: border-color .15s; }
@media (hover: hover) { .pmv-map-ws:hover { border-color: var(--wc); } }
.pmv-map-ws b { font-size: var(--fs-body, 14px); line-height: 20px; overflow-wrap: anywhere; text-wrap: balance; }
.pmv-map-ws small { color: var(--muted); font-size: var(--fs-meta, 13px); line-height: 18px; overflow-wrap: anywhere; }

/* Rewire picker */
.pmv-map-move { width: 260px; max-width: 100%; height: var(--field-h-sm, 36px); border-color: var(--field-border, rgba(255, 255, 255, .16)); font-size: var(--fs-meta, 13px); text-overflow: ellipsis; white-space: nowrap; overflow: hidden; }
.pmv-map-move:hover:not(:disabled), .pmv-map-move:focus { border-color: var(--accent); }

/* ---- legend (the "+ add task" hint is its last item) ---- */
.pmv-map-legend { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 14px; color: var(--muted); font-size: var(--fs-meta, 13px); }
.pmv-map-legend span { display: inline-flex; align-items: center; gap: 8px; }
.pmv-map-key { display: inline-block; flex: none; width: 18px; height: 12px; border: 1px solid var(--line); border-radius: 4px; }
.pmv-map-key.task { background: #0a0f1c; box-shadow: inset 3px 0 0 var(--accent); }
.pmv-map-key.ws { background: var(--surface); box-shadow: inset 3px 0 0 var(--sky); }
.pmv-map-key.none { opacity: 1; border-style: dashed; background: none; }
.pmv-map-key.add { display: grid; place-items: center; width: 18px; height: 18px; border: 1px dashed var(--accent); border-radius: 50%; color: var(--accent); font-size: 12px; font-style: normal; line-height: 1; }

/* ---- phone: tighter indents, everything inside the screen ---- */
@media (max-width: 700px) {
  .pmv-map-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .pmv-map-tools .btn { width: 100%; }
  .pmv-map-box { padding: 16px 12px; }
  .pmv-map-root span { font-size: 28px; }
  .pmv-map-kids { padding-left: 8px; }
  .pmv-map-top { padding-left: 12px; }
  .pmv-map-li { padding-left: 12px; }
  .pmv-map-li::before { width: 9px; }
  .pmv-map-node { padding: 6px 10px; }
  .pmv-map-node.empty .pmv-map-none { display: none; }
  .pmv-map-card, .pmv-map-ws, .pmv-map-move { width: 100%; }
  .pmv-map-legend { gap: 8px 16px; }
}
