﻿/* ══════════════════════════════════════════════════════════════
   KChat / SmartChat — Global Stylesheet
   Place in: wwwroot/css/ai/style.css
   Reference in App.razor or _Host.cshtml as:
   <link rel="stylesheet" href="css/ai/style.css" />
    
    @import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');


══════════════════════════════════════════════════════════════ */


/* ── Reset ── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}


/* ── CSS Variables ── */
:root {
    --primary: #0378d5;
    --primary-hover: #0265b3;
    --primary-light: #e8f3fd;
    --primary-mid: #bad7f5;
    --primary-glow: rgba(3,120,213,0.13);
    --bg: #f4f6f9;
    --surface: #ffffff;
    --surface2: #eef1f6;
    --border: #dde3ec;
    --border-active: rgba(3,120,213,0.45);
    --text: #0d1b2a;
    --text2: #3a4f66;
    --muted: #8496aa;
    --shadow-sm: 0 1px 4px rgba(13,27,42,0.07);
    --shadow-md: 0 4px 20px rgba(13,27,42,0.10);
    --shadow-blue: 0 6px 28px rgba(3,120,213,0.18);
}

/* ── Base ── */
html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: 'Sora', sans-serif;
    /* overflow: hidden; */
}

/* ── Animations ── */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes tb {
    0%, 60%, 100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}


/* ════════════════════════════════════════════════════════════
   LAYOUT  (SmartChat.razor)
════════════════════════════════════════════════════════════ */

.app {
    display: flex;
    height: 100vh;
}

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg);
}

/* Overlay */
.overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
}

    .overlay.on {
        display: block;
    }

/* ── Topbar ── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 24px;
    background: transparent; /* removed white */
    backdrop-filter: none; /* optional remove blur */
    position: sticky; /* keeps it fixed */
    top: 0;
    z-index: 50;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Model pill */
.model-wrap {
    position: relative;
}

.model-pill {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 13px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 22px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    transition: all .18s;
}

    .model-pill:hover {
        border-color: var(--border-active);
        background: var(--primary-light);
    }

    .model-pill.open {
        border-color: var(--primary);
        background: var(--primary-light);
        box-shadow: 0 0 0 3px var(--primary-glow);
    }

.m-dot {
    width: 7px;
    height: 7px;
    background: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 5px #22c55e44;
}

.m-arrow {
    font-size: 9px;
    opacity: .5;
    transition: transform .2s;
}

.model-pill.open .m-arrow {
    transform: rotate(180deg);
}

/* Model dropdown */
.drop-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 230px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 13px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    z-index: 100;
    opacity: 0;
    transform: translateY(-6px) scale(.97);
    pointer-events: none;
    transition: all .18s cubic-bezier(.34,1.56,.64,1);
}

    .drop-menu.show {
        opacity: 1;
        transform: translateY(0) scale(1);
        pointer-events: all;
    }

.drop-head {
    padding: 9px 14px 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--muted);
}

.drop-item {
    padding: 9px 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: background .12s;
    font-size: 13px;
}

    .drop-item:hover {
        background: var(--primary-light);
    }

    .drop-item.sel {
        background: var(--primary-light);
        color: var(--primary);
        font-weight: 500;
    }

.di-ico {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}

.di-n {
    font-weight: 500;
    font-size: 13px;
}

.di-t {
    font-size: 10.5px;
    color: var(--muted);
    margin-top: 1px;
}

.drop-sep {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

/* Icon buttons */
.icon-btn {
    width: 34px;
    height: 34px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .15s;
    color: var(--text2);
}

    .icon-btn:hover {
        border-color: var(--border-active);
        background: var(--primary-light);
        color: var(--primary);
    }

    .icon-btn.gear-active {
        border-color: var(--primary);
        background: var(--primary-light);
        color: var(--primary);
    }

/* ── Messages area ── */
.messages-area {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    scroll-behavior: smooth;
    padding: 24px 0 20px; 
}

    .messages-area::-webkit-scrollbar {
        width: 5px;
    }

    .messages-area::-webkit-scrollbar-thumb {
        background: var(--border);
        border-radius: 4px;
    }

/* Messages list */
.msgs-list {
    display: none;
    flex-direction: column;
    padding: 24px 0 6px;
}

    .msgs-list.on {
        display: flex;
    }

/* Bottom input zone */
.bottom-zone {
    padding: 0 24px 55px;
    background: var(--bg); /* same as page */
    position: relative;
    z-index: 100;
}

.bottom-inner {
    max-width: 820px;
    margin: 0 auto;
    display: none;
}

    .bottom-inner.on {
        display: block;
    }

/* Security bar */
.sec-bar {
    display: flex;
    justify-content: center;
    gap: 18px;
    padding: 7px 0 0;
}

.sec-b {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: var(--muted);
}


/* ════════════════════════════════════════════════════════════
   WELCOME SCREEN  (WelcomeScreen.razor)
════════════════════════════════════════════════════════════ */

.center-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 20px 10px;
    animation: fadeUp .4s ease both;
}

    .center-wrap.gone {
        display: none;
    }

