/*mle-baked*/
/* ═══════════════════════════════════════════════════════════════
   MLE Billing Chat — Claude-style skin for the "MLE Billing" tab.
   Loaded AFTER billing_dashboard.css so it takes over the chat pane.
   Fully namespaced (.mle-bchat / .mle-bturn) — does NOT touch the
   WIP .mle-message styles in billing_dashboard.css. Reuses the
   billing dashboard's theme variables (--nable-cyan, --gray-*, …).
   ═══════════════════════════════════════════════════════════════ */

/* Chat card becomes the positioning context for the "Latest" pill. */
.mle-bchat { position: relative; }

/* Scroll column (id #mleChatMessages) — keep flex:1/overflow from the
   base .mle-chat-messages rule; override padding + layout here. */
.mle-bchat #mleChatMessages {
    padding: 20px 18px 8px;
    scroll-behavior: smooth;
    display: block;
}

/* ── Turns ─────────────────────────────────────────────────────── */
.mle-bturn { margin: 0 0 18px; max-width: 100%; }
.mle-bturn-user { display: flex; justify-content: flex-end; }

.mle-buser-bubble {
    background: linear-gradient(135deg, var(--nable-cyan) 0%, var(--nable-cyan-dark) 100%);
    color: #fff;
    padding: 9px 14px;
    border-radius: 14px 14px 4px 14px;
    max-width: 82%;
    font-size: 13.5px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0,180,220,0.25);
}

/* Assistant is full-width rendered markdown (no bubble). */
.mle-bbot-body {
    color: var(--gray-900);
    font-size: 13.5px;
    line-height: 1.6;
    word-wrap: break-word;
}
.mle-bturn-error .mle-bbot-body { color: var(--danger); }

/* ── Rendered markdown blocks ──────────────────────────────────── */
.mle-bbot-body p { margin: 0 0 10px; }
.mle-bbot-body p:last-child { margin-bottom: 0; }
.mle-bbot-body h1, .mle-bbot-body h2, .mle-bbot-body h3,
.mle-bbot-body h4, .mle-bbot-body h5, .mle-bbot-body h6 {
    margin: 14px 0 8px; line-height: 1.3; font-weight: 650; color: var(--gray-900);
}
.mle-bbot-body h1 { font-size: 18px; }
.mle-bbot-body h2 { font-size: 16px; }
.mle-bbot-body h3 { font-size: 14.5px; }
.mle-bbot-body h4, .mle-bbot-body h5, .mle-bbot-body h6 { font-size: 13.5px; }
.mle-bbot-body ul, .mle-bbot-body ol { margin: 4px 0 10px; padding-left: 22px; }
.mle-bbot-body li { margin: 3px 0; }
.mle-bbot-body li > ul, .mle-bbot-body li > ol { margin: 3px 0; }
.mle-bbot-body strong { font-weight: 650; color: var(--gray-900); }
.mle-bbot-body em { font-style: italic; }
.mle-bbot-body del { opacity: 0.7; }
.mle-bbot-body hr { border: none; border-top: 1px solid var(--gray-200); margin: 12px 0; }
.mle-bbot-body blockquote {
    margin: 8px 0; padding: 4px 12px;
    border-left: 3px solid var(--nable-cyan);
    background: var(--gray-50); color: var(--gray-700); border-radius: 0 6px 6px 0;
}

.mle-bbot-body code {
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    padding: 1px 5px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    color: #b5237a;
}

/* ── Links (module whitelist / OpenEMR tab nav) ────────────────── */
.mle-bbot-body a.mle-navlink {
    color: var(--nable-cyan-dark);
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 500;
    cursor: pointer;
}
.mle-bbot-body a.mle-navlink:hover { color: var(--primary); }

/* ── Tables ────────────────────────────────────────────────────── */
.mle-btable-wrap { overflow-x: auto; margin: 8px 0 12px; }
.mle-bbot-body table {
    border-collapse: collapse; width: 100%; font-size: 12.5px;
}
.mle-bbot-body th, .mle-bbot-body td {
    border: 1px solid var(--gray-200); padding: 6px 10px; text-align: left; vertical-align: top;
}
.mle-bbot-body th { background: var(--gray-50); font-weight: 600; color: var(--gray-700); }
.mle-bbot-body tbody tr:nth-child(even) { background: var(--gray-50); }

