@layer base {
/**
 * chat-plan-pane.css — Guide-x
 * Right-side plan viewer pane that slides in when an inline pin-name chip
 * in a chat answer is clicked (or a multi-plan picker resolves). Layout
 * shifts on `body.gf-plan-pane-open`.
 *
 * Owns the inline `.gf-pin-link` chip styling (teal pill in chat bubbles)
 * and the multi-plan `.cpp-picker-overlay`. Theme tokens only — no
 * hard-coded colours beyond the canvas-drawn flame (which matches
 * plan-builder.js' canvas convention).
 */

/* ── Chip styling (reused by the picker overlay buttons) ── */
.cpp-chip {
    background: var(--bg-2);
    border: 1px solid var(--border);
    color: var(--ink);
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
    padding: 5px 12px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.cpp-chip:hover {
    background: var(--hover);
    border-color: var(--ink-3);
}
.cpp-chip.active {
    background: var(--flame);
    color: #fff;
    border-color: var(--flame);
}

/* ── Side panel (the right half when open) ── */
.chat-plan-panel {
    display: none;   /* gf-plan-pane-open flips the body grid to show this */
    background: var(--bg);
    border-left: 1px solid var(--border);
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}
.chat-plan-panel.open {
    display: flex;
}

.cpp-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-2);
    flex-shrink: 0;
}
.cpp-title {
    flex: 1;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: 0.3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cpp-close {
    background: transparent;
    border: 1px solid transparent;
    color: var(--ink-3);
    width: 26px;
    height: 26px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    font-family: inherit;
}
.cpp-close:hover {
    color: var(--ink);
    background: var(--hover);
    border-color: var(--border);
}

.cpp-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: var(--bg-2);
    border-bottom: 1px solid var(--hover);
    flex-shrink: 0;
}
.cpp-toolbar-spacer { flex: 1; }
.cpp-tool-btn {
    background: var(--hover);
    border: 1px solid var(--border);
    color: var(--ink-2);
    padding: 4px 9px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.cpp-tool-btn:hover {
    color: var(--ink);
    border-color: var(--ink-3);
    background: var(--border);
}
.cpp-zoom-segment {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 5px;
    overflow: hidden;
    background: var(--bg-2);
}
.cpp-zoom-segment .cpp-tool-btn {
    border: none;
    border-radius: 0;
    background: transparent;
    padding: 4px 9px;
}
.cpp-zoom-segment .cpp-tool-btn:hover {
    background: var(--hover);
}
.cpp-zoom-label {
    font-size: 10px;
    color: var(--ink-3);
    min-width: 40px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    line-height: 22px;
    padding: 0 6px;
}

.cpp-canvas-wrap {
    flex: 1;
    position: relative;
    background: var(--white);
    overflow: hidden;
    min-height: 0;
    min-width: 0;
    cursor: default;
}
.cpp-canvas-wrap canvas {
    position: absolute;
    top: 0;
    left: 0;
}
.cpp-canvas-wrap.panning { cursor: grabbing; }

/* ── Layout shift when the pane is open ──
   When body.gf-plan-pane-open is set, the .main flex split puts .chat-area
   and .chat-plan-panel side-by-side to the right of the (already-collapsed)
   sidebar. The sidebar is forced collapsed by the JS that opens the panel;
   the existing .gf-sidebar-collapsed rules in topbar.css / sidebar.css still
   apply, so .main itself needs no rule here — only the children resize. */
body.gf-plan-pane-open .chat-area {
    flex: 1 1 50%;
    min-width: 0;
}
body.gf-plan-pane-open .chat-plan-panel {
    flex: 1 1 50%;
    min-width: 0;
}
/* NOTE: the live three-pane sizing (chat 35vw | plan 32.5vw |
   standard 32.5vw) is done via the .app CSS grid in
   guide-x-adapter.css + the --gf-source-w var in source-citations.css.
   These flex rules are inert under that grid layout and kept only for the
   legacy non-grid fallback. */

/* ── Inline pin-name chip in chat answers ── */
/* Same pill shape as the orange citation chips, blue/teal family so the
   user reads "open guidance source" (orange) vs "show me on the plan"
   (teal) at a glance. */
.gf-pin-link {
    display: inline-block;
    background: rgba(58, 167, 194, 0.16);
    color: #4cc7e6;
    border: 1px solid rgba(58, 167, 194, 0.36);
    border-radius: 4px;
    padding: 1px 6px;
    margin: 0 1px;
    font-size: 0.82em;
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
    user-select: none;
    transition: background 0.1s, border-color 0.1s, color 0.1s, transform 0.05s;
    vertical-align: baseline;
    text-decoration: none;
}
.gf-pin-link:hover {
    background: rgba(58, 167, 194, 0.28);
    border-color: rgba(58, 167, 194, 0.6);
    color: #7cdcf2;
}
.gf-pin-link:active { transform: translateY(1px); }

/* ── Picker overlay (multi-plan disambiguation) ──
   Sits over the (empty) canvases inside .cpp-canvas-wrap when a pin name
   matches in 2+ plans. User picks one → overlay is removed and the chosen
   plan loads + zooms + pulses. */
.cpp-picker-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 24px;
    text-align: center;
}
.cpp-picker-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-2);
    letter-spacing: 0.2px;
    max-width: 80%;
    line-height: 1.4;
}
.cpp-picker-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    max-width: 90%;
}
.cpp-picker-button {
    /* Inherits .cpp-chip styling. Only overrides a couple of dimensions
       so the buttons read as a primary picker action rather than a compact
       chip — slightly more padding, slightly larger text. */
    padding: 8px 18px;
    font-size: 12px;
}