/* ═══════════════════════════════════════════════════════════════════
   pathways — scoped styles
   Selectors are prefixed with .pw- (pathways) to avoid clashing with the
   shared global classes (.sidebar, .toolbar, .canvas, etc.), which are not
   re-defined here. Some .pw- names double as element ids / SVG marker ids and
   are matched by name in the JS (pathways.js, connections-helper.js, etc.),
   so keep CSS, HTML and JS in sync when renaming them.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Canvas drop area ────────────────────────────────────────────────── */
.pw-canvas {
    position: relative;
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    background-color: #fafafa;
    background-image:
        linear-gradient(rgba(0,0,0,.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,0,0,.04) 1px, transparent 1px);
    background-size: 32px 32px;
}

.final-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #22c55e;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    margin-top: 4px;
    letter-spacing: 0.03em;
}

.pw-canvas-drag-over {
    background-color: #e8f4fd;
    outline: 2px dashed #3b82f6;
    outline-offset: -4px;
}

/* ── SVG overlay ─────────────────────────────────────────────────────── */
.pw-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
    z-index: 11;
}

/* ── Empty state hint ────────────────────────────────────────────────── */
.pw-empty-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #aaa;
    user-select: none;
    pointer-events: none;
}

.pw-empty-icon {
    font-size: 56px;
    margin-bottom: 16px;
    display: block;
    opacity: 0.35;
}

/* ── Credential node ─────────────────────────────────────────────────── */
.pw-node {
    position: absolute;
    width: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: move;
    user-select: none;
    z-index: 10;
}

.pw-node.pw-node-menu-active {
    z-index: 200;
}

.pw-node-img-wrapper {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,.12);
    transition: box-shadow 0.15s;
}

.pw-node:hover .pw-node-img-wrapper {
    box-shadow: 0 4px 16px rgba(0,0,0,.2);
}

.pw-node-image {
    width: 100px;
    height: 100px;
    display: block;
    border-radius: 6px;
    object-fit: contain;
}

/* ── Action button row (eye + menu, floats above the credential image) ── */
.pw-node-action-btns {
    position: absolute;
    top: -12px;
    right: -8px;
    display: flex;
    flex-direction: row;
    gap: 12px;
    z-index: 30;
}

/* Elective group options button — sits just left of the G1 badge */
.gate-action-btns {
    right: 28px;
}

/* ── Eye icon button ─────────────────────────────────────────────────── */
.pw-node-eye-btn {
    position: static;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #d1d5db;
    border-radius: 4px;
    width: 25px;
    height: 25px;
    min-height: 0;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 10px;
    line-height: 1;
    color: #6b7280;
    padding: 0;
    opacity: 0;
    flex-shrink: 0;
    transition: opacity 0.15s, color 0.15s;
}

.pw-node:hover .pw-node-eye-btn {
    opacity: 1;
}

.pw-node-eye-btn:hover {
    color: #3b82f6;
    border-color: #3b82f6;
}

/* ── Unlink button (top-right of credential image) ───────────────────── */
.pw-node-unlink-btn {
    position: absolute;
    top: -12px;
    right: -8px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #d1d5db;
    border-radius: 4px;
    width: 25px;
    height: 25px;
    min-height: 0;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    line-height: 1;
    color: #6b7280;
    z-index: 25;
    cursor: pointer;
    padding: 0;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
}

.pw-node-img-wrapper:hover .pw-node-unlink-btn {
    opacity: 1;
}

.pw-node-unlink-btn:hover {
    color: #ef4444;
    border-color: #ef4444;
}

/* Eye button for creds inside an elective group — sit next to the unlink icon */
.elective-embedded-node .pw-node-eye-btn {
    position: absolute;
    top: -12px;
    right: 29px;
    z-index: 25;
}

/* Show/hide only on credential-image hover (like the unlink icon), not on gate hover */
.pw-node:hover .elective-embedded-node .pw-node-eye-btn {
    opacity: 0;
}

.elective-embedded-node .pw-node-img-wrapper:hover .pw-node-eye-btn {
    opacity: 1;
}

/* ── Duplicate sequence badge ────────────────────────────────────────── */
.pw-node-seq-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: #3b82f6;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 25;
    line-height: 1;
    pointer-events: none;
}

