:root{
    --bg:#f4f7fb;
    --panel:#ffffff;
    --line:#e3e8ef;
    --text:#1c2430;
    --muted:#7a8798;
    --accent:#2563eb;
    --accent-dark:#1d4ed8;
    --accent-soft:#eaf2ff;
    --success:#16a34a;
    --danger:#dc2626;
    --radius:18px;
    --shadow-soft:0 8px 24px rgba(15, 23, 42, 0.06);
    --shadow-panel:0 18px 45px rgba(15, 23, 42, 0.08);
}

*{
    box-sizing:border-box;
}

html, body{
    margin:0;
    padding:0;
}

body{
    font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Inter,Arial,sans-serif;
    background:linear-gradient(180deg,#f7f9fc 0%,#eef3f9 100%);
    color:var(--text);
    -webkit-font-smoothing:antialiased;
}

.app{
    max-width:1220px;
    margin:0 auto;
    padding:24px 18px;
}

.shell{
    min-height:92vh;
    background:var(--panel);
    border:1px solid var(--line);
    border-radius:24px;
    overflow:hidden;
    box-shadow:var(--shadow-panel);
    display:flex;
    flex-direction:column;
}

.topbar{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:16px;
    padding:22px 28px;
    border-bottom:1px solid var(--line);
    background:linear-gradient(180deg,#ffffff 0%,#fbfcff 100%);
}

.topbar-right{
    display:flex;
    align-items:center;
    gap:12px;
}

.title{
    font-size:24px;
    font-weight:750;
    letter-spacing:-0.4px;
}

.subtitle{
    margin-top:4px;
    font-size:13px;
    color:var(--muted);
}

.status{
    font-size:13px;
    color:var(--muted);
    padding:8px 12px;
    border-radius:999px;
    background:#f4f7fb;
    border:1px solid var(--line);
}

.chat{
    flex:1;
    padding:22px;
    overflow-y:auto;
    display:flex;
    flex-direction:column;
    gap:14px;
    background:
        radial-gradient(circle at top right, rgba(37,99,235,0.05), transparent 24%),
        radial-gradient(circle at bottom left, rgba(37,99,235,0.04), transparent 20%);
}

.message-row{
    display:flex;
}

.message-row.user{
    justify-content:flex-end;
}

.bubble{
    width:min(920px, 86%);
    border:1px solid var(--line);
    background:#fbfdff;
    border-radius:18px;
    padding:14px 16px;
    box-shadow:var(--shadow-soft);
    white-space:normal;
    overflow:hidden;
}

.message-row.user .bubble{
    background:var(--accent-soft);
}

.meta{
    font-size:12px;
    color:var(--muted);
    margin-bottom:8px;
    font-weight:700;
}

.composer{
    border-top:1px solid var(--line);
    padding:18px 20px 20px;
    background:#fff;
}

.dropzone{
    border:1.5px dashed #cdd7e6;
    background:linear-gradient(180deg,#fafcff 0%,#f7faff 100%);
    border-radius:18px;
    padding:22px 18px;
    text-align:center;
    margin-bottom:16px;
    transition:.2s ease;
}

.dropzone.dragover{
    border-color:var(--accent);
    background:#eef4ff;
    transform:translateY(-1px);
}

.dropzone-icon{
    font-size:28px;
    margin-bottom:6px;
}

.dropzone-title{
    font-size:16px;
    font-weight:700;
}

.dropzone-subtitle{
    margin-top:4px;
    font-size:13px;
    color:var(--muted);
}

.progress-wrap{
    margin-bottom:14px;
    border:1px solid var(--line);
    border-radius:14px;
    padding:12px 14px;
    background:#fbfcfe;
}

.progress-wrap.hidden{
    display:none;
}

.progress-head{
    display:flex;
    justify-content:space-between;
    gap:12px;
    font-size:13px;
    color:var(--muted);
    margin-bottom:8px;
}

.progress-bar{
    width:100%;
    height:10px;
    background:#eaf0f7;
    border-radius:999px;
    overflow:hidden;
}

.progress-bar-fill{
    width:0%;
    height:100%;
    background:linear-gradient(90deg,var(--accent) 0%,#4f8dff 100%);
    border-radius:999px;
    transition:width .25s ease;
}

.controls{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:12px;
    flex-wrap:wrap;
}

.inputs{
    display:flex;
    align-items:center;
    gap:12px;
    flex-wrap:wrap;
}

.actions{
    display:flex;
    gap:10px;
    margin-left:auto;
}

.dep{
    display:flex;
    align-items:center;
    gap:8px;
    color:var(--text);
    font-size:14px;
}

input[type="file"]{
    background:#f8fbff;
    border:1px solid var(--line);
    border-radius:12px;
    padding:8px;
}

.btn{
    border:0;
    border-radius:12px;
    padding:11px 16px;
    font-weight:700;
    cursor:pointer;
    transition:.2s ease;
}

.btn:disabled{
    opacity:.6;
    cursor:not-allowed;
}

.btn-primary{
    background:var(--accent);
    color:#fff;
}

.btn-primary:hover{
    background:var(--accent-dark);
}

.btn-secondary{
    background:#eef2f7;
    color:var(--text);
}

.btn-secondary:hover{
    background:#e4eaf2;
}

.report{
    margin-top:4px;
}

.tabs{
    display:flex;
    gap:8px;
    flex-wrap:wrap;
    margin-bottom:14px;
}

.tab-btn{
    border:1px solid var(--line);
    background:#f8fbff;
    color:var(--text);
    padding:9px 12px;
    border-radius:10px;
    cursor:pointer;
    font-weight:650;
    transition:.2s ease;
}

.tab-btn.active{
    background:var(--accent-soft);
    border-color:#bcd0fb;
    color:#113b9a;
}

.tab-panel{
    display:none;
}

.tab-panel.active{
    display:block;
}

.report h3{
    margin:18px 0 8px;
    font-size:15px;
    font-weight:750;
}

.report-table{
    width:100%;
    border-collapse:collapse;
    margin-top:8px;
    border-radius:12px;
    overflow:hidden;
}

.report-table td{
    border:1px solid var(--line);
    padding:10px 12px;
    vertical-align:top;
    font-size:14px;
    line-height:1.45;
}

.report-table td:first-child{
    width:260px;
    background:#f8fafc;
    font-weight:700;
}

.report ul{
    margin:8px 0 14px 18px;
    padding:0;
}

.report li{
    margin-bottom:5px;
    line-height:1.45;
}

.download-block{
    margin-top:16px;
    display:flex;
    gap:8px;
    flex-wrap:wrap;
}

.download-block button{
    border:0;
    border-radius:10px;
    padding:10px 14px;
    background:#eef2f7;
    cursor:pointer;
    font-weight:700;
}

.download-block button:hover{
    background:#e3e9f1;
}

.badge{
    display:inline-flex;
    align-items:center;
    padding:6px 10px;
    border-radius:999px;
    background:#eef5ff;
    color:#1d4ed8;
    font-size:12px;
    font-weight:700;
    margin:0 8px 8px 0;
}

.empty-block{
    color:var(--muted);
    font-size:14px;
}

@media (max-width: 900px){
    .app{
        padding:12px;
    }

    .shell{
        min-height:100vh;
        border-radius:16px;
    }

    .topbar{
        flex-direction:column;
        align-items:flex-start;
        padding:18px;
    }

    .chat{
        padding:16px;
    }

    .bubble{
        width:100%;
        max-width:100%;
    }

    .report-table td:first-child{
        width:180px;
    }
}

@media (max-width: 640px){
    .title{
        font-size:19px;
    }

    .controls{
        flex-direction:column;
        align-items:stretch;
    }

    .inputs{
        flex-direction:column;
        align-items:stretch;
    }

    .actions{
        margin-left:0;
        width:100%;
        flex-direction:column;
    }

    .btn{
        width:100%;
    }

    input[type="file"]{
        width:100%;
    }

    .download-block{
        flex-direction:column;
    }

    .download-block button{
        width:100%;
    }

    .tabs{
        display:grid;
        grid-template-columns:1fr 1fr;
    }

    .tab-btn{
        width:100%;
    }

    .report-table td{
        font-size:13px;
        padding:8px 9px;
    }

    .report-table td:first-child{
        width:130px;
    }
}

/* ========================= */
/* DROPZONE INTRO ANIMATION */
/* ========================= */

.dropzone.hidden{
    opacity:0;
    transform:translateY(16px) scale(.98);
    pointer-events:none;
}

.dropzone.show{
    opacity:1;
    transform:translateY(0) scale(1);
    pointer-events:auto;
    transition:all .6s cubic-bezier(.22,.61,.36,1);
}

/* ========================= */
/* BOT WELCOME MESSAGE */
/* ========================= */

.message-row.bot .bubble{

    background:
        linear-gradient(180deg,#fbfdff 0%,#f5f8ff 100%);

    border:1px solid #dbe6fb;

}

.welcome-block p{
    margin:6px 0;
    line-height:1.5;
}

.welcome-block ul{
    margin:6px 0 10px 18px;
}

.welcome-block li{
    margin:4px 0;
}

.welcome-block b{
    color:#1d4ed8;
}

/* ========================= */
/* MESSAGE APPEAR ANIMATION */
/* ========================= */

.message-row{
    animation:messageFade .35s ease;
}

@keyframes messageFade{

    from{
        opacity:0;
        transform:translateY(6px);
    }

    to{
        opacity:1;
        transform:translateY(0);
    }

}