.w-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: 20px;
    background: var(--primary-light);
    border: 1px solid var(--primary-mid);
    font-size: 11.5px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 18px;
}

.welcome h1 {
    font-size: 38px;
    font-weight: 700;
    letter-spacing: -1.2px;
    text-align: center;
    margin-bottom: 10px;
}

    .welcome h1 span {
        color: var(--primary);
    }

.welcome p {
    font-size: 14.5px;
    color: var(--muted);
    max-width: 400px;
    text-align: center;
    line-height: 1.65;
    margin-bottom: 28px;
}

.suggestions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
    max-width: 530px;
    width: 100%;
    margin-bottom: 28px;
}

.s-card {
    padding: 13px 15px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 13px;
    cursor: pointer;
    transition: all .2s;
}

    .s-card:hover {
        border-color: var(--primary);
        box-shadow: 0 4px 18px var(--primary-glow);
        transform: translateY(-2px);
    }

.sc-ico {
    font-size: 19px;
    margin-bottom: 6px;
}

.sc-tit {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}

.sc-dsc {
    font-size: 11.5px;
    color: var(--muted);
}

.c-input-wrap {
    width: 100%;
    max-width: 620px;
    margin-top: 20px;
}


/* ════════════════════════════════════════════════════════════
   MESSAGE  (Message.razor)
════════════════════════════════════════════════════════════ */

.msg-row {
    display: flex;
    padding: 5px 28px;
    gap: 11px;
    animation: fadeUp .25s ease both;
    max-width: 820px;
    margin: 0 auto;
    width: 100%;
}

    .msg-row.user {
        flex-direction: row-reverse;
    }

.m-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    margin-top: 5px;
}

    .m-avatar.ai-av {
        background: var(--primary-light);
        border: 1.5px solid var(--primary-mid);
        font-size: 14px;
    }

    .m-avatar.u-av {
        background: var(--primary);
        color: white;
    }

.m-cnt {
    max-width: 74%;
    display: flex;
    flex-direction: column;
}

.msg-row.user .m-cnt {
    align-items: flex-end;
}

.m-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.65;
}

    .m-bubble p {
        margin: 6px 0;
    }

    .m-bubble pre {
        background: #1e1e1e;
        color: #fff;
        padding: 10px;
        border-radius: 6px;
        overflow-x: auto;
    }

    .m-bubble code {
        background: #eee;
        padding: 2px 4px;
        border-radius: 4px;
    }

    .m-bubble ul {
        padding-left: 18px;
    }
    .m-bubble ol {
        padding-left: 18px;
    }

.msg-row.user .m-bubble {
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 14px rgba(3,120,213,.28);
}

.msg-row.ai .m-bubble {
    background: var(--surface);
    border: 1.5px solid var(--border);
    color: var(--text);
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-sm);
}

.m-bubble code {
    font-family: 'JetBrains Mono', monospace;
    background: rgba(3,120,213,.09);
    color: var(--primary-hover);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12.5px;
}

.msg-row.user .m-bubble code {
    background: rgba(255,255,255,.2);
    color: white;
}

.m-time {
    font-size: 10px;
    color: var(--muted);
    margin-top: 4px;
    padding: 0 3px;
}

/* Latency + Model meta badges */
.m-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 5px;
    padding: 0 3px;
    flex-wrap: wrap;
}

.m-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-family: 'JetBrains Mono', monospace;
    padding: 2px 7px;
    border-radius: 5px;
    border: 1px solid var(--border);
    color: var(--muted);
    background: var(--surface2);
}

    .m-badge.latency {
        color: #22c55e;
        border-color: #bbf7d0;
        background: #f0fdf4;
    }

    .m-badge.model {
        color: var(--primary);
        border-color: var(--primary-mid);
        background: var(--primary-light);
    }

/* Typing indicator */
.t-ind {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 3px 0;
}

    .t-ind span {
        width: 6px;
        height: 6px;
        background: var(--primary);
        border-radius: 50%;
        animation: tb 1.2s infinite;
        opacity: .5;
    }

        .t-ind span:nth-child(2) {
            animation-delay: .2s;
        }

        .t-ind span:nth-child(3) {
            animation-delay: .4s;
        }

/* Badge that triggers expand/collapse */
.m-badge.chunks-toggle {
    cursor: pointer;
    color: #7c3aed;
    border-color: #ddd6fe;
    background: #f5f3ff;
    user-select: none;
    transition: background .15s, border-color .15s;
}

    .m-badge.chunks-toggle:hover {
        background: #ede9fe;
        border-color: #c4b5fd;
    }

    /* Chevron icon rotates when open */
    .m-badge.chunks-toggle .chevron {
        transition: transform .2s ease;
    }

        .m-badge.chunks-toggle .chevron.open {
            transform: rotate(180deg);
        }