/* ── Gate sequence badge ─────────────────────────────────────────────── */
.gate-seq-badge {
    position: absolute;
    top: -10px;
    right: 2px;
    min-width: 20px;
    height: 18px;
    padding: 0 5px;
    background: #1195d3;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 25;
    line-height: 1;
    pointer-events: none;
}

/* ── Connector circles ───────────────────────────────────────────────── */
.pw-connector {
    position: absolute;
    width: 14px;
    height: 14px;
    background: #fff;
    border: 2px solid #9ca3af;
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
    cursor: crosshair;
    z-index: 20;
    transition: background 0.15s, border-color 0.15s, transform 0.12s;
}

.pw-connector-left  { left:  -7px; }
.pw-connector-right { right: -7px; }

.pw-connector:hover,
.pw-connector-active {
    background: #3b82f6;
    border-color: #1d4ed8;
    transform: translateY(-50%) scale(1.3);
}

/* ── Node name label ─────────────────────────────────────────────────── */
.pw-node-name {
    font-size: 11px;
    text-align: center;
    margin-top: 6px;
    max-width: 130px;
    word-break: break-word;
    color: #374151;
    line-height: 1.3;
}

/* ── Node inline label ───────────────────────────────────────────────── */
.pw-node-label-area {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 6px;
    margin-bottom: 2px;
    width: 100%;
}

.pw-node-label-view {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.pw-node-label-text {
    display: inline-block;
    font-size: 12px;
    font-weight: 400;
    color: gray;
    background: #dbeafe;
    border: 1px solid silver;
    border-radius: 999px;
    padding: 4px 12px;
    max-width: 110px;
    word-break: break-word;
    white-space: normal;
    line-height: 1.6;
    text-align: center;
    cursor: pointer;
}

.pw-node-label-add {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: #9ca3af;
    background: #fff;
    border: 1.5px dashed #d1d5db;
    border-radius: 999px;
    padding: 4px 14px;
    white-space: nowrap;
    transition: border-color 0.15s, color 0.15s, background 0.15s, opacity 0.15s;
    user-select: none;
    letter-spacing: 0.01em;
    opacity: 0;
}

.pw-node:hover .pw-node-label-add {
    opacity: 1;
}

.pw-node-label-view:hover .pw-node-label-add {
    border-color: #3b82f6;
    color: #3b82f6;
    background: #eff6ff;
}

.pw-node-label-input {
    width: 110px;
    font-size: 11px;
    border: 1px solid #3b82f6;
    border-radius: 4px;
    padding: 2px 5px;
    outline: none;
    text-align: center;
    box-sizing: border-box;
    color: #374151;
}

/* ── Incoming connection labels below the node ───────────────────────── */
.pw-node-conn-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    justify-content: center;
    max-width: 145px;
    margin-top: 3px;
}

/* ── Node context-menu button ────────────────────────────────────────── */
.pw-node-menu-btn {
    position: relative;
    top: 0;
    right: auto;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    width: 25px;
    height: 25px;
    min-height: 0;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 10px;
    line-height: 1;
    color: #6b7280;
    padding: 0;
    opacity: 0;
    flex-shrink: 0;
    transition: opacity 0.15s;
}

.pw-node:hover .pw-node-menu-btn {
    opacity: 1;
}

/* ── Node context menu ───────────────────────────────────────────────── */
.pw-node-menu {
    position: absolute;
    /* Default: opens on the left side of the node. When the node is close
       to the canvas left edge (node.x < 150) the .pw-node-menu-right
       variant flips it to the right so it stays on-canvas. */
    top: -10px;
    right: 20px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,.15);
    padding: 6px 0;
    list-style: none;
    margin: 0;
    min-width: 160px;
    z-index: 100;
}

/* Opens on the right side of the node (mirror of the default). */
.pw-node-menu.pw-node-menu-right {
    left: 20px;
    right: auto;
}

.pw-node-menu li {
    padding: 8px 14px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    color: #374151;
}

.pw-node-menu li:hover {
    background: #f3f4f6;
    color: #ca0a0a;
}

/* ── Sidebar drag item ───────────────────────────────────────────────── */
.pw-sidebar-drag-item {
    display: inline-block;
    cursor: grab;
}

