/* Clinic map: the clinic as one live tree (after BRATES' CrewHierarchy) */
.cm-wrap { display: flex; flex-direction: column; gap: 12px; height: calc(100vh - 130px); min-height: 460px; }
.cm-top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg a { padding: 6px 14px; border-radius: 8px; text-decoration: none; color: var(--ink-2); font-weight: 500; }
.seg a.on { background: var(--dark); color: #fff; }
.cm-legend { display: flex; gap: 12px; color: var(--ink-3); }
.cm-legend span { display: inline-flex; align-items: center; gap: 5px; }
.cm-viewport { position: relative; flex: 1; overflow: hidden; touch-action: none; cursor: grab; user-select: none;
  background-color: var(--surface-2); background-image: radial-gradient(circle, #ddd3c7 1.1px, transparent 1.2px); background-size: 20px 20px; }
.cm-viewport:active { cursor: grabbing; }
.cm-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.cm-edges { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.cm-edges path { fill: none; stroke: #d9cfc3; stroke-width: 1.3; }
.cm-edges path.live { stroke: var(--accent); stroke-width: 1.9; stroke-dasharray: 6 5; animation: cm-run .9s linear infinite; }
@keyframes cm-run { to { stroke-dashoffset: -22; } }
.cm-dot { width: 8px; height: 8px; border-radius: 50%; background: #b9ada0; flex: none; display: inline-block; }
.cm-dot.busy { background: var(--accent); box-shadow: 0 0 0 3px rgba(154, 106, 69, .18); animation: cm-pulse 1.4s ease-in-out infinite; }
.cm-dot.idle { background: #3ecf8e; }
.cm-dot.off, .cm-dot.done { background: #d4cbc1; }
@keyframes cm-pulse { 50% { opacity: .45; } }

.cm-dept { position: absolute; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 12.5px; }
.cm-dept i { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.cm-dept b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm-dept span { margin-left: auto; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cm-dept em { font-style: normal; color: var(--accent-ink); font-weight: 600; }

.cm-card { position: absolute; display: flex; align-items: center; gap: 10px; padding: 0 11px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; transition: transform .15s, box-shadow .15s, border-color .15s; }
.cm-card:hover, .cm-term:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(35, 28, 23, .12); }
.cm-card.lead { border-radius: 16px; box-shadow: var(--shadow); }
.cm-card.busy, .cm-term.busy { border-color: rgba(154, 106, 69, .6); }
.cm-card.off { opacity: .62; }
.cm-av { width: 30px; height: 30px; border-radius: 50%; color: #fff; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; flex: none; }
.cm-card.lead .cm-av { width: 36px; height: 36px; font-size: 13px; }
.cm-av.big { width: 42px; height: 42px; font-size: 14px; }
.cm-txt { min-width: 0; flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.cm-name { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm-card.lead .cm-name { font-size: 14.5px; }
.cm-line { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.cm-card.busy .cm-line { color: var(--accent-ink); font-weight: 500; }
.cm-lead, .cm-ai { font-style: normal; font-size: 10px; font-weight: 700; padding: 0 6px; border-radius: 99px; line-height: 16px; flex: none; }
.cm-lead { background: var(--accent-soft); color: var(--accent-ink); }
.cm-ai { background: #e0f2ef; color: #0e6b60; }

.cm-work { position: absolute; display: flex; align-items: center; gap: 8px; padding: 0 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; font-size: 12px; cursor: pointer; }
.cm-work b { font-weight: 600; white-space: nowrap; }
.cm-work span { color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cm-work.live { border-color: var(--accent); background: #fffaf4; }
.cm-work.req { border-style: dashed; }
.cm-work.more { color: var(--ink-3); justify-content: center; background: transparent; border-style: dashed; }

.cm-term { position: absolute; display: flex; flex-direction: column; overflow: hidden; background: #1f1915; border: 1px solid #3a2e25; border-radius: 12px; cursor: pointer; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
.cm-term .cm-bar { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px; background: #2a221c; border-bottom: 1px solid #3a2e25; color: #f3e8dc; font-size: 12px; }
.cm-term .cm-bar b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm-term .cm-bar span { margin-left: auto; color: #a8998a; font-size: 11px; white-space: nowrap; }
.cm-term.busy { border-color: var(--accent); }
.cm-lines { padding: 8px 10px; font-family: ui-monospace, Menlo, monospace; font-size: 11px; line-height: 1.55; color: #d9cdbf; min-height: 0; overflow: hidden; }
.cm-lines p { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm-lines p.past { color: #7d7064; }
.cm-lines p.live { color: #f0b98a; font-weight: 600; }
.cm-lines i.wa { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #25d366; margin-right: 1px; }

.cm-zoom { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 2px; padding: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 99px; box-shadow: var(--shadow); }
.cm-zoom button { width: 30px; height: 30px; border: 0; background: none; border-radius: 50%; cursor: pointer; color: var(--ink-2); font-size: 16px; }
.cm-zoom button:hover { background: var(--surface-2); color: var(--ink); }

.cm-sheet { width: min(620px, 100%); }
.cm-sheet .modal-head { gap: 12px; }
.cm-sheet .modal-head h3 { margin: 0; }
.cm-now { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-weight: 500; }
.cm-now.busy { background: var(--accent-soft); color: var(--accent-ink); }
.cm-list { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; font-size: 13px; }
.cm-list > div { padding: 6px 8px; border-radius: 8px; font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }
.cm-list > div.live { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.cm-list > div.past { color: var(--ink-3); }
.cm-pat { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; padding: 8px; border-radius: 8px; text-decoration: none; color: var(--ink); border: 1px solid var(--line); margin-top: 6px; }
.cm-pat:hover { border-color: var(--ink-3); }
.cm-pat span:last-child { width: 100%; color: var(--ink-2); font-size: 12.5px; }
@media (max-width: 860px) { .cm-wrap { height: calc(100vh - 110px); } .cm-legend { display: none; } }