/* Panel container */
.chunks-panel {
    margin-top: 8px;
    border: 1.5px solid #ddd6fe;
    border-radius: 10px;
    background: #faf9ff;
    overflow: hidden;
    font-size: 12px;
}

/* Panel header row */
.chunks-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    background: #ede9fe;
    color: #6d28d9;
    font-weight: 600;
    font-size: 11px;
    letter-spacing: .03em;
    text-transform: uppercase;
    border-bottom: 1px solid #ddd6fe;
}

/* Individual chunk card */
.chunk-item {
    padding: 10px 12px;
    border-bottom: 1px solid #ede9fe;
}

    .chunk-item:last-child {
        border-bottom: none;
    }

/* Top row: index + source + fusion + scores */
.chunk-top {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}

/* Chunk index badge */
.chunk-index {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    color: #7c3aed;
    background: #ede9fe;
    border-radius: 4px;
    padding: 1px 5px;
    min-width: 22px;
    text-align: center;
}

/* Source label */
.chunk-source {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--primary, #0378d5);
    background: var(--primary-light, #e8f2fd);
    border: 1px solid var(--primary-mid, #bfdbfe);
    border-radius: 4px;
    padding: 1px 6px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Fusion strategy pill */
.chunk-fusion {
    font-size: 10px;
    font-family: 'JetBrains Mono', monospace;
    color: #0369a1;
    background: #e0f2fe;
    border: 1px solid #bae6fd;
    border-radius: 4px;
    padding: 1px 6px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* Score pills group */
.chunk-scores {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.score-pill {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid transparent;
}

    .score-pill.semantic {
        color: #0891b2;
        background: #ecfeff;
        border-color: #a5f3fc;
    }

    .score-pill.keyword {
        color: #d97706;
        background: #fffbeb;
        border-color: #fde68a;
    }

    .score-pill.final {
        color: #16a34a;
        background: #f0fdf4;
        border-color: #bbf7d0;
    }

/* Chunk text body */
.chunk-text {
    font-size: 12px;
    line-height: 1.6;
    color: var(--text, #374151);
    background: white;
    border: 1px solid #ede9fe;
    border-radius: 6px;
    padding: 8px 10px;
    white-space: pre-wrap;
    word-break: break-word;
}


/* Thinking badge */
.m-badge.thinking-toggle {
    cursor: pointer;
    color: #f59e0b;
    border-color: #fde68a;
    background: #fffbeb;
    user-select: none;
    transition: background .15s, border-color .15s;
}

    .m-badge.thinking-toggle:hover {
        background: #fef3c7;
        border-color: #fcd34d;
    }

/* Chevron animation (reuse your existing one) */
.m-badge .chevron {
    transition: transform .2s ease;
}

    .m-badge .chevron.open {
        transform: rotate(180deg);
    }

/* Thinking panel */
.thinking-panel {
    margin-top: 8px;
    border: 1.5px solid #fde68a;
    border-radius: 10px;
    background: #fffbeb;
    overflow: hidden;
    font-size: 12px;
}

/* Header */
.thinking-header {
    padding: 7px 12px;
    background: #fef3c7;
    color: #92400e;
    font-weight: 600;
    font-size: 11px;
    letter-spacing: .03em;
    text-transform: uppercase;
    border-bottom: 1px solid #fde68a;
}

/* Body */
.thinking-text {
    padding: 10px 12px;
    line-height: 1.6;
    color: #78350f;
    white-space: pre-wrap;
    word-break: break-word;
}



/* ════════════════════════════════════════════════════════════
   INPUT BOX  (InputBox.razor)
════════════════════════════════════════════════════════════ */

.ibox {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 16px;
    padding: 13px 15px;
    box-shadow: var(--shadow-sm);
    transition: border-color .2s, box-shadow .2s;
}

    .ibox:focus-within {
        border-color: var(--primary);
        box-shadow: 0 0 0 3px var(--primary-glow), var(--shadow-md);
    }

    .ibox textarea {
        width: 100%;
        background: transparent;
        border: none;
        outline: none;
        color: var(--text);
        font-family: 'Sora', sans-serif;
        font-size: 14.5px;
        resize: none;
        min-height: unset; /* remove fixed min */
        max-height: unset; /* remove fixed max — JS handles the 5-line cap */
        line-height: 1.6;
        overflow-y: hidden; /* JS toggles this */
    }

        .ibox textarea::placeholder {
            color: var(--muted);
        }

.i-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
}

.i-tools {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.i-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.c-cnt {
    font-size: 11px;
    color: var(--muted);
}

/* Tool buttons */
.t-btn {
    padding: 5px 11px;
    background: transparent;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    color: var(--text2);
    font-family: 'Sora', sans-serif;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all .15s;
    white-space: nowrap;
}

    .t-btn:hover {
        border-color: var(--primary);
        color: var(--primary);
        background: var(--primary-light);
    }

    .t-btn.on {
        border-color: var(--primary);
        color: var(--primary);
        background: var(--primary-light);
    }

/* Tools dropdown */
.t-wrap {
    position: relative;
    display: inline-flex;
}

.tools-drop {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    min-width: 210px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 13px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    z-index: 2000;
    opacity: 0;
    transform: translateY(6px) scale(.97);
    pointer-events: none;
    transition: all .18s cubic-bezier(.34,1.56,.64,1);
}

    .tools-drop.show {
        opacity: 1;
        transform: translateY(0) scale(1);
        pointer-events: all;
    }

.to-item {
    padding: 9px 13px;
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text2);
    transition: background .12s;
}

    .to-item:hover {
        background: var(--primary-light);
        color: var(--primary);
    }

    .to-item.on {
        color: var(--primary);
        font-weight: 500;
    }

.to-chk {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1.5px solid var(--border);
    margin-left: auto;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .15s;
}

.to-item.on .to-chk {
    background: var(--primary);
    border-color: var(--primary);
}

    .to-item.on .to-chk::after {
        content: '✓';
        font-size: 10px;
        color: white;
        font-weight: 700;
    }

/* Send button */
.s-btn {
    width: 36px;
    height: 36px;
    background: var(--border);
    border: none;
    border-radius: 10px;
    color: var(--muted);
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s;
}

    .s-btn.ready {
        background: var(--primary);
        color: white;
        box-shadow: 0 4px 12px rgba(3,120,213,.4);
    }

        .s-btn.ready:hover {
            background: var(--primary-hover);
            transform: scale(1.06);
        }




/* ════════════════════════════════════════════════════════════
   TOGGLE ROW  (ToggleRow.razor)
════════════════════════════════════════════════════════════ */

.param-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

    .param-toggle:last-child {
        border-bottom: none;
    }

.pt-info .pt-name {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
}

.pt-info .pt-desc {
    font-size: 10.5px;
    color: var(--muted);
    margin-top: 1px;
}

/* Toggle switch — shared by ToggleRow + RAG sources + RAG master */
.sw {
    width: 36px;
    height: 20px;
    background: var(--border);
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    transition: background .2s;
    flex-shrink: 0;
}

    .sw.on {
        background: var(--primary);
    }

    .sw::after {
        content: '';
        position: absolute;
        top: 2px;
        left: 2px;
        width: 16px;
        height: 16px;
        background: white;
        border-radius: 50%;
        transition: transform .2s cubic-bezier(.4,0,.2,1);
        box-shadow: 0 1px 3px rgba(0,0,0,.15);
    }

    .sw.on::after {
        transform: translateX(16px);
    }

    /* Locked toggle (End-to-End Encryption) */
    .sw.locked {
        pointer-events: none;
        background: #22c55e;
    }

        .sw.locked::after {
            transform: translateX(16px);
        }

/* Disabled state */
.param-toggle.pt-disabled {
    opacity: 0.45;
    pointer-events: none;
}

    .param-toggle.pt-disabled .pt-name {
        color: var(--muted);
    }

.sw.disabled {
    cursor: not-allowed;
    background: var(--border);
}

    .sw.disabled.on {
        background: color-mix(in srgb, var(--primary) 40%, var(--border));
    }

    .sw.disabled::after {
        background: #e5e7eb;
        box-shadow: none;
    }


/* ════════════════════════════════════════════════════════════
   SLIDER ROW  (SliderRow.razor)
════════════════════════════════════════════════════════════ */

.param-row {
    margin-bottom: 16px;
}

.param-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 7px;
    gap: 8px;
}

.param-name {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

.param-desc {
    font-size: 10.5px;
    color: var(--muted);
    margin-top: 2px;
    line-height: 1.4;
}

.param-val {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-light);
    padding: 2px 9px;
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    min-width: 48px;
    text-align: center;
    flex-shrink: 0;
}

.param-tag {
    font-size: 9px;
    font-weight: 700;
    background: var(--primary-light);
    color: var(--primary);
    padding: 1px 6px;
    border-radius: 4px;
    letter-spacing: .3px;
    margin-left: 4px;
    font-family: 'JetBrains Mono', monospace;
}

/* ── Disabled state ── */
.param-disabled {
    opacity: 0.45;
    pointer-events: none;
}

    .param-disabled .param-name,
    .param-disabled .param-val {
        color: var(--muted);
    }

    .param-disabled .param-val {
        background: var(--border);
    }

/* Range slider track */
.sp-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: linear-gradient(to right, var(--primary) var(--pct, 50%), var(--border) var(--pct, 50%));
    border-radius: 999px;
    outline: none;
    cursor: pointer;
    transition: opacity .2s;
}

    .sp-range:disabled {
        cursor: not-allowed;
        background: var(--border);
    }
    /* Thumb */
    .sp-range::-webkit-slider-thumb {
        -webkit-appearance: none;
        width: 16px;
        height: 16px;
        background: var(--primary);
        border-radius: 50%;
        box-shadow: 0 2px 6px rgba(3,120,213,.4);
        border: 2.5px solid white;
        cursor: pointer;
        transition: transform .15s;
    }

        .sp-range::-webkit-slider-thumb:hover {
            transform: scale(1.25);
        }

    .sp-range:disabled::-webkit-slider-thumb {
        background: var(--muted);
        box-shadow: none;
        cursor: not-allowed;
        transform: none;
    }

    .sp-range::-moz-range-thumb {
        width: 16px;
        height: 16px;
        border-radius: 50%;
        background: var(--primary);
        border: 2.5px solid white;
        box-shadow: 0 2px 6px rgba(3,120,213,.4);
        cursor: pointer;
    }

    .sp-range:disabled::-moz-range-thumb {
        background: var(--muted);
        box-shadow: none;
        cursor: not-allowed;
    }
/* Tick labels */
.range-ticks {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
}

    .range-ticks span {
        font-size: 9.5px;
        color: var(--muted);
    }


/* ════════════════════════════════════════════════════════════
   SETTINGS PANEL  (Setting.razor)
════════════════════════════════════════════════════════════ */

.settings-panel {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 520px;
    background: var(--surface);
    border-left: 1px solid var(--border);
    box-shadow: -8px 0 48px rgba(13,27,42,0.13);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .32s cubic-bezier(.4,0,.2,1);
}

    .settings-panel.open {
        transform: translateX(0);
    }

/* Header */
.sp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--surface);
}

.sp-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sp-title-icon {
    width: 34px;
    height: 34px;
    background: var(--primary-light);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--primary-mid);
}

    .sp-title-icon svg {
        color: var(--primary);
    }