.pw-sidebar-drag-item:active {
    cursor: grabbing;
}

.pw-add-btn {
    cursor: pointer;
    color: #374151;
}

.pw-add-btn:hover {
    color: #22c55e;
}

/* ── Toolbar legend ──────────────────────────────────────────────────── */
.pw-legend {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
    font-size: 11px;
    color: #6b7280;
}

.pw-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.pw-legend-hint {
    font-style: italic;
    white-space: nowrap;
}

.pw-legend-help-btn {
    background: none;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    color: #374151;
    cursor: pointer;
    font-size: 11px;
    padding: 3px 8px;
    margin-left: 4px;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    line-height: 1.4;
}
.pw-legend-help-btn:hover {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}

/* ── Dialog overlay ──────────────────────────────────────────────────── */
.pw-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100010;
}

.pw-dialog {
    background: #fff;
    border-radius: 10px;
    padding: 28px 32px;
    min-width: 360px;
    max-width: 480px;
    box-shadow: 0 8px 32px rgba(0,0,0,.2);
}

.pw-dialog-error {
    border-top: 4px solid #ca0a0a;
}

.pw-dialog-title {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 16px;
    color: #111;
}

.pw-showpaths-dialog-overlay {
    position: fixed;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100010;
    top: 0px;
    left: 0px;
    right: 0px;
    bottom: 0px;
}

.pw-form-group {
    margin-bottom: 18px;
}

.pw-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.pw-input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s;
}

.pw-input:focus {
    border-color: #3b82f6;
}

.pw-optional-badge {
    font-weight: normal;
    font-size: 10px;
    color: #9ca3af;
    margin-left: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.pw-radio-group {
    display: inline-flex;
    border: 1.5px solid #d1d5db;
    border-radius: 999px;
    overflow: hidden;
}

.pw-radio-label {
    display: flex;
    cursor: pointer;
    font-weight: normal;
}

.pw-radio-label input[type="radio"] {
    display: none;
}

.pw-radio-pill {
    border: none;
    border-radius: 0;
    padding: 5px 16px;
    font-size: 12px;
    color: #374151;
    background: transparent;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    white-space: nowrap;
}

.pw-radio-label + .pw-radio-label .pw-radio-pill {
    border-left: 1.5px solid #d1d5db;
}

.pw-radio-label input[type="radio"]:checked + .pw-radio-pill.mandatory {
    background: #16a34a;
    color: #fff;
}

.pw-radio-label input[type="radio"]:checked + .pw-radio-pill.optional {
    background: #2563eb;
    color: #fff;
}

/* ── Depends-on modal: Mandatory / Optional sliding pill toggle ── */
.seg-wrap {
    display: inline-flex;
}

.seg-track {
    position: relative;
    display: inline-flex;
    align-items: stretch;
    background: #f0f2f5;
    border: 1.5px solid #d1d5db;
    border-radius: 9999px;
    /* padding: 4px;
    height: 40px; */
    box-sizing: border-box;
    user-select: none;
    overflow: hidden;
}

.seg-pill {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 4px;
    right: 50%;
    width: auto;
    background: #3B9EE8;
    border-radius: 9999px;
    /* box-shadow: 0 2px 8px rgba(59, 158, 232, 0.40); */
    transition: left 0.22s cubic-bezier(0.4, 0, 0.2, 1), right 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    z-index: 0;
}

.seg-pill.seg-pill-right {
    left: 50%;
    right: 6px;
    transform: none;
}

.seg-opt {
    position: relative;
    z-index: 1;
    flex: 1;
    border: silver;
    background: transparent;
    padding: 0 18px;
    font-size: 12px;
    font-weight: 500;
    color: #9ca3af;
    cursor: pointer;
    border-radius: 9999px;
    white-space: nowrap;
    transition: color 0.18s;
    line-height: 1;
    outline: none !important;
}

.seg-opt.active {
    color: #fff;
    font-weight: 600;
    outline: none !important;
    width: 50%;
}

.pw-hint {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 6px;
    margin-bottom: 0;
}

.pw-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}

/* ── Connection context menu ─────────────────────────────────────────── */
.conn-ctx-menu {
    position: fixed;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,.15);
    min-width: 140px;
    z-index: 100020;
    overflow: hidden;
}