/* ── Fenced code blocks ────────────────────────────────────────── */
.mle-bcodeblock {
    margin: 10px 0; border-radius: 8px; overflow: hidden;
    border: 1px solid var(--gray-200); background: #0f172a;
}
.mle-bcodeblock-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 5px 10px; background: #1e293b; border-bottom: 1px solid #334155;
}
.mle-bcodeblock-lang { color: #94a3b8; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.mle-bcodeblock pre { margin: 0; padding: 12px; overflow-x: auto; }
.mle-bcodeblock pre code {
    background: none; border: none; padding: 0; color: #e2e8f0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px; line-height: 1.55;
}
.mle-bcode-copy {
    display: inline-flex; align-items: center; gap: 4px;
    background: transparent; border: 1px solid #334155; color: #cbd5e1;
    border-radius: 6px; padding: 3px 8px; font-size: 11px; cursor: pointer;
}
.mle-bcode-copy:hover { background: #334155; color: #fff; }
.mle-bcode-copy svg { width: 13px; height: 13px; }

/* ── Per-message actions (copy) ────────────────────────────────── */
.mle-bturn-actions {
    display: flex; align-items: center; gap: 10px;
    margin-top: 6px; opacity: 0; transition: opacity .15s;
}
.mle-bturn-bot:hover .mle-bturn-actions { opacity: 1; }
.mle-bmini-btn {
    display: inline-flex; align-items: center; gap: 4px;
    background: transparent; border: 1px solid var(--gray-200);
    color: var(--gray-500); border-radius: 6px; padding: 2px 8px;
    font-size: 11px; cursor: pointer;
}
.mle-bmini-btn:hover { background: var(--gray-50); color: var(--gray-700); border-color: var(--gray-500); }
.mle-bmini-btn svg { width: 13px; height: 13px; }
.mle-btimestamp { color: var(--gray-500); font-size: 11px; }

/* ── Thinking indicator ────────────────────────────────────────── */
.mle-bthinking { display: inline-flex; gap: 4px; align-items: center; padding: 4px 0; }
.mle-bthinking span {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--nable-cyan); display: inline-block;
    animation: mle-bthink 1.2s infinite ease-in-out both;
}
.mle-bthinking span:nth-child(2) { animation-delay: .15s; }
.mle-bthinking span:nth-child(3) { animation-delay: .3s; }
@keyframes mle-bthink {
    0%, 80%, 100% { transform: scale(0.6); opacity: .4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Streaming cursor kept for API parity (non-streaming endpoint: unused). */
.mle-bcursor {
    display: inline-block; width: 7px; height: 14px; vertical-align: text-bottom;
    background: var(--nable-cyan); margin-left: 2px; border-radius: 1px;
    animation: mle-bblink 1s steps(2) infinite;
}
@keyframes mle-bblink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }

/* ── Denial-Fighter / context cards (assistant-injected) ──────── */
.mle-bcard {
    background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 10px;
    padding: 12px 14px; margin: 0 0 18px; font-size: 12.5px; line-height: 1.6; color: var(--gray-700);
}
.mle-bcard-title { font-weight: 650; font-size: 13px; margin-bottom: 6px; color: var(--primary); }
.mle-bcard-carc {
    display: inline-block; background: #fef3c7; color: #92400e;
    padding: 1px 6px; border-radius: 4px; font-size: 11px; margin: 0 4px 2px 0;
}
.mle-bsys-note { text-align: center; color: var(--gray-500); font-size: 12px; margin: 0 0 14px; }
.mle-bsys-error { text-align: center; color: var(--danger); font-size: 12.5px; margin: 0 0 14px; }

/* ── Welcome ───────────────────────────────────────────────────── */
.mle-bchat-welcome { color: var(--gray-700); font-size: 13.5px; line-height: 1.6; }
.mle-bchat-welcome ul { margin: 8px 0 0 16px; padding: 0; }

/* Quick-action chips (both welcome and injected suggestions). */
.mle-bchips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.mle-bchip {
    background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 20px;
    padding: 6px 14px; font-size: 12px; color: var(--gray-700); cursor: pointer; transition: all .15s;
}
.mle-bchip:hover { background: var(--nable-cyan); color: #fff; border-color: var(--nable-cyan); }

/* ── "Latest" scroll pill ──────────────────────────────────────── */
.mle-bchat-pill {
    position: absolute; left: 50%; transform: translateX(-50%);
    bottom: 84px; z-index: 5;
    display: inline-flex; align-items: center; gap: 5px;
    background: var(--gray-900); color: #fff; border: none;
    padding: 6px 13px; border-radius: 18px; font-size: 12px; cursor: pointer;
    box-shadow: 0 3px 10px rgba(0,0,0,0.22);
    opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s;
}
.mle-bchat-pill.show { opacity: 1; pointer-events: auto; }
.mle-bchat-pill svg { width: 14px; height: 14px; }

/* ── Composer ──────────────────────────────────────────────────── */
.mle-bchat-composer {
    border-top: 1px solid var(--gray-200);
    padding: 10px 12px;
    display: flex; align-items: flex-end; gap: 8px;
    background: #fff;
}
.mle-bchat-composer.focused { box-shadow: inset 0 1px 0 var(--nable-cyan); }
#mleChatInput {
    flex: 1; resize: none; border: 1px solid var(--gray-200); border-radius: 12px;
    padding: 10px 14px; font-size: 14px; line-height: 1.45; font-family: inherit;
    max-height: 200px; min-height: 42px; overflow-y: auto; background: #fff; color: var(--gray-900);
}
#mleChatInput:focus { outline: none; border-color: var(--nable-cyan); box-shadow: 0 0 0 3px rgba(0,212,255,0.12); }
.mle-bsend {
    flex-shrink: 0; width: 42px; height: 42px; border-radius: 50%; border: none;
    background: linear-gradient(135deg, var(--nable-cyan) 0%, var(--nable-cyan-dark) 100%);
    color: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
    transition: transform .15s, box-shadow .15s;
}
.mle-bsend:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,212,255,0.35); }
.mle-bsend:disabled { opacity: 0.45; cursor: default; }
.mle-bsend.is-stop { background: var(--danger); }
.mle-bsend svg { width: 18px; height: 18px; }