.sp-title h2 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.2px;
}

.sp-title p {
    font-size: 10.5px;
    color: var(--muted);
    margin-top: 1px;
}

.sp-close {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--surface2);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .15s;
    color: var(--text2);
    font-size: 16px;
}

    .sp-close:hover {
        background: var(--primary-light);
        color: var(--primary);
        border-color: var(--border-active);
    }

/* Two-column layout */
.sp-layout {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Left nav */
.sp-nav {
    width: 152px;
    min-width: 128px;
    background: var(--surface2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 12px 8px;
    gap: 3px;
    overflow-y: auto;
}

    .sp-nav::-webkit-scrollbar {
        display: none;
    }

.sp-nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    border-radius: 9px;
    font-family: 'Sora', sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: var(--text2);
    cursor: pointer;
    border: 1px solid transparent;
    background: transparent;
    text-align: left;
    transition: all .15s;
    position: relative;
}

    .sp-nav-item:hover {
        background: var(--surface);
        color: var(--text);
    }

    .sp-nav-item.active {
        background: var(--surface);
        border-color: var(--border);
        color: var(--primary);
        font-weight: 600;
        box-shadow: var(--shadow-sm);
    }

    .sp-nav-item.disabled {
        opacity: 0.45;
        cursor: not-allowed;
        pointer-events: none; /* prevents click */
        background: transparent;
        color: var(--text2);
        border-color: transparent;
        box-shadow: none;
    }

        .sp-nav-item.disabled:hover {
            background: transparent;
            color: var(--text2);
        }

.sni-icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    flex-shrink: 0;
}