.pw-ctx-item {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    color: #374151;
    transition: background 0.12s;
}

.pw-ctx-item:hover {
    background: #f3f4f6;
}

.pw-ctx-item-danger {
    color: #ca0a0a;
}

.pw-ctx-item-danger:hover {
    background: #fef2f2;
}

/* ── Large dialog ────────────────────────────────────────────────────── */
.pw-dialog-large {
    min-width: 800px;
    max-width: 1000px;
    width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
}

/* ── Two-column layout ───────────────────────────────────────────────── */
.pw-dialog-cols {
    display: flex;
    gap: 20px;
    min-height: 300px;
}

.pw-dialog-col-left {
    flex: 0 0 75%;
    max-width: 72%;
    border-right: 1px solid #e5e7eb;
    padding-right: 20px;
    box-sizing: border-box;
}

.pw-dialog-col-right {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    max-height: 460px;
    padding-top: 6px;
}

/* ── Toggle switch ───────────────────────────────────────────────────── */
.pw-toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    cursor: pointer;
    margin: 0;
    flex-shrink: 0;
}

.pw-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.pw-toggle-track {
    position: absolute;
    inset: 0;
    background: #d1d5db;
    border-radius: 999px;
    transition: background 0.2s;
}

.pw-toggle input:checked ~ .pw-toggle-track {
    background: #22c55e;
}

.pw-toggle.disabled .pw-toggle-track {
    opacity: 0.45;
    cursor: not-allowed;
}

.pw-toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.pw-toggle input:checked ~ .pw-toggle-track .pw-toggle-thumb {
    transform: translateX(18px);
}

/* ── Credential pick list ────────────────────────────────────────────── */
.cred-pick-list {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    /* max-height: 300px; */
    overflow-y: auto;
}

.cred-pick-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.12s;
}

.cred-pick-item:last-child {
    border-bottom: none;
}

.cred-pick-item.disabled {
    opacity: 0.5;
}

.cred-pick-item.selected {
    background: #f0fdf4;
}

.cred-pick-img {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    object-fit: contain;
    flex-shrink: 0;
}

.cred-pick-name {
    flex: 1;
    font-size: 13px;
    color: #374151;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Error message ───────────────────────────────────────────────────── */
.pw-error-msg {
    color: #ca0a0a;
    font-size: 12px;
    margin-top: 6px;
    margin-bottom: 0;
}

/* ── Right panel ─────────────────────────────────────────────────────── */
.right-panel-title {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin: 0 0 12px;
}

.right-conn-item {
    position: relative;
    padding: 10px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color 0.12s, background 0.12s;
}

/* Credential Paths group — number pill anchored on the border */
.cp-group {
    margin-top: 14px;
    padding-top: 18px;
}

.cp-group-pill {
    position: absolute;
    top: -10px;
    left: 10px;
    margin: 0;
    background: #eff6ff;
}

.right-conn-item:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.right-conn-item.active {
    border-color: #2563eb;
    background: #dbeafe;
}

.conn-type-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

.pw-badge-standard { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.pw-badge-optional { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }

.right-conn-cred {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #374151;
    margin-bottom: 4px;
}

.right-conn-label {
    font-size: 11px;
    color: #6b7280;
    font-style: italic;
    display: block;
    margin-bottom: 4px;
}

/* ── Logic gate sidebar section ──────────────────────────────────────── */
.logic-gate-section {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
}

.logic-gate-section-title {
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
}

.logic-gate-items {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.logic-gate-drag-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: grab;
    user-select: none;
}

.logic-gate-drag-item:active {
    cursor: grabbing;
}

.logic-gate-shape {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,.12);
    transition: box-shadow 0.15s, transform 0.12s;
}

.logic-gate-drag-item:hover .logic-gate-shape {
    box-shadow: 0 4px 14px rgba(0,0,0,.2);
    transform: translateY(-2px);
}

/* ── Elective group — sidebar shape ───────────────────────────────────── */
.logic-gate-shape-elective {
    background: #f0fdf4;
    color: #166534;
    border: 2px solid #86efac;
}

.logic-gate-label {
    font-size: 10px;
    color: #6b7280;
}

/* ── Canvas elective group node body ──────────────────────────────────── */
.logic-node-body {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,.12);
    transition: box-shadow 0.15s;
}

