/* ─── Debug Panel ─────────────────────────────────────────────────────────── */

.dbg-panel {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 300px;
    background: rgba(8, 8, 8, 0.97);
    border-right: 1px solid #222;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 220ms cubic-bezier(0.4, 0, 0.2, 1);
    font-family: ui-monospace, 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
    font-size: 11px;
    color: #ccc;
    backdrop-filter: blur(8px);
    box-shadow: 4px 0 24px rgba(0,0,0,0.6);
}

.dbg-panel.is-visible {
    transform: translateX(0);
}

/* ── Header ── */
.dbg-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    border-bottom: 1px solid #1e1e1e;
    flex-shrink: 0;
    background: rgba(255,255,255,0.02);
}

.dbg-title {
    flex: 1;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    letter-spacing: -0.01em;
}

.dbg-title kbd {
    font-family: inherit;
    font-size: 9px;
    background: #222;
    border: 1px solid #333;
    border-radius: 3px;
    padding: 1px 4px;
    color: #666;
    font-weight: 400;
    vertical-align: middle;
    margin-left: 4px;
}

.dbg-btn {
    background: none;
    border: 1px solid #2a2a2a;
    color: #555;
    border-radius: 4px;
    padding: 2px 8px;
    cursor: pointer;
    font-size: 10px;
    font-family: inherit;
    transition: color 120ms ease, border-color 120ms ease;
    line-height: 1.6;
}

.dbg-btn:hover {
    color: #ddd;
    border-color: #444;
}

/* ── Summary bar ── */
.dbg-summary {
    padding: 8px 12px;
    border-bottom: 1px solid #181818;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.dbg-sum-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dbg-sum-val {
    color: #fff;
    font-weight: 600;
}

.dbg-sum-cost {
    color: #f59e0b;
    font-weight: 600;
    margin-left: auto;
}

.dbg-err-badge {
    font-size: 9px;
    font-weight: 700;
    background: rgba(239,68,68,0.15);
    color: #f87171;
    border: 1px solid rgba(239,68,68,0.25);
    border-radius: 3px;
    padding: 1px 5px;
}

.dbg-muted {
    color: #3a3a3a;
}

/* ── Entry list ── */
.dbg-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #2a2a2a transparent;
}

.dbg-list::-webkit-scrollbar       { width: 4px; }
.dbg-list::-webkit-scrollbar-track { background: transparent; }
.dbg-list::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 2px; }

/* ── Single entry ── */
.dbg-entry {
    padding: 9px 12px;
    border-bottom: 1px solid #141414;
    transition: background 100ms ease;
}

.dbg-entry:hover {
    background: rgba(255,255,255,0.02);
}

.dbg-entry--error {
    background: rgba(239,68,68,0.05);
    border-left: 2px solid rgba(239,68,68,0.35);
    padding-left: 10px;
}

.dbg-entry-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 4px;
}

.dbg-entry-label {
    font-weight: 600;
    font-size: 11px;
    color: #e5e5e5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dbg-phase {
    font-weight: 400;
    color: #484848;
    font-size: 10px;
}

.dbg-entry-dur {
    font-size: 10px;
    color: #555;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Meta row ── */
.dbg-entry-meta {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: nowrap;
    overflow: hidden;
}

.dbg-tok {
    font-size: 10px;
    white-space: nowrap;
}

.dbg-tok--in  { color: #60a5fa; }
.dbg-tok--out { color: #34d399; }

.dbg-badge {
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: 3px;
    padding: 1px 4px;
    flex-shrink: 0;
}

.dbg-badge--img {
    background: rgba(139,92,246,0.15);
    color: #a78bfa;
    border: 1px solid rgba(139,92,246,0.25);
}

.dbg-model {
    font-size: 10px;
    color: #383838;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.dbg-cost {
    font-size: 10px;
    color: #d97706;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.dbg-error-msg {
    margin-top: 4px;
    font-size: 10px;
    color: #f87171;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