.sp-nav-item.active .sni-icon {
    background: var(--primary-light);
}

    .sp-nav-item.active .sni-icon svg {
        color: var(--primary);
    }

.sni-badge {
    position: absolute;
    top: 5px;
    right: 6px;
    background: var(--primary);
    color: white;
    font-size: 8px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 20px;
    letter-spacing: .3px;
}

/* Right scrollable body */
.sp-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px 18px 24px;
}

    .sp-body::-webkit-scrollbar {
        width: 3px;
    }

    .sp-body::-webkit-scrollbar-thumb {
        background: var(--border);
        border-radius: 4px;
    }

/* Tab panes */
.tab-pane {
    display: none;
}

    .tab-pane.active {
        display: block;
    }

/* Pane title */
.pane-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

    .pane-title svg {
        color: var(--primary);
    }

/* Param groups */
.param-group {
    margin-bottom: 20px;
}

.pg-label {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 1.1px;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

    .pg-label::after {
        content: '';
        flex: 1;
        height: 1px;
        background: var(--border);
    }

/* Divider */
.sp-div {
    height: 1px;
    background: var(--border);
    margin: 14px 0;
}

/* Select dropdown */
.sp-select {
    width: 100%;
    padding: 8px 12px;
    background: var(--surface2);
    border: 1.5px solid var(--border);
    border-radius: 9px;
    font-family: 'Sora', sans-serif;
    font-size: 12.5px;
    color: var(--text);
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%238496aa' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
    padding-right: 30px;
    transition: border-color .15s;
}

    .sp-select:focus {
        border-color: var(--primary);
        box-shadow: 0 0 0 3px var(--primary-glow);
    }

/* Preset chips */
.preset-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.p-chip {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 500;
    border: 1.5px solid var(--border);
    color: var(--text2);
    cursor: pointer;
    transition: all .15s;
    font-family: 'Sora', sans-serif;
    background: transparent;
}

    .p-chip:hover {
        border-color: var(--primary);
        color: var(--primary);
        background: var(--primary-light);
    }

    .p-chip.on {
        border-color: var(--primary);
        color: white;
        background: var(--primary);
    }

/* Reset button */
.sp-reset {
    width: 100%;
    padding: 9px;
    margin-top: 8px;
    background: transparent;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-family: 'Sora', sans-serif;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text2);
    cursor: pointer;
    transition: all .15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

    .sp-reset:hover {
        border-color: var(--primary);
        color: var(--primary);
        background: var(--primary-light);
    }

/* RAG status card */
.rag-status-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--surface2);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    margin-bottom: 4px;
    transition: border-color .2s;
}

    .rag-status-card:has(.sw.on) {
        border-color: var(--primary-mid);
        background: var(--primary-light);
    }