.pw-node:hover .logic-node-body {
    box-shadow: 0 4px 16px rgba(0,0,0,.2);
}

.pw-node-logic {
    width: 130px;
}

.logic-node-body-elective {
    background: #f5f5f5;
    border: 1px dashed #9e9e9e;
    width: 130px;
    min-height: 80px;
    height: auto;
}

.gate-drop-active .logic-node-body-elective {
    background: #eeeeee;
    border: 2px solid #757575;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.12);
}

/* ── Elective group inner layout ──────────────────────────────────────── */
.logic-elective-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding: 10px 0;
    box-sizing: border-box;
    width: 100%;
}

/* ── Embedded credential nodes inside elective group ─────────────────── */
.elective-embedded-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 8px;
    position: relative;
}

.elective-embedded-node:last-child {
    margin-bottom: 0;
}

.logic-elective-badge {
    font-size: 9px;
    font-weight: 800;
    color: #555555;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1;
    margin-bottom: 2px;
    text-align: center;
}

.logic-elective-empty {
    font-size: 10px;
    color: #757575;
    opacity: 0.7;
    padding: 6px 0;
    text-align: center;
}

/* ── Elective credential items inside canvas node ────────────────────── */
.logic-elective-cred-item {
    display: flex;
    align-items: center;
    gap: 5px;
    width: 100%;
    box-sizing: border-box;
}

.logic-elective-cred-icon {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    object-fit: contain;
    flex-shrink: 0;
    border: 1px solid #86efac;
}

.logic-elective-cred-name {
    font-size: 10px;
    color: #78350f;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
    max-width: 110px;
    padding: 2px;
    text-wrap: auto;
}

/* ── Paths Check modal ───────────────────────────────────────────────── */
.paths-dialog {
    min-width: 700px;
    max-width: 1100px;
    width: 85vw;
    max-height: 60vh;
    display: flex;
    flex-direction: column;
}
.pw-dialog-subtitle {
    font-size: 13px;
    font-weight: normal;
    color: #6b7280;
    margin-left: 6px;
}
/* ng-include injects an anonymous wrapper div between .paths-dialog (flex
   column) and .paths-body, breaking the flex chain. Give it flex item
   properties so .paths-body gets a bounded height and can scroll. */
.paths-dialog > [ng-include] {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.paths-body {
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
    padding: 4px 2px;
}
.path-item {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 12px;
    background: #fafafa;
}
.path-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6b7280;
    margin-bottom: 10px;
}
.path-steps {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
.path-step-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}
.path-step {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 8px 12px;
}
.path-step-elective {
    border-left: 3px solid #22c55e;
    background: #f0fdf4;
}
.path-step-no-img {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 4px;
    color: #166534;
    font-size: 14px;
    flex-shrink: 0;
}
.path-step-info {
    display: flex;
    flex-direction: column;
    max-width: 160px;
}
.path-step-name {
    font-size: 13px;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.path-step-elective-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #166534;
    background: #dcfce7;
    border: 1px solid #86efac;
    border-radius: 999px;
    padding: 1px 6px;
    margin-top: 2px;
    line-height: 1.4;
}
.path-step-label {
    font-size: 11px;
    color: #6b7280;
    font-style: italic;
    margin-top: 2px;
}
.path-arrow {
    color: #9ca3af;
    font-size: 14px;
    flex-shrink: 0;
}

