.odi-cw-root {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 74;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--odi-text, #0F172A);
    /* Şeffaf kök, altındaki içerik/butonların tıklamasını yutmasın. */
    pointer-events: none;
}
.odi-cw-root * { box-sizing: border-box; }
.odi-cw-fab, .odi-cw-panel { pointer-events: auto; }
.odi-cw-fab {
    position: relative;
    width: 50px;
    min-width: 50px;
    height: 50px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--odi-primary, #1F5FAE), var(--odi-accent, #00d2d3));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 18px 42px -18px rgba(31, 95, 174, .60), 0 8px 20px -14px rgba(10, 26, 43, .50);
    cursor: grab;
    touch-action: none;
    user-select: none;
    font: inherit;
    font-weight: 900;
    transition: transform .18s ease, box-shadow .18s ease;
}
.odi-cw-fab:hover { transform: translateY(-2px); box-shadow: 0 22px 50px -18px rgba(31, 95, 174, .70); }
.odi-cw-root.dragging .odi-cw-fab { cursor: grabbing; transform: scale(.97); transition: none; }
.odi-cw-fab i { font-size: 19px; }
.odi-cw-fab > span {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}
.odi-cw-fab small {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 21px;
    height: 21px;
    padding: 0 5px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    background: var(--odi-primary-dark, #174a8a);
    color: #fff;
    font-size: 11px;
    font-weight: 900;
}
.odi-cw-panel {
    position: absolute;
    right: 0;
    bottom: 64px;
    width: min(390px, calc(100vw - 28px));
    height: min(620px, var(--odi-cw-panel-max-height, calc(100vh - 106px)));
    display: none;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
    border: 1px solid rgba(226, 232, 240, .96);
    border-radius: 20px;
    background: rgba(255,255,255,.98);
    box-shadow: 0 26px 74px -30px rgba(10, 26, 43, .42), 0 10px 28px -22px rgba(31, 95, 174, .45);
}
.odi-cw-root.dock-left .odi-cw-panel { left: 0; right: auto; }
.odi-cw-root.open-down .odi-cw-panel { top: 62px; bottom: auto; }
.odi-cw-root.open .odi-cw-panel { display: grid; }
.odi-cw-head {
    min-height: 68px;
    padding: 14px 15px;
    background:
        linear-gradient(135deg, rgba(31,95,174,.10), rgba(0,210,211,.10)),
        #fff;
    border-bottom: 1px solid var(--odi-border, #E2E8F0);
    display: flex;
    align-items: center;
    gap: 12px;
}
.odi-cw-avatar {
    width: 38px;
    height: 38px;
    border-radius: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--odi-primary, #1F5FAE), var(--odi-accent, #00d2d3));
    color: #fff;
    box-shadow: 0 10px 24px -14px rgba(31,95,174,.7);
    flex: 0 0 auto;
}
.odi-cw-title { min-width: 0; flex: 1; }
.odi-cw-title b {
    display: block;
    color: var(--odi-navy, #0A1A2B);
    font-size: 14px;
    font-weight: 900;
    line-height: 1.2;
}
.odi-cw-title span {
    display: block;
    color: var(--odi-text-soft, #64748b);
    font-size: 11.5px;
    font-weight: 700;
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.odi-cw-close,
.odi-cw-move {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid var(--odi-border, #E2E8F0);
    background: #fff;
    color: var(--odi-text-soft, #64748b);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.odi-cw-close:hover,
.odi-cw-move:hover { color: var(--odi-primary, #1F5FAE); border-color: rgba(31,95,174,.24); }
.odi-cw-messages {
    overflow-y: auto;
    padding: 16px;
    background:
        linear-gradient(180deg, rgba(248,250,252,.82), rgba(255,255,255,.96));
}
.odi-cw-empty,
.odi-cw-msg {
    animation: odiCwFade .18s ease both;
}
@keyframes odiCwFade { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.odi-cw-empty {
    display: grid;
    gap: 8px;
    padding: 14px;
    border: 1px solid var(--odi-border, #E2E8F0);
    border-radius: 14px;
    background: #fff;
    color: var(--odi-text-soft, #64748b);
    font-size: 13px;
    line-height: 1.45;
}
.odi-cw-empty b { color: var(--odi-navy, #0A1A2B); font-size: 14px; }
.odi-cw-msg {
    max-width: 86%;
    margin: 0 0 10px;
    padding: 10px 12px;
    border-radius: 15px;
    font-size: 13px;
    line-height: 1.48;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.odi-cw-msg.user {
    margin-left: auto;
    background: linear-gradient(135deg, var(--odi-primary, #1F5FAE), var(--odi-primary-dark, #174a8a));
    color: #fff;
    border-bottom-right-radius: 6px;
}
.odi-cw-msg.assistant {
    margin-right: auto;
    background: #fff;
    color: var(--odi-text, #0F172A);
    border: 1px solid var(--odi-border, #E2E8F0);
    border-bottom-left-radius: 6px;
}
.odi-cw-msg.error {
    border-color: rgba(239,68,68,.28);
    background: var(--odi-danger-bg, #FEF2F2);
    color: #991B1B;
}
.odi-cw-typing {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}
.odi-cw-typing i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--odi-primary, #1F5FAE);
    opacity: .45;
    animation: odiCwDot 1s infinite ease-in-out;
}
.odi-cw-typing i:nth-child(2) { animation-delay: .16s; }
.odi-cw-typing i:nth-child(3) { animation-delay: .32s; }
@keyframes odiCwDot { 0%, 80%, 100% { transform: translateY(0); opacity: .35; } 40% { transform: translateY(-4px); opacity: .9; } }
.odi-cw-foot {
    border-top: 1px solid var(--odi-border, #E2E8F0);
    background: #fff;
    padding: 12px;
    display: grid;
    gap: 9px;
}
.odi-cw-quota {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--odi-text-soft, #64748b);
    font-size: 11.5px;
    font-weight: 800;
}
.odi-cw-quota-bar {
    height: 6px;
    flex: 1;
    border-radius: 999px;
    background: #EAF1F8;
    overflow: hidden;
}
.odi-cw-quota-bar i {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--odi-primary, #1F5FAE), var(--odi-accent, #00d2d3));
}
.odi-cw-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px;
    gap: 8px;
    align-items: end;
}
.odi-cw-input {
    min-height: 42px;
    max-height: 120px;
    resize: none;
    border: 1px solid var(--odi-border, #E2E8F0);
    border-radius: 13px;
    padding: 10px 12px;
    color: var(--odi-text, #0F172A);
    background: #fff;
    font: inherit;
    font-size: 13px;
    line-height: 1.45;
    outline: none;
}
.odi-cw-input:focus { border-color: rgba(31,95,174,.45); box-shadow: 0 0 0 3px rgba(31,95,174,.10); }
.odi-cw-send {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    border: 0;
    background: var(--odi-primary, #1F5FAE);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 22px -14px rgba(31,95,174,.75);
}
.odi-cw-send:disabled,
.odi-cw-input:disabled {
    opacity: .55;
    cursor: not-allowed;
}
/* ── Asistan mesajı: markdown içerik + kopyala butonu ── */
.odi-cw-msg.assistant { display: flex; flex-direction: column; }
.odi-md { white-space: normal; font-size: 13px; line-height: 1.5; }
.odi-md > *:first-child { margin-top: 0; }
.odi-md > *:last-child { margin-bottom: 0; }
.odi-md p { margin: 0 0 8px; }
.odi-md strong { font-weight: 800; color: var(--odi-navy, #0A1A2B); }
.odi-md em { font-style: italic; }
.odi-md code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px; background: #EEF2F7; padding: 1px 5px; border-radius: 5px;
}
.odi-md a {
    color: var(--odi-primary, #1F5FAE); text-decoration: underline;
    font-weight: 700; overflow-wrap: anywhere;
}
.odi-md a.odi-md-tab { text-decoration: none; background: #EEF4FB; border-radius: 6px; padding: 0 5px; white-space: nowrap; }
.odi-md a.odi-md-tab:hover { background: #DCEAF8; }
.odi-md-list { margin: 0 0 8px; padding-left: 20px; }
.odi-md-list li { margin: 0 0 3px; }
.odi-md-h { font-weight: 900; color: var(--odi-navy, #0A1A2B); font-size: 13.5px; margin: 6px 0; }
.odi-md-hr { height: 1px; background: var(--odi-border, #E2E8F0); margin: 9px 0; }
.odi-md-tablewrap { overflow-x: auto; margin: 0 0 8px; }
.odi-md-table { border-collapse: collapse; width: 100%; font-size: 12px; }
.odi-md-table th, .odi-md-table td {
    border: 1px solid var(--odi-border, #E2E8F0); padding: 5px 8px; text-align: left;
}
.odi-md-table th { background: #F1F5F9; font-weight: 800; }
.odi-cw-copy {
    align-self: flex-end;
    margin-top: 7px;
    width: 28px; height: 26px;
    border: 1px solid var(--odi-border, #E2E8F0);
    border-radius: 8px;
    background: #fff;
    color: var(--odi-text-soft, #64748b);
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 12px;
    transition: color .15s, border-color .15s, background .15s;
}
.odi-cw-copy:hover { color: var(--odi-primary, #1F5FAE); border-color: rgba(31,95,174,.30); }
.odi-cw-copy.copied { color: #16A34A; border-color: rgba(22,163,74,.35); background: #F0FDF4; }
/* Başlangıç çipleri */
.odi-cw-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.odi-cw-chip {
    border: 1px solid var(--odi-border, #E2E8F0);
    background: #fff; color: var(--odi-navy, #0A1A2B);
    border-radius: 999px; padding: 7px 12px;
    font: inherit; font-size: 12px; font-weight: 700;
    cursor: pointer; transition: border-color .15s, background .15s, transform .12s;
}
.odi-cw-chip:hover { border-color: rgba(31,95,174,.35); background: #F5F9FE; transform: translateY(-1px); }
/* Hata: tekrar-dene */
.odi-cw-retry {
    align-self: flex-start; margin-top: 8px;
    border: 1px solid rgba(239,68,68,.30); background: #fff; color: #B91C1C;
    border-radius: 9px; padding: 5px 10px;
    font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
    display: inline-flex; align-items: center; gap: 5px;
}
.odi-cw-retry:hover { background: #FEF2F2; }
/* Streaming: akan düz metin + yanıp sönen imleç */
.odi-cw-stream { white-space: pre-wrap; overflow-wrap: anywhere; }
.odi-cw-cursor {
    display: inline-block; width: 7px; height: 14px; margin-left: 2px;
    vertical-align: -2px; border-radius: 1px;
    background: var(--odi-primary, #1F5FAE);
    animation: odiCwBlink 1s steps(1) infinite;
}
@keyframes odiCwBlink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }

@media (max-width: 540px) {
    .odi-cw-root {
        right: 12px;
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }
    .odi-cw-panel {
        position: fixed;
        left: 12px !important;
        right: 12px !important;
        top: auto !important;
        bottom: calc(74px + env(safe-area-inset-bottom, 0px));
        width: auto;
        height: min(610px, calc(100dvh - 158px - env(safe-area-inset-bottom, 0px)));
        border-radius: 18px;
    }
    .odi-cw-fab {
        width: 48px;
        min-width: 48px;
        height: 48px;
    }
    .odi-cw-head { padding: 12px; gap: 9px; }
    .odi-cw-avatar { width: 36px; height: 36px; }
}

@media (prefers-reduced-motion: reduce) {
    .odi-cw-fab,
    .odi-cw-empty,
    .odi-cw-msg { transition: none; animation: none; }
}