.rsc-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rsc-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border);
    box-shadow: 0 0 0 3px var(--surface2);
    transition: all .2s;
    flex-shrink: 0;
}

.rag-status-card:has(.sw.on) .rsc-dot {
    background: #22c55e;
    box-shadow: 0 0 6px #22c55e55;
}

.rsc-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.rsc-sub {
    font-size: 10.5px;
    color: var(--muted);
    margin-top: 1px;
    transition: color .2s;
}

.rag-status-card:has(.sw.on) .rsc-sub {
    color: var(--primary);
}

/* RAG knowledge sources */
.rag-source-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rag-source-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    transition: all .15s;
    cursor: default;
}

    .rag-source-item.add-source {
        cursor: pointer;
        border-style: dashed;
    }

        .rag-source-item.add-source:hover {
            border-color: var(--primary);
            background: var(--primary-light);
        }

.rsi-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}

.rsi-info {
    flex: 1;
}

.rsi-name {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
}

.rsi-meta {
    font-size: 10.5px;
    color: var(--muted);
    margin-top: 1px;
}

.rsi-toggle {
    margin-left: auto;
    flex-shrink: 0;
}

/* System prompt textarea */
.sys-textarea-wrap {
    border: 1.5px solid var(--border);
    border-radius: 11px;
    overflow: hidden;
    transition: border-color .15s;
}

    .sys-textarea-wrap:focus-within {
        border-color: var(--primary);
        box-shadow: 0 0 0 3px var(--primary-glow);
    }

.sys-textarea {
    width: 100%;
    padding: 11px 13px;
    border: none;
    font-family: 'Sora', sans-serif;
    font-size: 12.5px;
    color: var(--text);
    background: var(--surface2);
    resize: none;
    outline: none;
    height: 110px;
    line-height: 1.6;
}

.sys-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    background: var(--surface2);
    border-top: 1px solid var(--border);
}

.sys-count {
    font-size: 10.5px;
    color: var(--muted);
}

.sys-clear {
    font-size: 11px;
    color: var(--muted);
    background: none;
    border: none;
    cursor: pointer;
    font-family: 'Sora', sans-serif;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all .15s;
}

    .sys-clear:hover {
        color: var(--primary);
        background: var(--primary-light);
    }

/* Injection order */
.injection-order {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 4px;
}

.io-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 12px;
}

.io-num {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    flex-shrink: 0;
}

.io-label {
    font-weight: 500;
    color: var(--text);
    flex: 1;
}

.io-tag {
    font-size: 9.5px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    letter-spacing: .3px;
}

    .io-tag.always {
        background: var(--primary-light);
        color: var(--primary);
    }

    .io-tag.rag {
        background: #dcfce7;
        color: #16a34a;
    }
.tone-desc {
    margin-top: 8px;
    padding: 8px 12px;
    font-size: 12px;
    color: var(--text2);
    background: var(--surface2);
    border-radius: 8px;
    line-height: 1.5;
    font-style: italic;
}

/* Stop sequences */
.stop-seq-wrap {
    background: var(--surface2);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
}

.stop-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 8px;
}

.stop-tag {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-size: 11.5px;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text2);
}

    .stop-tag span {
        color: var(--muted);
        cursor: pointer;
        font-size: 13px;
        line-height: 1;
    }

        .stop-tag span:hover {
            color: #ef4444;
        }

.stop-input-row {
    display: flex;
    gap: 6px;
}

.stop-input {
    flex: 1;
    padding: 6px 10px;
    border: 1.5px solid var(--border);
    border-radius: 7px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--text);
    background: var(--surface);
    outline: none;
    transition: border-color .15s;
}

    .stop-input:focus {
        border-color: var(--primary);
    }

.stop-add-btn {
    width: 30px;
    height: 30px;
    background: var(--primary);
    border: none;
    border-radius: 7px;
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}

    .stop-add-btn:hover {
        background: var(--primary-hover);
    }

.hist-search-wrap {
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
    margin-bottom: 12px;
}

    .hist-search-wrap svg {
        opacity: 0.4;
        flex-shrink: 0;
    }