/* ── View-pathway toolbar title ──────────────────────────────────────── */
.view-pathway-title {
    flex: 1;
    padding: 0 12px;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.view-pathway-desc {
    color: #6b7280;
    font-weight: normal;
}

/* ── View-pathway layout overrides ──────────────────────────────────── */
/* Expand canvas to full width — no sidebar on the view page */
.view-pathway .canvas {
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
/* White background, no grid, scrollbars only when content overflows */
/* flex: 1 1 auto + min-height: 0 come from the shared .pw-canvas rule */
.pw-canvas-view {
    background-color: #fff;
    background-image: none;
    overflow: auto;
}

/* ── Recipient pathway view ──────────────────────────────────────────── */
.recipient-view .canvas {
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.recipient-view .pw-node-image {
    cursor: default;
}

.recipient-view .achievement-check {
    bottom: auto;
    top: -6px;
    background: #1195d3;
}

.recipient-view .achievement-check-sm {
    bottom: auto;
    top: -4px;
    background: #1195d3;
}

.recipient-view .pw-node-achieved .pw-node-img-wrapper,
.recipient-view .pw-elective-achieved .pw-node-img-wrapper {
    box-shadow: none;
}

/* Achievement states on credential nodes */
.pw-node-achieved .pw-node-img-wrapper {
    box-shadow: 0 0 0 3px #22c55e, 0 2px 8px rgba(0,0,0,.12);
}

/* Achievement check badge — shown on earned credential nodes */
.achievement-check {
    position: absolute;
    bottom: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    background: #22c55e;
    border: 2px solid #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #fff;
    z-index: 25;
    pointer-events: none;
}

.achievement-check-sm {
    width: 16px;
    height: 16px;
    font-size: 8px;
    bottom: -4px;
    right: -4px;
}

/* ── Recipient view: not-achieved credential nodes ───────────────────── */
.pw-node-not-achieved .pw-node-image {
    opacity: 0.45;
    border: 3px dashed #767676;
    padding: 4px;
    box-sizing: border-box;
}

.pw-elective-not-achieved .pw-node-image {
    opacity: 0.45;
    border: 2px dashed #767676;
    padding: 3px;
    box-sizing: border-box;
}

/* Embedded elective achievement states */
.pw-elective-achieved .pw-node-img-wrapper {
    box-shadow: 0 0 0 2px #22c55e;
}

/* Status badge pill */
.recipient-status-badge {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    vertical-align: middle;
    margin-left: 8px;
}

.pw-status-completed         { background: #dcfce7; color: #16a34a; border: 1px solid #86efac; }
.pw-status-inprogress        { background: #dbeafe; color: #2563eb; border: 1px solid #93c5fd; }
.pw-status-revoked           { background: #fee2e2; color: #dc2626; border: 1px solid #fca5a5; }
.pw-status-completed-revoked { background: #fef3c7; color: #d97706; border: 1px solid #fcd34d; }

/* Progress bar */
.progress-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.pw-progress-bar-track {
    flex: 0 0 120px;
    height: 8px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}

.pw-progress-bar-fill {
    height: 100%;
    background: #22c55e;
    border-radius: 999px;
    transition: width 0.4s ease;
    min-width: 4px;
}

.progress-label {
    font-size: 11px;
    color: #6b7280;
    white-space: nowrap;
}

/* Info pills (Assigned On, Assigned By) */
.info-pill {
    display: flex;
    flex-direction: column;
    min-width: 80px;
}

.info-pill strong {
    font-size: 11px;
    font-weight: 600;
    color: #374151;
}

/* Responsive toolbar */
.recipient-toolbar {
    flex-wrap: wrap;
    gap: 8px;
}

.pw-toolbar-img-wrap {
    flex-shrink: 0;
}

/* ── v6 editor layout overrides ──────────────────────────────────────── */
/* Scope under .pw-editor so these don't affect v2/v3 pages that share
   the same .canvas / .sidebar class names. */
.pathway-container.pw-editor {
    height: calc(100vh - 185px); /* laptop screens */
    min-height: 0;               /* override .pathway-container min-height:100vh */
    overflow: clip;
}

/* Larger screens / big monitors */
@media (min-width: 1600px) {
    .pathway-container.pw-editor {
        height: calc(100vh - 190px);
    }
}

.pw-editor .canvas {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: clip;
}

.pw-editor .toolbar {
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}

.pw-editor .sidebar {
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.pw-editor #sidebar-credentials-tab,
.pw-editor #sidebar-certificates-tab {
    height: 100%;
}

@media (max-width: 768px) {
    .pw-toolbar-img-wrap {
        display: none;
    }

    .recipient-toolbar > .d-flex {
        flex-wrap: wrap;
    }

    .pw-progress-bar-track {
        flex: 0 0 80px;
    }
    .pw-legend-hint {
        display: none;
    }
}

/* Target devices from compact laptops (13") up to oversized laptops (17"-18") */
@media screen and (min-width: 1024px) and (max-width: 1600px) {
  .pw-legend-hint {
        display: none;
    }
}