.hist-search {
    background: none;
    border: none;
    outline: none;
    font-size: 12px;
    color: var(--text);
    width: 100%;
}

.hist-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}

.hist-group-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 10px 4px 4px;
}

.hist-item {
    padding: 9px 10px;
    border-radius: 7px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background .15s, border-color .15s;
}

    .hist-item:hover {
        background: var(--surface2);
    }

    .hist-item.active {
        background: var(--surface2);
        border-color: var(--primary);
    }

.hi-main {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 3px;
}

.hi-title {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hi-time {
    font-size: 10px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.hi-preview {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 5px;
}

.hi-footer {
    display: flex;
    gap: 8px;
}

.hi-model, .hi-msgs {
    font-size: 10px;
    background: var(--surface3);
    color: var(--text-muted);
    padding: 1px 6px;
    border-radius: 4px;
}

.hist-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 40px 0;
    color: var(--text-muted);
    font-size: 12px;
    opacity: 0.5;
}

/* ═══════════════════════════════════════════════════════════
   ADD KNOWLEDGE SOURCE  modal
═══════════════════════════════════════════════════════════ */

/* Backdrop */
.aks-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(13, 27, 42, 0.45);
    z-index: 3500;
    backdrop-filter: blur(2px);
    animation: fadeIn .18s ease;
}

/* Modal card */
.aks-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3600;
    width: 480px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 48px);
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(13, 27, 42, 0.22);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideUp .22s cubic-bezier(.4,0,.2,1);
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translate(-50%, -46%);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* Header */
.aks-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.aks-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.aks-header-icon {
    width: 34px;
    height: 34px;
    background: var(--primary-light);
    border: 1px solid var(--primary-mid);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    flex-shrink: 0;
}

.aks-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.2px;
}

.aks-sub {
    font-size: 10.5px;
    color: var(--muted);
    margin-top: 1px;
}

/* Body */
.aks-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

    .aks-body::-webkit-scrollbar {
        width: 3px;
    }

    .aks-body::-webkit-scrollbar-thumb {
        background: var(--border);
        border-radius: 4px;
    }

/* Input mode tabs */
.aks-tabs {
    display: flex;
    gap: 6px;
    background: var(--surface2);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 4px;
}

.aks-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 10px;
    border-radius: 7px;
    font-family: 'Sora', sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: var(--text2);
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all .15s;
}

    .aks-tab:hover {
        color: var(--text);
        background: var(--surface);
    }

    .aks-tab.active {
        background: var(--surface);
        color: var(--primary);
        font-weight: 600;
        border: 1px solid var(--border);
        box-shadow: var(--shadow-sm);
    }

/* Drop zone */
.aks-dropzone {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 28px 20px;
    text-align: center;
    transition: all .2s;
    cursor: pointer;
    background: var(--surface2);
}

    .aks-dropzone.dragging {
        border-color: var(--primary);
        background: var(--primary-light);
    }

    .aks-dropzone.has-file {
        border-style: solid;
        border-color: var(--primary-mid);
        background: var(--primary-light);
        padding: 14px 16px;
    }

.aks-drop-idle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.aks-drop-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    margin-bottom: 4px;
}

.aks-drop-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.aks-drop-sub {
    font-size: 11px;
    color: var(--muted);
}

.aks-browse-btn {
    margin-top: 8px;
    padding: 7px 18px;
    background: var(--primary);
    color: white;
    border-radius: 8px;
    font-family: 'Sora', sans-serif;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
    display: inline-block;
}

    .aks-browse-btn:hover {
        background: var(--primary-hover);
    }

.aks-keyword-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
}

.aks-keyword-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px 3px 10px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 500;
}

.aks-tag-remove {
    background: none;
    border: none;
    color: inherit;
    opacity: 0.7;
    cursor: pointer;
    padding: 0;
    font-size: 10px;
    line-height: 1;
    display: flex;
    align-items: center;
}

    .aks-tag-remove:hover {
        opacity: 1;
    }

.aks-keywords-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--surface2);
    border: 1.5px solid var(--border);
    border-radius: 9px;
    font-family: 'Sora', sans-serif;
    border-radius: 8px;
    padding: 0 10px;
    transition: border-color 0.2s;
}

    .aks-keywords-wrap:focus-within {
        border-color: var(--primary);
    }

    .aks-keywords-wrap .aks-url-icon {
        opacity: 0.4;
        flex-shrink: 0;
    }

    .aks-keywords-wrap .aks-url-input {
        flex: 1;
        background: none;
        border: none;
        outline: none;
        padding: 9px 0;
        font-size: 12.5px;
        color: var(--text, #fff);
    }

        .aks-keywords-wrap .aks-url-input::placeholder {
            opacity: 0.35;
        }

.aks-keyword-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    border: none;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.15s;
}

    .aks-keyword-add-btn:hover {
        opacity: 0.85;
    }

/* File preview (after selection) */
.aks-file-preview {
    display: flex;
    align-items: center;
    gap: 10px;
}

.aks-file-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.aks-file-info {
    flex: 1;
    text-align: left;
}

.aks-file-name {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
}

.aks-file-size {
    font-size: 10.5px;
    color: var(--muted);
    margin-top: 1px;
}

.aks-file-remove {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: var(--surface2);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text2);
    transition: all .15s;
    flex-shrink: 0;
}

    .aks-file-remove:hover {
        background: #fee2e2;
        border-color: #fca5a5;
        color: #dc2626;
    }

/* URL input */
.aks-url-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface2);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 0 12px;
    transition: border-color .15s;
}

    .aks-url-wrap:focus-within {
        border-color: var(--primary);
        box-shadow: 0 0 0 3px var(--primary-glow);
    }

.aks-url-icon {
    color: var(--muted);
    flex-shrink: 0;
}

.aks-url-input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--text);
    padding: 10px 0;
    outline: none;
}

    .aks-url-input::placeholder {
        color: var(--muted);
    }

.aks-url-clear {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 12px;
    padding: 2px 4px;
    border-radius: 4px;
    transition: color .15s;
}

    .aks-url-clear:hover {
        color: var(--text);
    }

/* Upload progress */
.aks-progress-wrap {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.aks-progress-bar {
    height: 5px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
}

.aks-progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 99px;
    transition: width .25s ease;
}

.aks-progress-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--primary);
    text-align: right;
}

/* Error */
.aks-error {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12px;
    color: #dc2626;
}

/* Resolved URL */
.aks-resolved {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: #16a34a;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 6px 10px;
}

.aks-resolved-url {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    color: #15803d;
    word-break: break-all;
}

/* Divider */
.aks-divider {
    height: 1px;
    background: var(--border);
}

/* Field + label */
.aks-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.aks-label {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 1.1px;
    text-transform: uppercase;
    color: var(--muted);
}

.aks-input {
    padding: 9px 12px;
    background: var(--surface2);
    border: 1.5px solid var(--border);
    border-radius: 9px;
    font-family: 'Sora', sans-serif;
    font-size: 12.5px;
    color: var(--text);
    outline: none;
    transition: border-color .15s;
}

    .aks-input:focus {
        border-color: var(--primary);
        box-shadow: 0 0 0 3px var(--primary-glow);
    }

    .aks-input::placeholder {
        color: var(--muted);
    }

/* Success Message */
.aks-success {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border: 1px solid #28a745;
    border-radius: 8px;
    color: #155724;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 16px;
    animation: slideInDown 0.3s ease;
}

    .aks-success svg {
        flex-shrink: 0;
        stroke: #28a745;
    }

/* Error Message */
.aks-error {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    border: 1px solid #dc3545;
    border-radius: 8px;
    color: #721c24;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 16px;
    animation: shake 0.4s ease;
}

    .aks-error svg {
        flex-shrink: 0;
        stroke: #dc3545;
    }

/* Conversion/Processing State */
.aks-converting {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: linear-gradient(135deg, #e7f3ff 0%, #d6ebff 100%);
    border: 1px solid #0066cc;
    border-radius: 12px;
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

.conversion-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e3e8ef;
    border-top: 3px solid #0066cc;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    flex-shrink: 0;
}

.conversion-content {
    flex: 1;
}

.conversion-title {
    font-size: 15px;
    font-weight: 600;
    color: #004085;
    margin-bottom: 4px;
}

.conversion-subtitle {
    font-size: 13px;
    color: #0066cc;
    margin-bottom: 8px;
}

.conversion-progress-bar {
    width: 100%;
    height: 6px;
    background: #cfe2ff;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px;
}

.conversion-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0066cc 0%, #0052a3 100%);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.conversion-percentage {
    font-size: 12px;
    color: #004085;
    font-weight: 600;
    text-align: right;
}

/* Animations */
@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Visibility buttons */
.aks-vis-group {
    display: flex;
    gap: 6px;
}

.aks-vis-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 8px;
    border-radius: 9px;
    font-family: 'Sora', sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: var(--text2);
    border: 1.5px solid var(--border);
    background: var(--surface2);
    cursor: pointer;
    transition: all .15s;
}

    .aks-vis-btn:hover {
        border-color: var(--primary-mid);
        color: var(--primary);
        background: var(--primary-light);
    }

    .aks-vis-btn.active {
        border-color: var(--primary);
        color: white;
        background: var(--primary);
    }

/* Department chips */
.aks-dept-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* Footer */
.aks-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--surface2);
}

.aks-save-btn {
    flex: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-family: 'Sora', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, opacity .15s;
}

    .aks-save-btn:hover:not(:disabled) {
        background: var(--primary-hover);
    }

    .aks-save-btn:disabled {
        opacity: 0.45;
        cursor: not-allowed;
    }

/* Spinner */
.aks-spinner {
    width: 13px;
    height: 13px;
    border: 2px solid rgba(255,255,255,.35);
    border-top-color: white;
    border-radius: 50%;
    animation: spin .7s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

