﻿html, body {
    height: 100%;
}

:root {
    --card-min: 32rem;
}

.img-btn {
    width: 80px;
}

.logo {
    height: 40px;
}

.btn-transparency {
    background-color: rgba(250, 250, 250, 0.6);
}

#recordsListViewContainer {
    overflow-y: auto;
    overflow-x: hidden;
    height: calc(100vh - 100px);
}

.record-card {
    padding: 14px 18px;
    box-sizing: border-box;
    border: 2px solid #c4ccdf;
    border-radius: 6px;
    justify-content: space-between;
    transition: .2s;
    flex-direction: column;
    overflow: hidden;
    width: 100%;
    height: var(--card-h);
    font-size: clamp(.9rem, 1vw + .2rem, 1.25rem);
    display: flex;
}

    .record-card:hover {
        border-color: #3f6ad8;
        cursor: pointer;
    }


.record-header {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between
}

.record-icon {
    height: calc(var(--card-h) * 0.50);
    width: auto;
}

.record-icon-sec {
    height: calc(var(--card-h) * 0.10);
    min-height: 45px;
    width: auto;
    flex: 0 0 auto;
}

.record-title {
    font-weight: 600;
    line-height: 1.2;
    word-break: break-word;
    flex: 1 1 auto;
}

.doc-count {
    color: #555;
    display: flex;
    justify-content: space-between
}

    .doc-count .count {
        font-weight: 700;
        color: #000;
    }


.main-panel {
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-height: 0;
    gap: 12px;
}


.search-bar {
    flex: 0 0 50px;
    max-height: 50px;
}


#recordsListViewContainer {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    display: flex;
}


#recordsListView {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    overflow: hidden;
    height: calc(100% - 69px);
}

    #recordsListView .k-listview-content {
        display: grid;
        gap: 12px;
        grid-template-columns: repeat(auto-fill,minmax(var(--card-w),1fr));
        margin: 0;
        padding: 0;
    }

advanced-search {
    flex: 1 1 auto;
}

    advanced-search .advanced-panel {
        z-index: 1055;
    }

.hash {
    font-family: monospace;
    font-size: .85rem;
}

.doc-layer {
    position: absolute;
    inset: 0;
    z-index: 1050;
    padding: 1.35rem;
    background: linear-gradient(165deg, #eff4ff 0%, #e9f0fb 100%);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

    .doc-layer[hidden] {
        display: none !important
    }


.doc-canvas {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    margin: 0;
    border: 1px solid rgba(183, 204, 232, 0.82);
    border-radius: 28px;
    background: transparent;
    overflow: hidden;
    position: relative;
    box-shadow:
        0 24px 60px rgba(16, 43, 84, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.doc-close {
    position: absolute;
    z-index: 2;
}

    .doc-close img {
        height: 32px;
    }

#_docsCloseBtn.doc-close {
    position: inherit !important;
}

/* higher than the canvas/iframe */
.doc-loader {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(255,255,255,.7);
    font: 600 14px/1 system-ui,sans-serif;
    z-index: 1070;
}

.doc-toolbar {
    flex: 0 0 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    position: relative;
    padding: 8px 24px
}
.doc-toolbar .page-label {
    font-weight: 600;
    font-size: 0.95rem;
}
.page-jump {
    display: flex;
    align-items: center;
    gap: 6px;
}
.page-input {
    width: 70px;
    padding: 4px 6px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.9rem;
    text-align: center;
}

.icon-btn {
    background: transparent;
    border: 0;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer
}

    .icon-btn:hover {
        background: #f1f5f9
    }

    .icon-btn img {
        display: block;
        height: 56px;
        width: auto
    }

    .icon-btn.is-edge {
        opacity: .75;
    }


.page-label {
    font-family: system-ui,sans-serif;
    font-weight: 600
}

.right-icons {
    position: absolute;
    right: 24px;
    display: flex;
    gap: 10px
}

/* widen rows a bit (optional) */
#_docsGrid .k-grid-content tr {
    height: 86px;
}

/* don’t clip the popout */
#_docsGrid .k-grid-content td.ctx-cell {
    overflow: visible;
    position: relative;
}

#_docsGrid .ctx-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

#_docsGrid .js-ctx-toggle {
    z-index: 2;
}

/* the action strip that appears to the LEFT of the toggle */
#_docsGrid .ctx-actions {
    position: absolute;
    top: 50%;
    right: calc(100% + 8px); /* to the left of the toggle */
    transform: translateY(-50%) scaleX(0.9);
    transform-origin: right center;
    display: flex;
    gap: 8px;
    background: #fff;
    padding: 6px;
    border: 1px solid #c4ccdf;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0,0,0,.08);
    opacity: 0;
    pointer-events: none;
    z-index: 10;
    transition: opacity .12s ease, transform .12s ease;
}

#_docsGrid .ctx-wrap.open .ctx-actions {
    opacity: 1;
    transform: translateY(-50%) scaleX(1);
    pointer-events: auto;
}

/* action “cards” */
#_docsGrid .ctx-btn {
    width: 92px;
    height: 76px;
    padding: 8px 6px;
    border: 1px solid #9fb7d8;
    border-radius: 8px;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

    #_docsGrid .ctx-btn:hover {
        background: #f3f6fb;
        box-shadow: inset 0 0 0 2px #9fb7d8;
    }

    #_docsGrid .ctx-btn img {
        width: 30px;
        height: 30px;
        object-fit: contain;
    }

    #_docsGrid .ctx-btn span {
        font-size: 12px;
        line-height: 1.1;
        color: #2d3b53;
    }

/* --- Imagen/TIFF viewport --- */
#docHost {
    flex: 1 1 auto;
    min-height: 0; /* clave para que el hijo pueda medir 100% */
    position: relative;
    overflow: hidden;
    width: 100%;
    background: transparent; 
}

    #docHost > .doc-fit {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        display: block;
        border: 0;
    }

    #docHost .img-scroller {
        position: absolute;
        inset: 0;
        overflow: auto; /* scroll vertical/horizontal cuando aplique */
        background: #fff;
    }

    #docHost canvas.img-canvas {
        display: block;
        margin: 0 auto; /* centra el lienzo */
        image-rendering: optimizeQuality;
    }

    /* --- Toolbar de imagen --- */
    #docHost .img-toolbar {
        position: absolute;
        top: 8px;
        right: 8px;
        display: flex;
        gap: 6px;
        padding: 6px;
        background: rgba(255,255,255,.9);
        border: 1px solid #dbe1ea;
        border-radius: 8px;
        box-shadow: 0 6px 18px rgba(0,0,0,.08);
        z-index: 2;
    }

        #docHost .img-toolbar .btn-ico {
            border: 1px solid #c4ccdf;
            background: #fff;
            border-radius: 6px;
            padding: 6px 8px;
            cursor: pointer;
            font: 600 12px/1 system-ui, sans-serif;
            color: black;
        }

            #docHost .img-toolbar .btn-ico:hover {
                background: #f3f6fb;
            }

    /* Opcional: cursors al arrastrar */
    #docHost .img-scroller.grabbing {
        cursor: grabbing;
    }

#arcangelRagPanel {
    position: fixed;
    inset: 66px 0 0 0;
    z-index: 1065;
    display: none;
    background: #fff;
    overflow: hidden;
    height: auto;
}


    #arcangelRagPanel .arcangel-grid {
        display: grid;
        grid-template-columns: 70% 30%;
        width: 100%;
        height: 100%;
    }

    #arcangelRagPanel .arcangel-grid-one-col {
        display: grid;
        grid-template-columns: 100%;
        width: 100%;
        height: 100%;
    }



    #arcangelRagPanel .doc-wrap {
        position: relative;
        height: 100%;
        background: #fff;
        border-right: 1px solid rgba(255,255,255,0.06);
        overflow: hidden;
    }

    #arcangelRagPanel .doc-canvas {
        position: relative;
        width: 100%;
        height: 100%;
        margin: 0;
        border: 0;
        background: url('/images/Background.svg') no-repeat center / cover fixed;       
    }

    #arcangelRagPanel .doc-toolbar {
        position: sticky;
        top: 0;
        z-index: 3;
        display: flex;
        align-items: center;
        gap: .5rem;
        padding: .4rem .6rem;
        background: rgba(0,0,0,0.35);
        backdrop-filter: blur(6px);
        border-bottom: 1px solid rgba(255,255,255,0.06);
    }

    #arcangelRagPanel #docHost {
        position: absolute;
        inset: 0px 0 0 0; /* below toolbar */
        overflow: auto;
    }

    /* Chat side */
    #arcangelRagPanel .chat-wrap {
        display: grid;
        grid-template-rows: auto 1fr auto;
        height: 100%;
        background: #fff;
        min-height: 0;
    }


/* Capas de PDF.js */
.pdf-page-canvas {
    display: block;
    margin: 8px auto;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 6px 16px rgba(0,0,0,0.35);
    background: white;
}

.textLayer {
    position: absolute;
    inset: auto;
}

/* Lado derecho: chat RAG */
.chat-wrap {
    display: grid;
    grid-template-rows: auto 1fr auto;
    height: 100%;
}

aside.chat-wrap {
    background: transparent !important;
}


.chat-header {
    padding: .75rem 1rem;
    color: #d1d5db;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    font-weight: 600;
    background: rgba(255,255,255,0.75);
}

.chat-body {
    padding: 1rem;
    overflow-y: auto;
    overflow-x: hidden;
    color: #e5e7eb;
    min-height: 0;
    background: rgba(255,255,255,0.75);
}

.msg {
    max-width: 88%;
    padding: .7rem .9rem;
    border-radius: 12px;
    margin: .35rem 0;
    line-height: 1.35;
    white-space: pre-wrap;
}

    .msg.ai {
        background: #1e293b;
        
        text-align: justify; 
        white-space: pre-wrap; 
        line-height: 1.6; 
        hyphens: auto; 
        overflow-wrap: anywhere; 
    }

    .msg.user {
        background: #334155;
        margin-left: auto;
    }

.ref-links {
    margin-top: .5rem;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

    .ref-links .k-button {
        font-size: 12px;
    }

.chat-footer {
    padding: .7rem;
}

/* === ArcangelRAG Light Theme Patch === */
#arcangelRagPanel {
    background: url('/images/Background.svg') no-repeat center / cover fixed;
}

    #arcangelRagPanel .doc-wrap {
        background: transparent !important;
        border-right: 1px solid #dee2e6; 
    }
    
    #arcangelRagPanel .chat-wrap {
        background: transparent !important;
        color: #212529;
    }

    #arcangelRagPanel .chat-header {
        color: #212529 !important;
        border-bottom: 1px solid #dee2e6;
        height: 44px;
    }

    #arcangelRagPanel .msg.ai {
        background: #343a40 !important; 
        color: #f8f9fa !important; 
    }

    #arcangelRagPanel .msg.user {
        background: #DDEDFC !important;
        color: black !important;
    }

    #arcangelRagPanel .ref-links .k-button {
        background: #DDEDFC;
        color: black;
        border: 1px solid #495057;
        max-width: 85%;
        text-wrap: auto;
        text-align: left;
    }

    #arcangelRagPanel .doc-wrap {
        background: transparent !important;
        border-right: 1px solid #dee2e6 !important;
    }

    #arcangelRagPanel .doc-toolbar {
        background: rgba(255,255,255,0.92) !important;
        backdrop-filter: none !important;
        border-bottom: 1px solid #dee2e6 !important;
    }

        #arcangelRagPanel .doc-toolbar .k-button,
        #arcangelRagPanel .doc-toolbar .doc-close {
            border: 1px solid #ced4da !important;
            background: #ffffff !important;
            color: #212529 !important;
            left: 0px;
            top: 0px;
        }

        #arcangelRagPanel #lblScale,
        #arcangelRagPanel .doc-toolbar label {
            color: #495057 !important;
        }

    /* Loader: soft veil */
    #arcangelRagPanel #docLoader, #arcangelRagPanel docLoaderViewer {
        background: rgba(248,249,250,0.75) !important; /* #f8f9fa with alpha */
        color: #212529 !important;
        inset: 48px 0 0 0 !important; /* below toolbar, keep as needed */
    }

    /* Host area scrolls over a light surface */
    #arcangelRagPanel #docHost {
        background: transparent !important;
        scrollbar-color: #adb5bd #f8f9fa; /* Firefox */
        overflow: hidden;
    }

        #arcangelRagPanel #docHost::-webkit-scrollbar-thumb {
            background: #adb5bd;
        }

        #arcangelRagPanel #docHost::-webkit-scrollbar-track {
            background: #f8f9fa;
        }

    /* PDF page canvases: white sheet with soft shadow */
    #arcangelRagPanel .pdf-page-canvas,
    #arcangelRagPanel .page canvas {
        background: #ffffff !important;
        box-shadow: 0 0 0 1px rgba(0,0,0,0.05), 0 6px 18px rgba(0,0,0,0.12) !important;
        border-radius: 2px; /* subtle edge */
    }

    /* Text layer on light background */
    #arcangelRagPanel .textLayer,
    #arcangelRagPanel .page .textLayer {
        mix-blend-mode: normal; /* ensure text looks crisp */
        color: #212529; /* selection helpers may use this */
    }

        #arcangelRagPanel .textLayer ::selection {
            background: rgba(13,110,253,0.25);
        }

    /* Optional: annotation layer tweaks on light bg */
    #arcangelRagPanel .annotationLayer a,
    #arcangelRagPanel .annotationLayer .linkAnnotation > a {
        color: #0d6efd !important; /* link blue */
        text-decoration: underline;
    }

/* Input */
#txtQuestion.rag-input {
    border-radius: 999px; /* fully rounded pill style */
    background-color: #1e293b; /* dark slate (match chat theme) */
    color: #fff; /* white text */
    border: 1px solid #334155;
    padding: .6rem 1rem;
    width: 100%;
}

    #txtQuestion.rag-input::placeholder {
        color: #9ca3af; /* grey placeholder */
    }

/* Button with icon */
#btnAsk.rag-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px; /* rounded pill */
    padding: .6rem 1.2rem;
    border-color: black;
}

    #btnAsk.rag-btn .btn-icon {
        width: 18px;
        height: 18px;
        display: none;

    }

#pdfViewer {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 400px;
}


.pdfjs-container .pdfViewer,
.pdfjs-container .pdfViewer .page {
    background: #fff !important;
}

    .pdfjs-container .pdfViewer .page {
        box-shadow: none !important;
    }

.pdfjs-toolbar {
    position: relative;
    height: 44px;
    display: flex;
    align-items: center;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 0 8px;
}

.pdfjs-toolbar-left {
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pdfjs-toolbar-center {
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pdfjs-toolbar-sep {
    width: 1px;
    height: 22px;
    background: #e5e7eb;
    margin: 0 4px 0 8px;
}

.pg-wrap {
    width: 72px;
}

    .pg-wrap .pg {
        width: 100%;
        text-align: center;
        border: 0;
        outline: 0;
        background: transparent;
    }

.pdfjs-toolbar .k-button.k-button-flat.k-button-md {
    min-width: 36px;
    height: 32px;
    padding: 0 8px;
}

.pdfjs-toolbar .pdfjs-comments-toggle {
    position: relative;
    overflow: visible;
}

.pdfjs-comments-badge {
    position: absolute;
    top: -6px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #0d6efd;
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 0 0 2px #fff;
}

.pdfjs-viewport {
    overflow: hidden;
}

.pdfjs-container {
    top: 0 !important;
}

.pdfjs-comments-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(360px, 42vw);
    display: flex;
    flex-direction: column;
    background: #fff;
    border-left: 1px solid #e5e7eb;
    box-shadow: -14px 0 28px rgba(15, 23, 42, 0.08);
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
    transition: transform .18s ease, opacity .18s ease;
    z-index: 3;
}

.pdfjs-viewport.comments-open .pdfjs-comments-panel {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

.pdfjs-viewport.comments-open .pdfjs-container {
    right: min(360px, 42vw) !important;
}

.pdfjs-comments-header {
    padding: 14px 16px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
}

.pdfjs-comments-heading {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pdfjs-comments-title {
    font-size: .95rem;
    font-weight: 600;
    color: #0f172a;
}

.pdfjs-comments-count {
    font-size: .78rem;
    color: #64748b;
}

.pdfjs-comments-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    overflow: auto;
}

.pdfjs-comments-empty {
    padding: 16px;
    color: #64748b;
    font-size: .9rem;
}

.pdfjs-comments-empty[hidden] {
    display: none !important;
}

.pdfjs-comment-item {
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    padding: 12px 13px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.pdfjs-comment-item:hover,
.pdfjs-comment-item:focus-visible {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
    outline: none;
    transform: translateY(-1px);
}

.pdfjs-comment-item.is-active {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.pdfjs-comment-title {
    font-size: .9rem;
    font-weight: 600;
    color: #0f172a;
}

.pdfjs-comment-meta {
    font-size: .75rem;
    color: #64748b;
}

.pdfjs-comment-body {
    font-size: .85rem;
    line-height: 1.45;
    color: #334155;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

@media (max-width: 991.98px) {
    .pdfjs-comments-panel {
        width: min(100%, 340px);
    }

    .pdfjs-viewport.comments-open .pdfjs-container {
        right: 0 !important;
    }
}

#tbPgNumber.k-input-inner {
    text-align: center;
    width: 65%;
}

.chat-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    backdrop-filter: blur(1px);
    z-index: 2;
}

    .chat-loading[hidden] {
        display: none !important;
    }

#spanTitleRag {
    display: inline-block;
    max-width: 66%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
}


#arcangelRagPanel .arcangel-grid > * {
    min-width: 0;
}

#arcangelRagPanel .chat-wrap {
    min-width: 0;
}

#arcangelRagPanel .chat-header,
#arcangelRagPanel .chat-body,
#arcangelRagPanel .chat-footer {
    max-width: 100%;
    min-width: 0;
    background: rgba(255,255,255,0.75);
}

#arcangelRagPanel .chat-header,
#arcangelRagPanel .chat-body {
    overflow-wrap: anywhere;
    word-break: break-word;
}


#arcangelRagPanel .chat-body {
    overflow-x: visible;
}


.k-loading-color {
    background: rgba(255,255,255,0.3);
}

#summarizerResult {
    margin: auto;
    font-size: 1.15rem;
    line-height: 1.6;
    width: calc(100% - 20px);
    height: calc(100% - 190px);
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid #d1d5db;
    border-radius: .75rem;
    padding: 1.25rem;
    color: #111827;
    overflow-y: auto;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.15);
}

.answer {
    text-align: justify;
    line-height: 1.6;
    hyphens: auto; /* mejor partición de palabras (usa lang="es") */
    overflow-wrap: anywhere; /* evita desbordes por URLs largas */
}

    .answer p {
        margin: 0 0 .8em;
    }

    .answer a {
        text-decoration: underline;
    }


#summaryBar {
    position: relative;   
    padding-left: 15px; 
    height: 60px;    
}
    #summaryBar button {
        font-size: 1.5rem;
    }



.height-100 {
    height: 100px;
}

.title-underline {
    --color: #4b5563;
    --fs: 2rem;
    --line-thickness: 3px;
    --line-offset: -.12em;
    position: relative;
    display: inline-block;
    color: var(--color);
    font-size: var(--fs);
    line-height: 1.1;
    font-style: italic;
    font-weight: 500;
    letter-spacing: .02em;    
    width: 50%;
}

    .title-underline::after {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        bottom: calc(-1 * var(--line-offset));
        border-bottom: var(--line-thickness) solid currentColor;
        z-index: 0; 
    }

    .title-underline .w2 {
        font-weight: 600;
        text-transform: uppercase;
    }


.w1,
.w2 {
    font-size: clamp(1.5rem, 2vw + 0.25rem, 3rem);
    line-height: 1.2;
}


.header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center; 
    width: 100%;
    min-height: 100px;
    height: 15vh; 
    max-height: 200px;
    padding: 0 1rem;
}

    .header-flex h1 {
        margin: 0;
        font-size: clamp(1.5rem, 2vw + 0.5rem, 2.5rem);
        line-height: 1.2;
    }

    .header-flex .icons {
        display: flex;
        gap: 0.5rem;
        align-items: center;
        height: 100%; /* para que las imágenes se escalen */
    }

        .header-flex .icons img, .header-flex .icons button, .header-flex .icons button img {
            height: 70%; /* 70% del alto del contenedor padre */
            width: auto;
            object-fit: contain;
            background: transparent;
        }


#docHost {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto; 
    min-height: 0; 
    padding: 0 10px 10px;
}

#docHost .doc-host-section {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

    #docHost > .height-100 { 
        flex: 0 0 auto;
    }

    #docHost > #summaryBar, 
    #docHost > .alto-35 {   
        flex: 0 0 auto;
    }

    
    #docHost #summarizerResult {
        width: 100%;
        height: auto !important;    
        flex: 1 1 auto;             
        min-height: 0;              
        margin: 0;                  
        overflow: auto;    
        font-size: 1.5rem;
    }

#titleSummarizer {
    font-size: 1.5rem;
}

.player-wrap-video {    
    height: 100%;
    width: 100%;
}

.audio-player-wrap {
    top: 30vh;
    position: relative;
}

.title-bar {
    display: flex;
    align-items: center; /* vertical centering */
    justify-content: center; /* centers content horizontally */
    position: relative; /* allows absolute positioning inside */
}

    /* Keep the back button pinned to the left */
    .title-bar .doc-close {
        position: absolute;
        left: 0;
    }

/* Optional: style title text */
.doc-title {
    font-weight: 600;
    text-align: center;
}

button.listening {
    background: #dc3545;
}

#micBtn {
    position: relative; /* parent must be relative */
    overflow: visible; /* make sure the span can overflow */
}

#status {
    position: absolute;
    top: -40px; /* distance above button */
    right: 0; /* anchor on the right side so it expands left */
    transform: translateX(0); /* ensure right edge aligns with button */
    background-color: #1e293b;
    color: white;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.875rem;
    white-space: nowrap; /* keeps it on one line */
    pointer-events: none; /* so clicks go to the button */
    z-index: 10;
    opacity: 0; /* start hidden, if you want to animate */
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#micBtn.listening #status {
    opacity: 1;
    transform: translateX(-10px); /* slight left slide when shown */
}

.pdfjs-toolbar .pg-wrapper[style*="display: none"] {
    display: none !important;
}

#docHostGeneric iframe {
    height: 100%;
}

/* Records visual overrides */

:root {
    --record-surface: rgba(255, 255, 255, 0.88);
    --record-surface-strong: #ffffff;
    --record-border: #c8d9e9;
    --record-border-strong: #9cbad2;
    --record-text-soft: #4a5f78;
    --record-shadow: 0 16px 34px rgba(8, 35, 64, 0.12);
}

.main-panel {
    padding: 12px 14px 14px;
    border-radius: 20px;
    border: 1px solid rgba(182, 207, 227, 0.82);
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.9), rgba(240, 248, 255, 0.78));
    box-shadow: var(--record-shadow);
}

.search-bar {
    margin-top: 0 !important;
}

#recordsListViewContainer {
    border-radius: 14px;
    border: 1px solid var(--record-border);
    background: var(--record-surface);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
    padding: 8px;
}

#recordsListView .k-listview-content {
    gap: 14px;
    padding: 6px;
}

.record-card {
    border: 1px solid var(--record-border);
    border-radius: 14px;
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.98), rgba(243, 251, 255, 0.86));
    box-shadow: 0 8px 18px rgba(8, 35, 64, 0.08);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.25s ease;
}

.record-card:hover {
    border-color: var(--record-border-strong);
    transform: translateY(-2px);
    box-shadow: 0 18px 34px rgba(8, 35, 64, 0.14);
}

.record-title {
    color: #0f2941;
    font-weight: 700;
}

.doc-count {
    margin-top: 10px;
    border-top: 1px dashed #d2dfeb;
    padding-top: 10px;
    color: var(--record-text-soft);
    font-size: 0.92rem;
}

.doc-count .count {
    color: #083550;
}

.btn-transparency {
    border: 1px solid rgba(170, 198, 220, 0.95);
    background: rgba(255, 255, 255, 0.88);
    border-radius: 12px;
}

.btn-transparency:hover {
    border-color: #7faecc;
    background: #fff;
}

#_docsLayer,
.doc-layer {
    background: rgba(244, 250, 255, 0.96) !important;
    backdrop-filter: blur(2px);
}

.doc-canvas {
    margin: clamp(10px, 2vw, 22px);
    border: 1px solid var(--record-border);
    border-radius: 18px;
    background: linear-gradient(170deg, rgba(255, 255, 255, 0.98), rgba(240, 248, 255, 0.92));
    box-shadow: var(--record-shadow);
}

.title-bar,
#_docsLayer .layer-header {
    min-height: 56px;
    border-bottom: 1px solid var(--record-border);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(237, 246, 255, 0.88));
    padding: 8px 12px;
}

.doc-title {
    font-size: 1.05rem;
    color: #14324d;
}

.doc-close {
    border-radius: 10px !important;
    border-color: var(--record-border-strong) !important;
    background: #fff;
}

.doc-toolbar {
    min-height: 72px;
    border-top: 1px solid var(--record-border);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

.icon-btn {
    border-radius: 12px;
    border: 1px solid transparent;
}

.icon-btn:hover {
    border-color: var(--record-border-strong);
    background: rgba(233, 246, 255, 0.92);
}

.page-input {
    border-radius: 8px;
    border-color: var(--record-border-strong);
}

#docHost {
    border-radius: 12px;
}

#_docsGrid .ctx-actions {
    border: 1px solid #b7cee2;
    border-radius: 12px;
    box-shadow: 0 16px 30px rgba(8, 35, 64, 0.16);
}

#_docsGrid .ctx-btn {
    border-radius: 10px;
    border-color: #b7cee2;
}

#_docsGrid .ctx-btn:hover {
    background: #edf8ff;
    box-shadow: inset 0 0 0 2px #91b8d6;
}

#_docsGrid .k-grid,
#_gridDetails .k-grid,
#docsTable .k-grid {
    border-radius: 12px;
    border-color: #bfd4e7;
}

#_docsGrid .k-grid-content,
#_gridDetails .k-grid-content,
#docsTable .k-grid-content {
    background: rgba(255, 255, 255, 0.9);
}

#_docsGrid .k-grid tbody tr:hover,
#_gridDetails .k-grid tbody tr:hover,
#docsTable .k-grid tbody tr:hover {
    background: rgba(214, 236, 250, 0.55) !important;
}

#arcangelRagPanel {
    background: linear-gradient(160deg, rgba(241, 248, 255, 0.98), rgba(229, 242, 255, 0.94));
}

#arcangelRagPanel .chat-header,
#arcangelRagPanel .chat-body,
#arcangelRagPanel .chat-footer {
    background: rgba(255, 255, 255, 0.88);
}

#arcangelRagPanel .msg.ai {
    background: #173653 !important;
    color: #f5fbff !important;
}

#arcangelRagPanel .msg.user {
    background: #d9edf8 !important;
    color: #173653 !important;
}

#txtQuestion.rag-input {
    background: #fff;
    color: #1d3552;
    border-color: #b9cee2;
}

#txtQuestion.rag-input::placeholder {
    color: #7890ac;
}

#btnAsk.rag-btn {
    border-color: #93b5cf;
}

.pdfjs-toolbar {
    border-bottom-color: #cadceb;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(237, 246, 255, 0.88));
}

.pdfjs-comments-panel {
    border-left-color: #cadceb;
    background: rgba(255, 255, 255, 0.98);
}

.pdfjs-comment-item {
    border-color: #d4e1ee;
}

.pdfjs-comment-item:hover,
.pdfjs-comment-item:focus-visible {
    border-color: #90b8d7;
    box-shadow: 0 0 0 3px rgba(31, 181, 214, 0.15);
}

@media (max-width: 991.98px) {
    .main-panel {
        border-radius: 16px;
        padding: 10px;
    }

    .doc-canvas {
        margin: 8px;
    }
}

@media (max-width: 767.98px) {
    .main-panel {
        border-radius: 0;
        border-left: 0;
        border-right: 0;
        box-shadow: none;
        background: transparent;
    }

    #recordsListViewContainer {
        padding: 4px;
    }

    .record-card {
        border-radius: 12px;
    }

    .doc-canvas {
        margin: 0;
        border-radius: 0;
        border-left: 0;
        border-right: 0;
        border-bottom: 0;
    }
}

/* ===== Compact Neumorphism Override ===== */
:root {
    --record-neu-surface: #edf1f9;
    --record-neu-soft: #f4f7fd;
    --record-neu-ink: #4a5683;
    --record-neu-accent: #6d6fd4;
    --record-neu-out: 8px 8px 16px rgba(177, 186, 208, 0.6), -8px -8px 16px rgba(255, 255, 255, 0.95);
    --record-neu-in: inset 4px 4px 10px rgba(184, 193, 214, 0.54), inset -4px -4px 10px rgba(255, 255, 255, 0.95);
}

.main-panel {
    padding: 10px;
    border: 0;
    border-radius: 18px;
    background: var(--record-neu-surface);
    box-shadow: var(--record-neu-out);
}

.search-bar {
    flex: 0 0 44px;
    max-height: 44px;
}

#recordsListViewContainer {
    border: 0;
    border-radius: 14px;
    background: var(--record-neu-soft);
    box-shadow: var(--record-neu-in);
    padding: 6px;
}

#recordsListView .k-listview-content {
    gap: 10px;
    padding: 4px;
}

.record-card {
    border: 0;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: clamp(.76rem, .7vw + .35rem, .95rem);
    background: var(--record-neu-soft);
    box-shadow: var(--record-neu-out);
}

.record-card:hover {
    border-color: transparent;
    box-shadow: 10px 10px 18px rgba(175, 185, 206, 0.62), -8px -8px 18px rgba(255, 255, 255, 0.98);
    transform: translateY(-1px);
}

.record-header {
    gap: 8px;
}

.record-icon {
    height: calc(var(--card-h) * 0.36);
}

.record-icon-sec {
    min-height: 28px;
    height: calc(var(--card-h) * 0.08);
}

.record-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--record-neu-ink);
}

.doc-count {
    margin-top: 8px;
    padding-top: 8px;
    font-size: 0.78rem;
    color: #6b769b;
}

.doc-count .count {
    font-size: 0.86rem;
    color: #505b88;
}

.btn-transparency {
    border: 0;
    background: var(--record-neu-soft);
    box-shadow: var(--record-neu-out);
}

.btn-transparency:hover {
    background: var(--record-neu-soft);
}

.doc-layer,
#_docsLayer {
    background: #e9edf7 !important;
}

.doc-canvas {
    margin: 10px;
    border: 0;
    border-radius: 14px;
    background: var(--record-neu-soft);
    box-shadow: var(--record-neu-out);
}

.title-bar,
#_docsLayer .layer-header {
    min-height: 46px;
    padding: 6px 10px;
    border-bottom: 0;
    background: transparent;
}

.doc-title {
    font-size: .92rem;
    color: #505b88;
}

.doc-close {
    border: 0 !important;
    background: var(--record-neu-surface) !important;
    box-shadow: var(--record-neu-out);
}

.doc-close img {
    height: 20px;
}

.doc-toolbar {
    flex: 0 0 52px;
    min-height: 52px;
    padding: 6px 12px;
    border-top: 0;
    background: transparent;
    box-shadow: none;
}

.icon-btn {
    padding: 6px;
    border: 0;
    border-radius: 10px;
    background: var(--record-neu-surface);
    box-shadow: var(--record-neu-out);
}

.icon-btn img {
    height: 32px;
}

.page-input {
    width: 56px;
    padding: 3px 4px;
    border: 0;
    border-radius: 8px;
    box-shadow: var(--record-neu-in);
    font-size: 0.78rem;
}

.page-label {
    font-size: 0.8rem;
}

#_docsGrid .ctx-actions {
    border: 0;
    border-radius: 10px;
    background: #f0f4fb;
    box-shadow: var(--record-neu-out);
}

#_docsGrid .ctx-btn {
    width: 78px;
    height: 62px;
    border: 0;
    border-radius: 10px;
    background: var(--record-neu-soft);
    box-shadow: var(--record-neu-out);
}

#_docsGrid .ctx-btn img {
    width: 22px;
    height: 22px;
}

#_docsGrid .ctx-btn span {
    font-size: 10px;
    color: #5d688f;
}

#_docsGrid .k-grid,
#_gridDetails .k-grid,
#docsTable .k-grid {
    border: 0;
    box-shadow: var(--record-neu-in);
}

#_docsGrid .k-grid-content tr {
    height: 70px;
}

#arcangelRagPanel .chat-header,
#arcangelRagPanel .chat-body,
#arcangelRagPanel .chat-footer {
    background: rgba(242, 246, 253, 0.92);
}

#arcangelRagPanel .msg.ai {
    background: #646fc2 !important;
}

#arcangelRagPanel .msg.user {
    background: #e3e8fb !important;
    color: #4a5683 !important;
}

#txtQuestion.rag-input {
    border: 0;
    border-radius: 10px;
    box-shadow: var(--record-neu-in);
}

#btnAsk.rag-btn {
    border: 0;
    box-shadow: var(--record-neu-out);
}

.pdfjs-toolbar {
    height: 38px;
    padding: 0 6px;
}

.pdfjs-toolbar .k-button.k-button-flat.k-button-md {
    min-width: 28px;
    height: 26px;
    padding: 0 6px;
}

.pdfjs-comments-panel {
    width: min(300px, 40vw);
}

.pdfjs-comment-item {
    padding: 9px 10px;
}

.pdfjs-comment-title {
    font-size: .8rem;
}

.pdfjs-comment-body {
    font-size: .76rem;
}

/* ===== Arcangel record views redesign ===== */
#arcangelRagPanel.arcangel-panel-active {
    position: fixed !important;
    inset: calc(var(--x-nav-height, 90px) + 18px) max(24px, calc((100vw - var(--x-max-page-width, 1960px)) / 2 + 24px)) 24px max(24px, calc((100vw - var(--x-max-page-width, 1960px)) / 2 + 24px)) !important;
    z-index: 1300 !important;
    display: block !important;
    height: auto !important;
    overflow: hidden !important;
    border: 1px solid rgba(125, 160, 218, 0.46) !important;
    border-radius: 26px !important;
    background:
        radial-gradient(circle at 12% 0%, rgba(38, 112, 255, 0.14), transparent 34%),
        radial-gradient(circle at 92% 12%, rgba(74, 205, 255, 0.18), transparent 28%),
        linear-gradient(145deg, rgba(247, 251, 255, 0.97), rgba(229, 239, 255, 0.94)) !important;
    color: var(--x-text, #0f2447) !important;
    box-shadow: 0 28px 80px rgba(20, 48, 100, 0.24) !important;
}

#arcangelRagPanel.arcangel-panel-active::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, rgba(31, 98, 240, 0.16) 1px, transparent 1px);
    background-size: 28px 28px;
    opacity: 0.35;
    mask-image: linear-gradient(180deg, transparent, #000 18%, #000 82%, transparent);
}

#arcangelRagPanel.arcangel-panel-active * {
    box-sizing: border-box;
}

#arcangelRagPanel .arcangel-grid,
#arcangelRagPanel .arcangel-grid-one-col {
    position: relative !important;
    z-index: 1;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
}

#arcangelRagPanel .arcangel-grid {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 430px) !important;
    gap: 0 !important;
}

#arcangelRagPanel .arcangel-grid-one-col {
    display: grid !important;
    grid-template-columns: 1fr !important;
}

#arcangelRagPanel .doc-wrap,
#arcangelRagPanel .chat-wrap {
    min-width: 0 !important;
    min-height: 0 !important;
    height: 100% !important;
    background: transparent !important;
}

#arcangelRagPanel .doc-wrap {
    padding: 16px !important;
    border-right: 1px solid rgba(149, 177, 222, 0.42) !important;
}

#arcangelRagPanel.arcangel-sum-panel .doc-wrap {
    border-right: 0 !important;
}

#arcangelRagPanel .doc-canvas {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    overflow: hidden !important;
    border: 1px solid rgba(157, 177, 216, 0.48) !important;
    border-radius: 22px !important;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(239, 246, 255, 0.7)) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78), 0 18px 44px rgba(22, 45, 91, 0.12) !important;
}

#arcangelRagPanel .arcangel-panel-close {
    position: absolute !important;
    top: 18px !important;
    right: 18px !important;
    z-index: 8 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 42px !important;
    height: 42px !important;
    border: 1px solid rgba(114, 149, 207, 0.5) !important;
    border-radius: 14px !important;
    background: rgba(255, 255, 255, 0.72) !important;
    color: var(--x-text-2, #27406d) !important;
    box-shadow: 0 10px 24px rgba(31, 74, 138, 0.14) !important;
}

#arcangelRagPanel .arcangel-panel-close:hover,
#arcangelRagPanel .arcangel-panel-close:focus-visible {
    border-color: var(--x-primary, #1f62f0) !important;
    color: var(--x-primary, #1f62f0) !important;
    transform: translateY(-1px);
}

#arcangelRagPanel.arcangel-sum-panel #docHost {
    position: relative !important;
    inset: auto !important;
    display: grid !important;
    grid-template-rows: auto auto auto minmax(0, 1fr) !important;
    height: 100% !important;
    min-height: 0 !important;
    padding: clamp(1.2rem, 2vw, 2rem) !important;
    overflow: hidden !important;
    background: transparent !important;
}

#arcangelRagPanel.arcangel-rag-panel #docHost {
    position: absolute !important;
    inset: 0 !important;
    padding: 0 !important;
    overflow: auto !important;
    background: rgba(223, 234, 250, 0.48) !important;
}

#arcangelRagPanel .header-flex {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    gap: 1.5rem !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    padding: 0 52px 1rem 0 !important;
}

#arcangelRagPanel .arcangel-panel-heading {
    display: grid;
    gap: 0.5rem;
    max-width: 820px;
}

#arcangelRagPanel .arcangel-panel-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    width: max-content;
    padding: 0.34rem 0.72rem;
    border: 1px solid rgba(31, 98, 240, 0.2);
    border-radius: 999px;
    background: rgba(31, 98, 240, 0.1);
    color: var(--x-primary-2, #0d3ca7);
    font-weight: 800;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

#arcangelRagPanel .title-underline {
    width: auto !important;
    color: var(--x-text, #0f2447) !important;
    font-style: normal !important;
    font-weight: 800 !important;
    line-height: 1.04 !important;
}

#arcangelRagPanel .title-underline::after {
    display: none !important;
}

#arcangelRagPanel .title-underline .w1,
#arcangelRagPanel .title-underline .w2 {
    font-size: clamp(2rem, 3vw, 3.2rem) !important;
    line-height: 1.04 !important;
}

#arcangelRagPanel .title-underline .w2 {
    color: var(--x-primary, #1f62f0) !important;
    text-transform: none !important;
}

#arcangelRagPanel .arcangel-panel-subtitle {
    max-width: 680px;
    margin: 0;
    color: var(--x-text-3, #60739a);
    font-weight: 600;
    line-height: 1.45;
}

#arcangelRagPanel .header-flex .icons {
    flex: 0 0 auto;
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    height: auto !important;
}

#arcangelRagPanel .arcangel-icon-action {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 42px;
    padding: 0 0.95rem;
    border: 1px solid rgba(31, 98, 240, 0.24);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--x-text-2, #27406d);
    font-weight: 800;
    box-shadow: 0 10px 22px rgba(31, 74, 138, 0.1);
}

#arcangelRagPanel .arcangel-icon-action img {
    width: 22px !important;
    height: 22px !important;
    object-fit: contain;
}

#arcangelRagPanel .arcangel-panel-sphere {
    width: 78px !important;
    height: 78px !important;
    object-fit: contain !important;
    filter: drop-shadow(0 12px 22px rgba(31, 98, 240, 0.16));
}

#arcangelRagPanel #summaryBar {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 0.7rem !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 0 0.75rem !important;
    padding: 0.45rem !important;
    border: 1px solid rgba(157, 177, 216, 0.48) !important;
    border-radius: 18px !important;
    background: rgba(229, 238, 252, 0.74) !important;
}

#arcangelRagPanel #summaryBar .summary-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.45rem !important;
    min-height: 48px !important;
    border: 1px solid transparent !important;
    border-radius: 14px !important;
    background: transparent !important;
    color: var(--x-text-2, #27406d) !important;
    font-size: 0.98rem !important;
    font-weight: 800 !important;
    box-shadow: none !important;
    cursor: pointer !important;
    font-family: inherit !important;
}

#arcangelRagPanel #summaryBar .summary-btn-icon {
    font-size: 1rem !important;
    line-height: 1 !important;
}

#arcangelRagPanel .summary-title-row {
    display: flex !important;
    align-items: center !important;
    padding: 0.25rem 0 !important;
}

#arcangelRagPanel #summaryBar .summary-btn[aria-pressed="true"] {
    border-color: rgba(31, 98, 240, 0.42) !important;
    background: linear-gradient(135deg, #2a73ff, #0d3ca7) !important;
    color: #fff !important;
    box-shadow: 0 12px 24px rgba(31, 98, 240, 0.22) !important;
}

#arcangelRagPanel #titleSummarizer {
    display: inline-flex;
    max-width: 100%;
    padding: 0.36rem 0.72rem !important;
    border-radius: 999px;
    background: rgba(31, 98, 240, 0.1);
    color: var(--x-text-2, #27406d);
    font-size: 0.95rem !important;
    font-weight: 800 !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#arcangelRagPanel #summarizerResult {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: clamp(1rem, 1.5vw, 1.5rem) !important;
    overflow: auto !important;
    border: 1px solid rgba(157, 177, 216, 0.48) !important;
    border-radius: 18px !important;
    background: rgba(255, 255, 255, 0.76) !important;
    color: var(--x-text, #0f2447) !important;
    font-size: 1.02rem !important;
    line-height: 1.7 !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72), 0 14px 32px rgba(31, 74, 138, 0.1) !important;
}

#arcangelRagPanel .chat-wrap {
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) auto !important;
    border-left: 1px solid rgba(255, 255, 255, 0.44) !important;
}

#arcangelRagPanel .chat-header,
#arcangelRagPanel .chat-body,
#arcangelRagPanel .chat-footer {
    min-width: 0 !important;
    max-width: none !important;
    background: rgba(255, 255, 255, 0.72) !important;
    color: var(--x-text, #0f2447) !important;
}

#arcangelRagPanel .chat-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    min-height: 76px !important;
    height: auto !important;
    padding: 1rem 1.15rem !important;
    border-bottom: 1px solid rgba(157, 177, 216, 0.48) !important;
}

#arcangelRagPanel .arcangel-chat-title {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

#arcangelRagPanel .arcangel-chat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(135deg, #2a73ff, #0d3ca7);
    color: #fff;
    box-shadow: 0 10px 24px rgba(31, 98, 240, 0.22);
}

#arcangelRagPanel .arcangel-chat-title strong {
    display: block;
    color: var(--x-text, #0f2447);
    font-size: 1.08rem;
    line-height: 1.1;
}

#arcangelRagPanel #spanTitleRag {
    display: block;
    max-width: 100%;
    margin-top: 0.22rem;
    color: var(--x-text-3, #60739a);
    font-size: 0.82rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#arcangelRagPanel .chat-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

#arcangelRagPanel .msg {
    width: fit-content;
    max-width: min(92%, 760px) !important;
    margin: 0 !important;
    padding: 0.9rem 1rem !important;
    border-radius: 16px !important;
    font-weight: 600;
    line-height: 1.55 !important;
    box-shadow: 0 12px 26px rgba(22, 45, 91, 0.12);
}

#arcangelRagPanel .msg.ai {
    align-self: flex-start;
    background: #eef4ff !important;
    color: var(--x-text, #0f2447) !important;
    border: 1px solid rgba(157, 177, 216, 0.5);
}

#arcangelRagPanel .msg.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #2a73ff, #0d3ca7) !important;
    color: #fff !important;
}

#arcangelRagPanel .voice-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-top: 0.75rem;
    min-width: 42px !important;
    min-height: 38px !important;
    border: 1px solid rgba(31, 98, 240, 0.24) !important;
    border-radius: 12px !important;
    background: rgba(255, 255, 255, 0.8) !important;
    color: var(--x-primary, #1f62f0) !important;
    cursor: pointer !important;
}

#arcangelRagPanel .ref-links .k-button {
    border-color: rgba(31, 98, 240, 0.24) !important;
    border-radius: 12px !important;
    background: rgba(255, 255, 255, 0.8) !important;
    color: var(--x-text-2, #27406d) !important;
}

#arcangelRagPanel .chat-footer {
    padding: 1rem !important;
    border-top: 1px solid rgba(157, 177, 216, 0.48) !important;
}

#arcangelRagPanel .chat-footer .k-hstack {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto auto !important;
    gap: 0.55rem !important;
    align-items: center !important;
}

#arcangelRagPanel #txtQuestion.rag-input {
    width: 100% !important;
    min-height: 46px !important;
    border: 1px solid rgba(157, 177, 216, 0.72) !important;
    border-radius: 14px !important;
    background: rgba(255, 255, 255, 0.88) !important;
    color: var(--x-text, #0f2447) !important;
    box-shadow: none !important;
}

#arcangelRagPanel #txtQuestion.rag-input::placeholder {
    color: var(--x-text-3, #60739a) !important;
}

#arcangelRagPanel #btnAsk.rag-btn,
#arcangelRagPanel #micBtn {
    min-height: 46px !important;
    border: 1px solid rgba(31, 98, 240, 0.28) !important;
    border-radius: 14px !important;
    box-shadow: none !important;
}

#arcangelRagPanel #btnAsk.rag-btn {
    background: linear-gradient(135deg, #2a73ff, #0d3ca7) !important;
    color: #fff !important;
    font-weight: 800 !important;
}

#arcangelRagPanel #micBtn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 46px !important;
    padding: 0 !important;
    background: rgba(255, 255, 255, 0.84) !important;
    color: var(--x-primary, #1f62f0) !important;
    cursor: pointer !important;
    font-family: inherit !important;
}

#arcangelRagPanel #docLoader,
#arcangelRagPanel #chatLoader .k-loading-mask {
    background: rgba(239, 246, 255, 0.72) !important;
    color: var(--x-text, #0f2447) !important;
}

html[data-theme="dark"] #arcangelRagPanel.arcangel-panel-active {
    border-color: rgba(100, 168, 248, 0.42) !important;
    background:
        radial-gradient(circle at 12% 0%, rgba(68, 215, 255, 0.12), transparent 34%),
        radial-gradient(circle at 92% 12%, rgba(139, 124, 255, 0.14), transparent 28%),
        linear-gradient(145deg, rgba(7, 22, 45, 0.98), rgba(15, 48, 88, 0.96)) !important;
    color: var(--x-text, #f3f8ff) !important;
    box-shadow: 0 34px 92px rgba(1, 8, 22, 0.68), 0 0 42px rgba(68, 215, 255, 0.08) !important;
}

html[data-theme="dark"] #arcangelRagPanel.arcangel-panel-active::before {
    background-image: radial-gradient(circle, rgba(68, 215, 255, 0.2) 1px, transparent 1px);
    opacity: 0.28;
}

html[data-theme="dark"] #arcangelRagPanel .doc-canvas {
    border-color: rgba(100, 168, 248, 0.34) !important;
    background:
        radial-gradient(circle at 18% 0%, rgba(68, 215, 255, 0.08), transparent 36%),
        linear-gradient(180deg, rgba(11, 34, 66, 0.82), rgba(6, 20, 42, 0.82)) !important;
    box-shadow: inset 0 1px 0 rgba(164, 207, 255, 0.08), 0 18px 44px rgba(1, 8, 22, 0.3) !important;
}

html[data-theme="dark"] #arcangelRagPanel .doc-wrap {
    border-right-color: rgba(100, 168, 248, 0.28) !important;
}

html[data-theme="dark"] #arcangelRagPanel .arcangel-panel-close,
html[data-theme="dark"] #arcangelRagPanel .arcangel-icon-action,
html[data-theme="dark"] #arcangelRagPanel #micBtn,
html[data-theme="dark"] #arcangelRagPanel .voice-btn,
html[data-theme="dark"] #arcangelRagPanel .ref-links .k-button {
    border-color: rgba(100, 168, 248, 0.38) !important;
    background: rgba(18, 50, 91, 0.82) !important;
    color: var(--x-text-2, #c9ddff) !important;
    box-shadow: 0 12px 24px rgba(1, 8, 22, 0.24) !important;
}

html[data-theme="dark"] #arcangelRagPanel .arcangel-panel-kicker,
html[data-theme="dark"] #arcangelRagPanel #titleSummarizer {
    border-color: rgba(68, 215, 255, 0.2);
    background: rgba(68, 215, 255, 0.1);
    color: var(--x-cyan, #44d7ff);
}

html[data-theme="dark"] #arcangelRagPanel .title-underline,
html[data-theme="dark"] #arcangelRagPanel .arcangel-chat-title strong,
html[data-theme="dark"] #arcangelRagPanel #summarizerResult,
html[data-theme="dark"] #arcangelRagPanel .chat-header,
html[data-theme="dark"] #arcangelRagPanel .chat-body,
html[data-theme="dark"] #arcangelRagPanel .chat-footer {
    color: var(--x-text, #f3f8ff) !important;
}

html[data-theme="dark"] #arcangelRagPanel .title-underline .w2 {
    color: var(--x-cyan, #44d7ff) !important;
}

html[data-theme="dark"] #arcangelRagPanel .arcangel-panel-subtitle,
html[data-theme="dark"] #arcangelRagPanel #spanTitleRag {
    color: var(--x-text-3, #92b3e9) !important;
}

html[data-theme="dark"] #arcangelRagPanel #summaryBar {
    border-color: rgba(100, 168, 248, 0.32) !important;
    background: rgba(8, 28, 56, 0.72) !important;
}

html[data-theme="dark"] #arcangelRagPanel #summaryBar .summary-btn {
    color: var(--x-text-2, #c9ddff) !important;
}

html[data-theme="dark"] #arcangelRagPanel #summaryBar .summary-btn[aria-pressed="true"],
html[data-theme="dark"] #arcangelRagPanel #btnAsk.rag-btn,
html[data-theme="dark"] #arcangelRagPanel .arcangel-chat-icon {
    border-color: rgba(68, 215, 255, 0.4) !important;
    background: linear-gradient(135deg, #2577ff, #083a9f) !important;
    color: #fff !important;
    box-shadow: 0 12px 26px rgba(37, 119, 255, 0.2), 0 0 18px rgba(68, 215, 255, 0.1) !important;
}

html[data-theme="dark"] #arcangelRagPanel #summarizerResult,
html[data-theme="dark"] #arcangelRagPanel .chat-header,
html[data-theme="dark"] #arcangelRagPanel .chat-body,
html[data-theme="dark"] #arcangelRagPanel .chat-footer {
    border-color: rgba(100, 168, 248, 0.28) !important;
    background: rgba(8, 28, 56, 0.72) !important;
}

html[data-theme="dark"] #arcangelRagPanel .msg.ai {
    border-color: rgba(100, 168, 248, 0.34) !important;
    background: rgba(17, 50, 91, 0.9) !important;
    color: var(--x-text, #f3f8ff) !important;
}

html[data-theme="dark"] #arcangelRagPanel .msg.user {
    background: linear-gradient(135deg, #1e6bff, #0b48bc) !important;
    color: #fff !important;
}

html[data-theme="dark"] #arcangelRagPanel #txtQuestion.rag-input {
    border-color: rgba(100, 168, 248, 0.38) !important;
    background: rgba(5, 20, 43, 0.86) !important;
    color: var(--x-text, #f3f8ff) !important;
}

html[data-theme="dark"] #arcangelRagPanel #txtQuestion.rag-input::placeholder {
    color: var(--x-text-3, #92b3e9) !important;
}

html[data-theme="dark"] #arcangelRagPanel.arcangel-rag-panel #docHost {
    background: rgba(4, 17, 36, 0.66) !important;
}

html[data-theme="dark"] #arcangelRagPanel #docLoader,
html[data-theme="dark"] #arcangelRagPanel #chatLoader .k-loading-mask {
    background: rgba(4, 17, 36, 0.72) !important;
    color: var(--x-text, #f3f8ff) !important;
}

@media (max-width: 1100px) {
    #arcangelRagPanel.arcangel-panel-active {
        inset: calc(var(--x-nav-height, 90px) + 10px) 12px 12px 12px !important;
        border-radius: 20px !important;
    }

    #arcangelRagPanel .arcangel-grid {
        grid-template-columns: 1fr !important;
        grid-template-rows: minmax(360px, 58%) minmax(320px, 42%) !important;
    }

    #arcangelRagPanel .doc-wrap {
        border-right: 0 !important;
        border-bottom: 1px solid rgba(149, 177, 222, 0.42) !important;
    }
}

@media (max-width: 720px) {
    #arcangelRagPanel .doc-wrap {
        padding: 10px !important;
    }

    #arcangelRagPanel .header-flex {
        flex-direction: column !important;
        padding-right: 46px !important;
    }

    #arcangelRagPanel #summaryBar {
        grid-template-columns: 1fr !important;
    }

    #arcangelRagPanel .chat-footer .k-hstack {
        grid-template-columns: 1fr !important;
    }

    #arcangelRagPanel #btnAsk.rag-btn,
    #arcangelRagPanel #micBtn {
        width: 100% !important;
    }
}

/* ===== Records Modern Compact List Patch ===== */
.main-panel {
    height: calc(100vh - 74px);
    min-height: 0;
    min-width: 0;
    gap: 10px;
}

.main-panel .search-bar {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0 !important;
}

.main-panel .search-bar advanced-search {
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

#recordsListViewContainer {
    padding: 10px;
    border-radius: 16px;
}

#recordsListView {
    height: 100%;
}

#recordsListView .k-listview-content {
    grid-template-columns: repeat(auto-fill, minmax(clamp(280px, 23vw, 360px), 1fr));
    align-content: start;
    gap: 12px;
    padding: 8px;
}

.record-card {
    height: auto !important;
    min-height: 11px;
    max-height: none;
    border-radius: 14px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: 1px solid #9cb0d8;
    background: linear-gradient(165deg, #f8fbff 0%, #f0f5ff 100%);
    box-shadow: 0 8px 16px rgba(110, 128, 167, 0.18);
}

.record-card:hover {
    transform: translateY(-1px);
    border-color: #6f8fc8;
    box-shadow: 0 12px 22px rgba(95, 113, 152, 0.24);
}

.record-header {
    gap: 10px;
    align-items: flex-start;
}

.record-icon {
    width: 46px;
    height: 46px;
    object-fit: contain;
    flex: 0 0 auto;
}

.record-title {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
    line-height: 1.2;
}

.record-kicker {
    display: inline-block;
    font-size: 0.69rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 800;
    color: #5a709d;
}

.record-title strong {
    font-size: 0.95rem;
    line-height: 1.22;
}

.record-title strong span {
    display: -webkit-box;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.record-icon-sec {
    margin-left: auto;
    width: 22px;
    height: 22px;
    min-height: 22px;
    align-self: flex-start;
}

.doc-count {
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px dashed #c8d5ea;
    font-size: 0.76rem;
    color: #4e6390;
}

.doc-count .count {
    font-size: 0.84rem;
    color: #2c4371;
}

@media (max-width: 991.98px) {
    .main-panel {
        height: auto;
    }

    #recordsListViewContainer {
        height: calc(100vh - 180px);
    }

    #recordsListView .k-listview-content {
        grid-template-columns: 1fr;
    }
}

/* PDF viewer modern toolbar */
#docHostPdf .pdfjs-toolbar {
    min-height: 56px;
    height: auto;
    padding: 8px 12px;
    background: linear-gradient(90deg, #133869 0%, #1f4f8a 45%, #2b6aae 100%);
    border-bottom: 1px solid #103057;
    color: #f3f6fb;
}

#docHostPdf .pdfjs-toolbar-center {
    width: calc(100% - 56px);
    justify-content: flex-start;
    gap: 10px;
    flex-wrap: wrap;
    padding-left: 46px;
}

#docHostPdf .pdfjs-toolbar .k-button {
    color: #f3f6fb;
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
}

#docHostPdf .pdfjs-toolbar .k-button:hover {
    background: rgba(255, 255, 255, 0.18);
}

#docHostPdf .pdfjs-close-btn {
    position: static !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    border-radius: 10px !important;
    background: rgba(255, 255, 255, 0.1) !important;
    color: #f3f6fb;
    cursor: pointer;
    box-shadow: none;
}

#docHostPdf .pdfjs-close-btn:hover {
    background: rgba(255, 255, 255, 0.2) !important;
}

#docHostPdf .pdfjs-close-btn img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

#docHostPdf .pdfjs-toolbar .k-input {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.18);
    color: #f3f6fb;
}

#docHostPdf .pdfjs-page-control,
#docHostPdf .pdfjs-zoom-control {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

#docHostPdf .pdfjs-zoom-suffix {
    margin-left: 0.25rem;
}

#docHostPdf .pdfjs-toolbar .k-input .k-input-inner,
#docHostPdf .pdfjs-toolbar .k-input .k-input-suffix {
    color: #f3f6fb;
}

#docHostPdf .pdfjs-find-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 280px;
    padding: 4px 6px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.1);
}

#docHostPdf .pdfjs-find-input {
    width: 180px;
    min-width: 120px;
    border: 0;
    outline: 0;
    color: #f3f6fb;
    background: transparent;
}

#docHostPdf .pdfjs-find-input::placeholder {
    color: rgba(243, 246, 251, 0.78);
}

#docHostPdf .pdfjs-find-status {
    min-width: 68px;
    font-size: 0.82rem;
    color: rgba(243, 246, 251, 0.9);
}

#docHostPdf .pdfjs-container {
    background: #d8e0ef;
}

#docHostPdf .pdfjs-container .pdfViewer .page {
    box-shadow: 0 8px 24px rgba(8, 26, 48, 0.16) !important;
    border-radius: 8px;
}

/* Modern record PDF shell */
.doc-layer.pdf-mode {
    background:
        radial-gradient(circle at top left, rgba(89, 144, 255, 0.14), transparent 24%),
        radial-gradient(circle at top right, rgba(26, 77, 174, 0.08), transparent 18%),
        linear-gradient(180deg, #eef3ff 0%, #e7eefc 100%);
}

.doc-layer.pdf-mode .title-bar,
.doc-layer.pdf-mode .doc-toolbar {
    display: none !important;
}

.doc-layer.pdf-mode .doc-canvas {
    margin: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.doc-layer.pdf-mode #docHost {
    padding: 0;
}

.doc-layer.pdf-mode #docHostPdf,
.doc-layer.pdf-mode #docHostPdf .doc-host-section {
    height: 100%;
}

.xpdf-shell {
    height: 100%;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 28px;
    color: #102647;
}

.xpdf-header {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.xpdf-header-main {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    min-width: 0;
}

.xpdf-back-btn {
    width: 58px;
    height: 58px;
    flex: 0 0 58px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(120, 149, 203, 0.28);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 16px 40px rgba(28, 67, 129, 0.10);
}

.xpdf-back-btn img {
    height: 24px;
}

.xpdf-header-copy {
    min-width: 0;
}

.xpdf-breadcrumbs {
    margin-bottom: 10px;
    color: #6c7fa8;
    font-size: 0.92rem;
    letter-spacing: 0.02em;
}

.xpdf-title {
    margin: 0;
    color: #0e274c;
    font-size: clamp(2rem, 1.4rem + 1.6vw, 3.1rem);
    line-height: 1.05;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.xpdf-meta {
    margin-top: 12px;
    color: #6d80a8;
    font-size: 1rem;
}

.xpdf-header-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.xpdf-action-btn {
    min-height: 56px;
    padding: 0 22px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border-radius: 18px;
    border: 1px solid #c0d4fb;
    font-size: 1rem;
    font-weight: 700;
    box-shadow: 0 12px 30px rgba(33, 78, 144, 0.08);
}

.xpdf-action-btn.is-secondary {
    background: rgba(255, 255, 255, 0.9);
    color: #1567e5;
}

.xpdf-action-btn.is-primary {
    background: linear-gradient(135deg, #115be4 0%, #2b87ff 100%);
    color: #fff;
    border-color: transparent;
}

.xpdf-workspace {
    min-height: 0;
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr) 320px;
    gap: 0;
    border-radius: 30px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.58);
    box-shadow: 0 28px 60px rgba(20, 52, 103, 0.12);
    border: 1px solid rgba(169, 189, 228, 0.34);
}

.xpdf-left-rail,
.xpdf-right-panel {
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(18px);
}

.xpdf-left-rail {
    display: flex;
    flex-direction: column;
    min-width: 0;
    border-right: 1px solid rgba(172, 190, 225, 0.5);
    transition: width 0.24s ease, min-width 0.24s ease, flex-basis 0.24s ease;
}

.xpdf-left-rail.is-collapsed {
    width: 74px;
    min-width: 74px;
}

.xpdf-left-rail.is-collapsed .xpdf-left-kicker,
.xpdf-left-rail.is-collapsed .xpdf-left-count,
.xpdf-left-rail.is-collapsed .xpdf-thumb-label {
    display: none;
}

.xpdf-left-head {
    min-height: 108px;
    padding: 22px 20px 16px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    background: linear-gradient(180deg, #0f2d56 0%, #14386b 100%);
    color: #fff;
}

.xpdf-left-kicker {
    font-size: 0.9rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.7;
}

.xpdf-left-count {
    margin-top: 8px;
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
}

.xpdf-rail-toggle {
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.xpdf-thumbs {
    padding: 18px 14px 22px;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.xpdf-thumb {
    border: 1px solid transparent;
    border-radius: 18px;
    background: transparent;
    padding: 10px 10px 14px;
    color: #2e4b7f;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.xpdf-thumb:hover,
.xpdf-thumb.is-active {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(37, 99, 235, 0.32);
    box-shadow: 0 16px 32px rgba(28, 67, 129, 0.14);
    transform: translateY(-1px);
}

.xpdf-thumb-canvas-wrap {
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
    border: 1px solid rgba(182, 198, 226, 0.5);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.6);
}

.xpdf-thumb canvas {
    width: 100%;
    height: auto;
    display: block;
}

.xpdf-thumb-label {
    margin-top: 8px;
    display: inline-block;
    font-weight: 700;
    font-size: 0.92rem;
}

.xpdf-center {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background:
        linear-gradient(180deg, rgba(17, 46, 93, 0.96) 0%, rgba(22, 57, 108, 0.92) 100%) top/100% 84px no-repeat,
        linear-gradient(180deg, #dbe4f6 0%, #d4def2 100%);
}

.xpdf-toolbar {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.xpdf-toolbar-group {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.xpdf-toolbar-group.is-search {
    margin-left: auto;
    flex-wrap: nowrap;
}

.xpdf-tool-btn,
.xpdf-wide-btn {
    min-height: 48px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}

.xpdf-tool-btn {
    min-width: 48px;
    padding: 0 14px;
}

.xpdf-wide-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0 18px;
    font-weight: 700;
}

.xpdf-zoom-pill,
.xpdf-page-pill {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.xpdf-zoom-pill input,
.xpdf-page-pill input {
    width: 62px;
    border: 0;
    outline: 0;
    background: transparent;
    color: #fff;
    text-align: center;
    font-weight: 700;
}

.xpdf-search-box {
    min-width: 260px;
    flex: 1 1 320px;
    min-height: 48px;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.88);
}

.xpdf-search-box input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: #fff;
}

.xpdf-search-box input::placeholder {
    color: rgba(255,255,255,0.68);
}

.xpdf-search-status {
    min-width: 56px;
    color: rgba(255,255,255,0.82);
    font-weight: 700;
    text-align: center;
}

.xpdf-stage {
    min-height: 0;
    flex: 1 1 auto;
    padding: 10px 10px 12px;
}

.xpdf-scroll {
    height: 100%;
    overflow: auto;
    overscroll-behavior: contain;
    border-radius: 22px;
    background: rgba(240, 244, 253, 0.72);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.7);
}

.xpdf-viewer-surface {
    min-height: 100%;
    padding: 20px 18px 28px;
}

.xpdf-scroll .page {
    margin: 0 auto 22px !important;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 18px 42px rgba(30, 65, 119, 0.18) !important;
}

.xpdf-right-panel {
    min-width: 0;
    display: flex;
    flex-direction: column;
    border-left: 1px solid rgba(172, 190, 225, 0.5);
}

.xpdf-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-bottom: 1px solid rgba(181, 196, 224, 0.45);
}

.xpdf-tab {
    min-height: 76px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: transparent;
    color: #60739a;
    border: 0;
    border-bottom: 3px solid transparent;
    font-weight: 700;
}

.xpdf-tab.is-active {
    color: #2164e8;
    background: rgba(255,255,255,0.44);
    border-bottom-color: #2164e8;
}

.xpdf-tab-panel {
    display: none;
    min-height: 0;
    flex: 1 1 auto;
    padding: 18px;
    overflow: auto;
}

.xpdf-tab-panel.is-active {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.xpdf-card {
    border-radius: 22px;
    background: rgba(255,255,255,0.76);
    border: 1px solid rgba(190, 205, 232, 0.5);
    box-shadow: 0 16px 40px rgba(25, 61, 116, 0.08);
    padding: 18px;
}

.xpdf-card-fill {
    min-height: 100%;
}

.xpdf-card-title {
    margin-bottom: 14px;
    color: #17355e;
    font-size: 1.04rem;
    font-weight: 800;
}

.xpdf-card-body {
    color: #4d628b;
    line-height: 1.7;
}

.xpdf-side-search {
    display: flex;
    gap: 10px;
}

.xpdf-side-search input {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 50px;
    padding: 0 16px;
    border-radius: 16px;
    border: 1px solid rgba(180, 197, 225, 0.7);
    background: rgba(245, 248, 255, 0.95);
    color: #17355e;
}

.xpdf-side-search-btn {
    width: 56px;
    height: 50px;
    border-radius: 16px;
    border: 0;
    background: linear-gradient(135deg, #113f89 0%, #0f2d56 100%);
    color: #fff;
}

.xpdf-quick-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.xpdf-quick-btn {
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: 20px;
    border: 1px solid rgba(186, 203, 232, 0.72);
    background: linear-gradient(180deg, rgba(246, 249, 255, 0.95) 0%, rgba(232, 239, 251, 0.95) 100%);
    color: #1b3861;
    font-weight: 700;
}

.xpdf-outline-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.xpdf-outline-item {
    min-height: 44px;
    padding: 10px 14px;
    text-align: left;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: #2a4675;
    font-weight: 600;
}

.xpdf-outline-item:hover {
    background: rgba(236, 243, 255, 0.92);
}

.xpdf-empty-state {
    color: #7386aa;
    line-height: 1.7;
}

@media (max-width: 1440px) {
    .xpdf-workspace {
        grid-template-columns: 220px minmax(0, 1fr) 300px;
    }
}

@media (max-width: 1180px) {
    .xpdf-shell {
        padding: 18px;
    }

    .xpdf-workspace {
        grid-template-columns: 180px minmax(0, 1fr);
    }

    .xpdf-right-panel {
        grid-column: 1 / -1;
        border-left: 0;
        border-top: 1px solid rgba(172, 190, 225, 0.5);
    }
}

@media (max-width: 860px) {
    .xpdf-header {
        flex-direction: column;
    }

    .xpdf-workspace {
        grid-template-columns: 1fr;
    }

    .xpdf-left-rail {
        display: none;
    }

    .xpdf-toolbar {
        padding: 12px;
    }

    .xpdf-toolbar-group.is-search {
        width: 100%;
        margin-left: 0;
        flex-wrap: wrap;
    }

    .xpdf-search-box {
        min-width: 0;
        width: 100%;
    }

    .xpdf-quick-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Records screen refresh */
.records-shell {
    position: relative;
    min-height: 100%;
    background:
        radial-gradient(circle at top left, rgba(93, 150, 255, 0.15), transparent 22%),
        radial-gradient(circle at top right, rgba(18, 54, 113, 0.08), transparent 18%),
        linear-gradient(180deg, #eff4ff 0%, #e6edf9 100%);
}

.records-shell .records-main {
    position: relative;
    overflow: hidden;
    gap: 14px;
    padding: 20px;
    border-radius: 28px;
    border: 1px solid rgba(183, 204, 232, 0.82);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(244, 248, 255, 0.92)),
        radial-gradient(circle at top, rgba(255, 255, 255, 0.72), transparent 55%);
    box-shadow:
        0 24px 60px rgba(16, 43, 84, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.records-shell .records-header {
    position: relative;
    overflow: hidden;
    padding: 24px 28px;
    border-radius: 24px;
    border: 1px solid rgba(182, 205, 235, 0.78);
    background:
        radial-gradient(circle at top right, rgba(81, 144, 255, 0.2), transparent 24%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(235, 244, 255, 0.92));
    box-shadow:
        0 18px 38px rgba(12, 39, 76, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.94);
}

.records-shell .records-header::after {
    content: "";
    position: absolute;
    right: -52px;
    top: -60px;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(60, 120, 243, 0.16), transparent 66%);
    pointer-events: none;
}

.records-shell .records-breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(16, 54, 115, 0.06);
    color: #5a7098;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.records-shell .records-breadcrumb span {
    opacity: 0.45;
}

.records-shell .records-header h1 {
    position: relative;
    z-index: 1;
    margin: 18px 0 10px;
    max-width: 820px;
    color: #0e2a52;
    font-size: clamp(2rem, 2.7vw, 3.3rem);
    line-height: 0.98;
    letter-spacing: -0.05em;
    font-weight: 800;
}

.records-shell .records-header p {
    position: relative;
    z-index: 1;
    margin: 0;
    max-width: 640px;
    color: #55719a;
    font-size: 1rem;
    line-height: 1.65;
}

.records-shell .records-count {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid rgba(180, 203, 235, 0.8);
    background: rgba(255, 255, 255, 0.88);
    color: #466284;
    font-size: 0.9rem;
    font-weight: 700;
    box-shadow: 0 8px 20px rgba(14, 42, 82, 0.06);
}

.records-shell .records-count::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: linear-gradient(180deg, #1f6fff, #0d51cc);
    box-shadow: 0 0 0 5px rgba(31, 111, 255, 0.12);
}

.records-shell #recordsListViewContainer {
    padding: 14px;
    border-radius: 26px;
    border: 1px solid rgba(183, 203, 233, 0.84);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(240, 246, 255, 0.92)),
        radial-gradient(circle at top, rgba(255, 255, 255, 0.54), transparent 60%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.92),
        0 18px 42px rgba(12, 39, 76, 0.08);
}

.records-shell #recordsListView .k-listview-content {
    grid-template-columns: repeat(auto-fill, minmax(clamp(290px, 24vw, 380px), 1fr));
    gap: 18px;
    padding: 6px;
}

.records-shell .record-card {
    position: relative;
    isolation: isolate;
    min-height: 228px;
    padding: 20px;
    border-radius: 24px;
    border: 1px solid rgba(177, 202, 233, 0.88);
    background:
        linear-gradient(160deg, rgba(255, 255, 255, 0.98), rgba(236, 244, 255, 0.94)),
        radial-gradient(circle at top right, rgba(84, 144, 255, 0.12), transparent 32%);
    box-shadow:
        0 16px 34px rgba(10, 35, 70, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.94);
    gap: 16px;
}

.records-shell .record-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 36%);
    opacity: 0.85;
    pointer-events: none;
}

.records-shell .record-card:hover {
    transform: translateY(-6px);
    border-color: rgba(103, 152, 230, 0.96);
    box-shadow:
        0 24px 46px rgba(17, 46, 90, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

.records-shell .record-header {
    position: relative;
    z-index: 1;
    align-items: flex-start;
    justify-content: space-between;
}

.records-shell .record-icon-shell {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #0d4fc0;
    font-size: 1.55rem;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(226, 238, 255, 0.92)),
        radial-gradient(circle at top, rgba(77, 139, 255, 0.18), transparent 64%);
    border: 1px solid rgba(179, 204, 237, 0.86);
    box-shadow:
        0 10px 20px rgba(14, 51, 104, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

.records-shell .record-security-btn {
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(243, 248, 255, 0.92);
    box-shadow: inset 0 0 0 1px rgba(183, 204, 236, 0.88);
    font-size: 1.15rem;
    transition: transform 220ms ease, box-shadow 220ms ease, background-color 220ms ease, color 220ms ease;
}

.records-shell .record-security-btn:hover {
    transform: translateY(-2px);
    box-shadow:
        inset 0 0 0 1px rgba(132, 164, 223, 0.96),
        0 10px 22px rgba(17, 46, 90, 0.1);
}

.records-shell .record-security-sealed {
    color: #0f8a63;
    background: rgba(229, 251, 242, 0.96);
}

.records-shell .record-security-warning {
    color: #c46b11;
    background: rgba(255, 247, 226, 0.98);
}

.records-shell .record-security-disabled {
    color: #7c8ca8;
    background: rgba(239, 244, 252, 0.94);
}

.records-shell .record-title {
    position: relative;
    z-index: 1;
    gap: 8px;
}

.records-shell .record-kicker {
    color: #4d6f9c;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.14em;
}

.records-shell .record-title strong {
    color: #0d274e;
    font-size: 1.18rem;
    line-height: 1.18;
    letter-spacing: -0.03em;
}

.records-shell .record-summary {
    display: -webkit-box;
    overflow: hidden;
    color: #6480a6;
    font-size: 0.95rem;
    line-height: 1.55;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.records-shell .record-meta-row {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.records-shell .record-reference-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(247, 250, 255, 0.94);
    box-shadow: inset 0 0 0 1px rgba(184, 205, 234, 0.86);
    color: #355885;
    font-size: 0.8rem;
    font-weight: 800;
}

.records-shell .record-reference-pill span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.records-shell .record-open-hint {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #1b5fdd;
    background: linear-gradient(180deg, rgba(235, 244, 255, 0.96), rgba(221, 235, 255, 0.92));
    box-shadow: inset 0 0 0 1px rgba(172, 196, 231, 0.84);
    transition: transform 220ms ease, background 220ms ease;
}

.records-shell .record-card:hover .record-open-hint {
    transform: translate(2px, -2px);
    background: linear-gradient(180deg, rgba(223, 237, 255, 1), rgba(208, 227, 255, 0.96));
}

.records-shell .doc-count {
    position: relative;
    z-index: 1;
    margin-top: auto;
    padding: 14px 16px;
    border: 1px solid rgba(190, 209, 236, 0.82);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.76);
    color: #4b678e;
    font-size: 0.84rem;
    font-weight: 700;
}

.records-shell .doc-count .count {
    color: #0d2852;
    font-size: 1rem;
}

.records-shell .record-card.flow-origin-active {
    border-color: #4e91ff;
    transform: translateY(-8px) scale(1.016);
    box-shadow:
        0 30px 54px rgba(24, 74, 155, 0.18),
        0 0 0 1px rgba(78, 145, 255, 0.22);
}

@media (max-width: 991.98px) {
    .records-shell .records-main {
        padding: 16px;
        border-radius: 22px;
    }

    .records-shell .records-header {
        padding: 20px;
    }

    .records-shell .record-card {
        min-height: 210px;
    }
}

@media (max-width: 640px) {
    .records-shell .records-header h1 {
        font-size: 1.85rem;
    }

    .records-shell #recordsListView .k-listview-content {
        grid-template-columns: 1fr;
    }

    .records-shell .record-card {
        padding: 18px;
    }
}

/* Documents in record refresh */
#_docsLayer .docs-breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    align-self: flex-start;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(16, 54, 115, 0.07);
    color: #5c7297;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

#_docsLayer .docs-breadcrumb span {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

#_docsLayer .docs-breadcrumb .bi {
    font-size: 0.95rem;
    color: #0e58d0;
}

#_docsLayer .docs-hero {
    flex: 0 0 auto;
    position: relative;
    overflow: hidden;
    padding: 20px 24px;
    border-radius: 26px;
    border: 1px solid rgba(181, 204, 234, 0.84);
    background:
        radial-gradient(circle at top right, rgba(84, 144, 255, 0.18), transparent 26%),
        linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(236, 244, 255, 0.94));
    box-shadow:
        0 20px 42px rgba(12, 39, 76, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

#_docsLayer .docs-hero::after {
    content: "";
    position: absolute;
    right: -60px;
    top: -70px;
    width: 230px;
    height: 230px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(57, 118, 235, 0.16), transparent 66%);
    pointer-events: none;
}

#_docsLayer .docs-top {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

#_docsLayer .docs-top-left {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    min-width: 0;
}

#_docsLayer .docs-back-btn {
    width: 56px;
    height: 56px;
    padding: 0;
    border-radius: 18px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    color: #0c3d8f;
    background: rgba(255, 255, 255, 0.9) !important;
    box-shadow:
        0 12px 24px rgba(15, 44, 88, 0.08),
        inset 0 0 0 1px rgba(182, 205, 237, 0.86);
}

#_docsLayer .docs-top-copy {
    min-width: 0;
}

#_docsLayer .docs-title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

#_docsLayer .docs-title-wrap h2 {
    margin: 0;
    color: #0d2852;
    font-size: clamp(2rem, 2.2vw, 3rem);
    line-height: 1;
    letter-spacing: -0.05em;
    font-weight: 800;
}

#_docsLayer .docs-top-copy p {
    margin: 12px 0 0;
    max-width: 720px;
    color: #5c7598;
    font-size: 0.98rem;
    line-height: 1.65;
}

#_docsLayer .docs-record-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(29, 111, 255, 0.1);
    color: #1756bd;
    font-size: 0.82rem;
    font-weight: 800;
}

#_docsLayer .docs-top-actions {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

#_docsLayer .docs-hero-btn {
    min-height: 54px;
    padding: 0 20px;
    border-radius: 18px;
    border: 1px solid rgba(166, 194, 233, 0.84);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
}

#_docsLayer .docs-hero-btn .bi {
    font-size: 1rem;
}

#_docsLayer .docs-hero-btn-light {
    color: #1562de;
    background: rgba(255, 255, 255, 0.88);
}

#_docsLayer .docs-hero-btn-dark {
    color: #fff;
    background: linear-gradient(135deg, #0d2751, #153d7e);
    border-color: transparent;
    box-shadow: 0 16px 26px rgba(14, 40, 82, 0.18);
}

#_docsLayer .docs-hero-meta {
    position: relative;
    z-index: 1;
    margin-top: 18px;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 18px 20px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: inset 0 0 0 1px rgba(187, 208, 236, 0.82);
}

#_docsLayer .docs-hero-stat,
#_docsLayer .docs-hero-context {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

#_docsLayer .docs-hero-label {
    color: #6d82a4;
    font-size: 0.74rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

#_docsLayer .docs-hero-stat strong,
#_docsLayer .docs-hero-context strong {
    color: #0f2c58;
    font-size: 1.32rem;
    line-height: 1.1;
}

#_docsLayer .docs-hero-context strong {
    font-size: 0.98rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#_docsLayer .docs-hero-divider {
    width: 1px;
    align-self: stretch;
    background: linear-gradient(180deg, transparent, rgba(163, 185, 219, 0.84), transparent);
}

#_docsLayer .docs-table-card {
    flex: 1 1 auto;
    min-height: 0;
    border-radius: 26px;
    border: 1px solid rgba(184, 205, 234, 0.84);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(242, 248, 255, 0.94)),
        radial-gradient(circle at top, rgba(255, 255, 255, 0.42), transparent 60%);
    box-shadow:
        0 18px 40px rgba(13, 39, 78, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.96);
    overflow: hidden;
}

#_docsLayer .docs-toolbar {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto auto auto;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(191, 210, 237, 0.8);
    background: rgba(248, 251, 255, 0.88);
}

#_docsLayer .docs-toolbar-search {
    min-height: 56px;
    padding: 0 18px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: inset 0 0 0 1px rgba(187, 207, 235, 0.86);
    display: flex;
    align-items: center;
    gap: 12px;
}

#_docsLayer .docs-toolbar-search .bi {
    color: #1f6fff;
    font-size: 1.25rem;
}

#_docsLayer .docs-toolbar-search input {
    border: 0;
    outline: 0;
    background: transparent;
    width: 100%;
    color: #17365e;
    font-size: 0.98rem;
}

#_docsLayer .docs-toolbar-search input::placeholder {
    color: #7b90af;
}

#_docsLayer .docs-toolbar-btn {
    min-height: 56px;
    padding: 0 18px;
    border-radius: 18px;
    border: 1px solid rgba(180, 202, 232, 0.84);
    background: rgba(255, 255, 255, 0.92);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #1a5fd5;
    font-weight: 800;
}

#_docsLayer .docs-toolbar-btn .badge {
    min-width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #1f6fff;
    color: #fff;
    font-size: 0.78rem;
}

#_docsLayer .docs-total {
    justify-self: end;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    min-height: 56px;
    border-radius: 18px;
    background: linear-gradient(135deg, #0e2751, #17448a);
    color: #fff;
    font-weight: 800;
    box-shadow: 0 16px 26px rgba(14, 40, 82, 0.16);
}

#_docsLayer .docs-total::before {
    content: "\\F229";
    font-family: bootstrap-icons;
    font-size: 0.95rem;
}

#_docsLayer .docs-footer-hint {
    flex: 0 0 auto;
    padding: 16px 20px 20px;
    color: #5b7297;
    font-weight: 700;
}

#_docsLayer .docs-shell {
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

#_docsLayer #_docsGridWrap {
    flex: 1 1 auto;
    min-height: 0;
}

#_docsLayer #_docsGrid,
#_docsLayer #_docsGrid .k-grid,
#_docsLayer #_docsGrid .k-grid-content,
#_docsLayer #_docsGrid .k-grid-content-locked {
    height: 100% !important;
}

#_docsGrid .docs-ref-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

#_docsGrid .docs-ref-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(255, 241, 241, 0.98), rgba(255, 230, 230, 0.94));
    color: #d13f3f;
    box-shadow: inset 0 0 0 1px rgba(241, 194, 194, 0.92);
    font-size: 1.1rem;
}

#_docsGrid .docs-ref-cell span:last-child {
    color: #10305d;
    font-weight: 800;
}

#_docsGrid .docs-actions-cell {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

#_docsGrid .js-eye-btn,
#_docsGrid .js-ctx-toggle {
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid rgba(183, 205, 233, 0.88);
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.94);
    color: #1a5fd5;
    box-shadow: 0 8px 18px rgba(15, 44, 88, 0.08);
}

#_docsGrid .js-eye-btn .bi,
#_docsGrid .js-ctx-toggle .bi {
    font-size: 1rem;
}

#_docsGrid .ctx-actions {
    padding: 10px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 36px rgba(12, 39, 76, 0.16);
}

#_docsGrid .ctx-btn {
    width: 88px;
    height: 70px;
    gap: 8px;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(251, 253, 255, 0.98), rgba(238, 245, 255, 0.94));
    box-shadow: inset 0 0 0 1px rgba(186, 206, 233, 0.86);
}

#_docsGrid .ctx-btn i {
    font-size: 1.1rem;
    color: #1459d0;
}

#_docsGrid .ctx-btn span {
    color: #45658d;
    font-weight: 700;
}

#_docsGrid .k-grid-header {
    background: rgba(236, 244, 255, 0.9);
}

#_docsGrid .k-grid-header th {
    color: #17365e;
    font-weight: 800;
    border-color: rgba(197, 214, 237, 0.84);
}

#_docsGrid .k-grid-content tr {
    transition: background-color 220ms ease, transform 220ms ease;
}

#_docsGrid .k-grid-content tr:hover {
    transform: translateX(2px);
}

@media (max-width: 1180px) {
    #_docsLayer .docs-top {
        flex-direction: column;
    }

    #_docsLayer .docs-top-actions {
        width: 100%;
        justify-content: flex-start;
    }

    #_docsLayer .docs-toolbar {
        grid-template-columns: 1fr 1fr;
    }

    #_docsLayer .docs-total {
        justify-self: stretch;
    }
}

@media (max-width: 760px) {
    #_docsLayer .docs-hero {
        padding: 18px;
    }

    #_docsLayer .docs-top-left {
        gap: 14px;
    }

    #_docsLayer .docs-title-wrap h2 {
        font-size: 1.8rem;
    }

    #_docsLayer .docs-hero-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    #_docsLayer .docs-hero-divider {
        width: 100%;
        height: 1px;
    }

    #_docsLayer .docs-toolbar {
        grid-template-columns: 1fr;
    }

    #_docsLayer .docs-hero-btn,
    #_docsLayer .docs-toolbar-btn,
    #_docsLayer .docs-total {
        width: 100%;
        justify-content: center;
    }
}

/* Unified records flow */
#recordsListViewContainer {
    position: relative;
    isolation: isolate;
    overflow: hidden;
}

#recordsListViewContainer::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background:
        linear-gradient(180deg, rgba(228, 238, 255, 0.18), rgba(214, 226, 249, 0.46)),
        radial-gradient(circle at top, rgba(255, 255, 255, 0.34), transparent 52%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 320ms ease;
}

#recordsListViewContainer > #recordsListView {
    transform-origin: center top;
    transition:
        opacity 240ms ease,
        transform 420ms cubic-bezier(0.22, 1, 0.36, 1),
        filter 420ms ease;
}

#recordsListViewContainer.records-flow-dimmed > #recordsListView {
    opacity: 0.24;
    transform: translateY(14px) scale(0.982);
    filter: blur(10px) saturate(0.88);
    pointer-events: none;
}

#recordsListViewContainer.records-flow-dimmed::after {
    opacity: 1;
}

.record-card,
#_docsGrid tbody tr {
    transition:
        transform 260ms ease,
        box-shadow 260ms ease,
        border-color 260ms ease,
        background-color 260ms ease,
        filter 260ms ease;
}

.record-card.flow-origin-active {
    position: relative;
    z-index: 2;
    border-color: #4e91ff;
    transform: translateY(-6px) scale(1.015);
    box-shadow:
        0 20px 46px rgba(24, 74, 155, 0.18),
        0 0 0 1px rgba(78, 145, 255, 0.24);
}

#_docsGrid tbody tr.flow-origin-active td {
    background:
        linear-gradient(180deg, rgba(241, 247, 255, 0.98), rgba(233, 242, 255, 0.92)) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.96), inset 0 -1px 0 rgba(124, 164, 228, 0.22);
}

#_docsGrid tbody tr.flow-origin-active td:first-child {
    border-top-left-radius: 16px;
    border-bottom-left-radius: 16px;
}

#_docsGrid tbody tr.flow-origin-active td:last-child {
    border-top-right-radius: 16px;
    border-bottom-right-radius: 16px;
}

#_docsLayer::after {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 280ms ease, background 280ms ease;
}

#_docsLayer.docs-under-viewer::after {
    opacity: 1;
    background:
        linear-gradient(180deg, rgba(18, 40, 78, 0.18), rgba(18, 40, 78, 0.34)),
        radial-gradient(circle at top, rgba(255, 255, 255, 0.08), transparent 48%);
}

#_docsLayer.docs-under-viewer .docs-shell {
    opacity: 0.42;
    transform: translateY(12px) scale(0.985);
    filter: blur(10px) saturate(0.82);
    transition:
        opacity 240ms ease,
        transform 360ms cubic-bezier(0.22, 1, 0.36, 1),
        filter 360ms ease;
}

.doc-layer {
    opacity: 0;
    transform: translateY(28px) scale(0.986);
    filter: saturate(0.95);
    transition:
        opacity 260ms ease,
        transform 440ms cubic-bezier(0.22, 1, 0.36, 1),
        filter 440ms ease;
}

.doc-layer.is-active {
    opacity: 1;
    transform: none;
    filter: none;
}

.doc-layer.is-closing {
    pointer-events: none;
}

.doc-layer .doc-canvas {
    opacity: 0.92;
    transform: translateY(18px) scale(0.992);
    transition:
        opacity 280ms ease,
        transform 460ms cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 300ms ease;
}

.doc-layer.is-active .doc-canvas {
    opacity: 1;
    transform: none;
}

.doc-layer .xpdf-shell,
.doc-layer #docHostPdf,
.doc-layer #docHost {
    transition:
        opacity 280ms ease,
        transform 460ms cubic-bezier(0.22, 1, 0.36, 1);
}

.doc-layer.pdf-mode {
    padding: 1.35rem;
    border-radius: 28px;
}

.doc-layer.pdf-mode .doc-canvas {
    border: 0;
    background: transparent;
    box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
    #recordsListViewContainer::after,
    #recordsListViewContainer > #recordsListView,
    .record-card,
    #_docsGrid tbody tr,
    #_docsLayer,
    #_docsLayer .docs-shell,
    .doc-layer,
    .doc-layer .doc-canvas,
    .doc-layer .xpdf-shell,
    .doc-layer #docHostPdf,
    .doc-layer #docHost {
        transition: none !important;
        transform: none !important;
        filter: none !important;
    }
}

/* Documents grid final overrides */
#_docsLayer .docs-toolbar-search input {
    color: #1f3561 !important;
    -webkit-text-fill-color: #1f3561;
}

#_docsLayer .docs-toolbar-search input::placeholder {
    color: #6f84aa !important;
    -webkit-text-fill-color: #6f84aa;
    opacity: 1;
}

#_docsLayer .docs-total {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    min-height: 56px;
    padding: 0 16px;
    border-radius: 18px;
    background: linear-gradient(135deg, #0e2751, #17448a) !important;
    color: #fff !important;
    font-size: 1rem;
    font-weight: 800;
    white-space: nowrap;
}

#_docsLayer .docs-total::before {
    content: "\F229";
    font-family: bootstrap-icons;
    font-size: 0.95rem;
    color: inherit;
}

#_docsLayer #_docsGrid .k-grid {
    display: flex;
    flex-direction: column;
    height: 100% !important;
    overflow: hidden !important;
}

#_docsLayer #_docsGrid .k-grid-header,
#_docsLayer #_docsGrid .k-grid-header-wrap,
#_docsLayer #_docsGrid .k-grid-container,
#_docsLayer #_docsGrid .k-pager-wrap {
    flex: 0 0 auto;
}

#_docsLayer #_docsGrid .k-grid-content,
#_docsLayer #_docsGrid .k-grid-content-wrap,
#_docsLayer #_docsGrid .k-grid-content-locked {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden !important;
}

#_docsLayer #_docsGrid .k-grid-content {
    overflow-y: auto !important;
}

#_docsLayer #_docsGrid .k-grid-content tr,
#_docsLayer #_docsGrid tbody tr {
    transform: none !important;
}

#_docsLayer #_docsGrid .k-grid-content tr:hover,
#_docsLayer #_docsGrid tbody tr:hover {
    transform: none !important;
}

html[data-theme="dark"] #_docsLayer .docs-breadcrumb,
html[data-theme="dark"] #_docsLayer .docs-record-tag,
html[data-theme="dark"] #_docsLayer .docs-hero-label,
html[data-theme="dark"] #_docsLayer .docs-top-copy p,
html[data-theme="dark"] #_docsLayer .docs-footer-hint,
body[data-theme="dark"] #_docsLayer .docs-breadcrumb,
body[data-theme="dark"] #_docsLayer .docs-record-tag,
body[data-theme="dark"] #_docsLayer .docs-hero-label,
body[data-theme="dark"] #_docsLayer .docs-top-copy p,
body[data-theme="dark"] #_docsLayer .docs-footer-hint,
body.page-home-records[data-theme="dark"] #_docsLayer .docs-breadcrumb,
body.page-home-records[data-theme="dark"] #_docsLayer .docs-record-tag,
body.page-home-records[data-theme="dark"] #_docsLayer .docs-hero-label,
body.page-home-records[data-theme="dark"] #_docsLayer .docs-top-copy p,
body.page-home-records[data-theme="dark"] #_docsLayer .docs-footer-hint {
    color: #a9c1e8 !important;
}

html[data-theme="dark"] #_docsLayer .docs-hero-meta,
body[data-theme="dark"] #_docsLayer .docs-hero-meta,
body.page-home-records[data-theme="dark"] #_docsLayer .docs-hero-meta {
    background: rgba(12, 29, 54, 0.54) !important;
    box-shadow: inset 0 0 0 1px rgba(79, 114, 171, 0.52) !important;
}

html[data-theme="dark"] #_docsLayer .docs-hero-stat strong,
html[data-theme="dark"] #_docsLayer .docs-hero-context strong,
html[data-theme="dark"] #_docsLayer .docs-title-wrap h2,
body[data-theme="dark"] #_docsLayer .docs-hero-stat strong,
body[data-theme="dark"] #_docsLayer .docs-hero-context strong,
body[data-theme="dark"] #_docsLayer .docs-title-wrap h2,
body.page-home-records[data-theme="dark"] #_docsLayer .docs-hero-stat strong,
body.page-home-records[data-theme="dark"] #_docsLayer .docs-hero-context strong,
body.page-home-records[data-theme="dark"] #_docsLayer .docs-title-wrap h2 {
    color: #eef5ff !important;
}

html[data-theme="dark"] #_docsLayer .docs-toolbar-search input,
body[data-theme="dark"] #_docsLayer .docs-toolbar-search input,
body.page-home-records[data-theme="dark"] #_docsLayer .docs-toolbar-search input {
    color: #dbe8ff !important;
    -webkit-text-fill-color: #dbe8ff;
}

html[data-theme="dark"] #_docsLayer .docs-toolbar-search input::placeholder,
body[data-theme="dark"] #_docsLayer .docs-toolbar-search input::placeholder,
body.page-home-records[data-theme="dark"] #_docsLayer .docs-toolbar-search input::placeholder {
    color: #9ab6df !important;
    -webkit-text-fill-color: #9ab6df;
}

html[data-theme="dark"] #_docsLayer #_docsGrid .k-grid,
body[data-theme="dark"] #_docsLayer #_docsGrid .k-grid,
body.page-home-records[data-theme="dark"] #_docsLayer #_docsGrid .k-grid {
    background: linear-gradient(180deg, rgba(16, 37, 68, 0.98), rgba(13, 31, 58, 0.98)) !important;
    background-color: rgba(16, 37, 68, 0.98) !important;
    border-color: rgba(72, 108, 165, 0.56) !important;
}

html[data-theme="dark"] #_docsLayer #_docsGrid .k-grid-header,
html[data-theme="dark"] #_docsLayer #_docsGrid .k-grid-header-wrap,
html[data-theme="dark"] #_docsLayer #_docsGrid .k-grid-container,
html[data-theme="dark"] #_docsLayer #_docsGrid .k-grid-content,
html[data-theme="dark"] #_docsLayer #_docsGrid .k-grid-content-wrap,
html[data-theme="dark"] #_docsLayer #_docsGrid .k-grid-content-locked,
html[data-theme="dark"] #_docsLayer #_docsGrid .k-grid-table,
html[data-theme="dark"] #_docsLayer #_docsGrid .k-grid-content table,
html[data-theme="dark"] #_docsLayer #_docsGrid .k-table-tbody,
html[data-theme="dark"] #_docsLayer #_docsGrid .k-pager-wrap,
body[data-theme="dark"] #_docsLayer #_docsGrid .k-grid-header,
body[data-theme="dark"] #_docsLayer #_docsGrid .k-grid-header-wrap,
body[data-theme="dark"] #_docsLayer #_docsGrid .k-grid-container,
body[data-theme="dark"] #_docsLayer #_docsGrid .k-grid-content,
body[data-theme="dark"] #_docsLayer #_docsGrid .k-grid-content-wrap,
body[data-theme="dark"] #_docsLayer #_docsGrid .k-grid-content-locked,
body[data-theme="dark"] #_docsLayer #_docsGrid .k-grid-table,
body[data-theme="dark"] #_docsLayer #_docsGrid .k-grid-content table,
body[data-theme="dark"] #_docsLayer #_docsGrid .k-table-tbody,
body[data-theme="dark"] #_docsLayer #_docsGrid .k-pager-wrap,
body.page-home-records[data-theme="dark"] #_docsLayer #_docsGrid .k-grid-header,
body.page-home-records[data-theme="dark"] #_docsLayer #_docsGrid .k-grid-header-wrap,
body.page-home-records[data-theme="dark"] #_docsLayer #_docsGrid .k-grid-container,
body.page-home-records[data-theme="dark"] #_docsLayer #_docsGrid .k-grid-content,
body.page-home-records[data-theme="dark"] #_docsLayer #_docsGrid .k-grid-content-wrap,
body.page-home-records[data-theme="dark"] #_docsLayer #_docsGrid .k-grid-content-locked,
body.page-home-records[data-theme="dark"] #_docsLayer #_docsGrid .k-grid-table,
body.page-home-records[data-theme="dark"] #_docsLayer #_docsGrid .k-grid-content table,
body.page-home-records[data-theme="dark"] #_docsLayer #_docsGrid .k-table-tbody,
body.page-home-records[data-theme="dark"] #_docsLayer #_docsGrid .k-pager-wrap {
    background: transparent !important;
    background-color: transparent !important;
}

html[data-theme="dark"] #_docsLayer #_docsGrid .k-grid-header th,
html[data-theme="dark"] #_docsLayer #_docsGrid .k-table-th,
body[data-theme="dark"] #_docsLayer #_docsGrid .k-grid-header th,
body[data-theme="dark"] #_docsLayer #_docsGrid .k-table-th,
body.page-home-records[data-theme="dark"] #_docsLayer #_docsGrid .k-grid-header th,
body.page-home-records[data-theme="dark"] #_docsLayer #_docsGrid .k-table-th {
    background: rgba(24, 54, 96, 0.94) !important;
    color: #edf4ff !important;
    border-color: rgba(72, 108, 164, 0.5) !important;
}

html[data-theme="dark"] #_docsLayer #_docsGrid .k-grid-content td,
html[data-theme="dark"] #_docsLayer #_docsGrid .k-table-td,
body[data-theme="dark"] #_docsLayer #_docsGrid .k-grid-content td,
body[data-theme="dark"] #_docsLayer #_docsGrid .k-table-td,
body.page-home-records[data-theme="dark"] #_docsLayer #_docsGrid .k-grid-content td,
body.page-home-records[data-theme="dark"] #_docsLayer #_docsGrid .k-table-td {
    background: rgba(20, 47, 85, 0.94) !important;
    color: #d9e8ff !important;
    border-color: rgba(67, 102, 158, 0.42) !important;
}

html[data-theme="dark"] #_docsLayer #_docsGrid .k-grid-content tr:nth-child(even) td,
body[data-theme="dark"] #_docsLayer #_docsGrid .k-grid-content tr:nth-child(even) td,
body.page-home-records[data-theme="dark"] #_docsLayer #_docsGrid .k-grid-content tr:nth-child(even) td {
    background: rgba(17, 41, 74, 0.96) !important;
}

html[data-theme="dark"] #_docsLayer #_docsGrid .k-grid-content tr:hover td,
body[data-theme="dark"] #_docsLayer #_docsGrid .k-grid-content tr:hover td,
body.page-home-records[data-theme="dark"] #_docsLayer #_docsGrid .k-grid-content tr:hover td {
    background: rgba(33, 71, 120, 0.92) !important;
}

html[data-theme="dark"] #_docsLayer #_docsGrid .k-pager-wrap,
html[data-theme="dark"] #_docsLayer #_docsGrid .k-pager-wrap .k-link,
html[data-theme="dark"] #_docsLayer #_docsGrid .k-pager-wrap .k-button,
html[data-theme="dark"] #_docsLayer #_docsGrid .k-pager-wrap .k-pager-info,
html[data-theme="dark"] #_docsLayer #_docsGrid .k-pager-wrap .k-label,
body[data-theme="dark"] #_docsLayer #_docsGrid .k-pager-wrap,
body[data-theme="dark"] #_docsLayer #_docsGrid .k-pager-wrap .k-link,
body[data-theme="dark"] #_docsLayer #_docsGrid .k-pager-wrap .k-button,
body[data-theme="dark"] #_docsLayer #_docsGrid .k-pager-wrap .k-pager-info,
body[data-theme="dark"] #_docsLayer #_docsGrid .k-pager-wrap .k-label,
body.page-home-records[data-theme="dark"] #_docsLayer #_docsGrid .k-pager-wrap,
body.page-home-records[data-theme="dark"] #_docsLayer #_docsGrid .k-pager-wrap .k-link,
body.page-home-records[data-theme="dark"] #_docsLayer #_docsGrid .k-pager-wrap .k-button,
body.page-home-records[data-theme="dark"] #_docsLayer #_docsGrid .k-pager-wrap .k-pager-info,
body.page-home-records[data-theme="dark"] #_docsLayer #_docsGrid .k-pager-wrap .k-label {
    color: #d7e7ff !important;
}

html[data-theme="dark"] #_docsLayer #_docsGrid .k-pager-wrap .k-input-inner,
html[data-theme="dark"] #_docsLayer #_docsGrid .k-pager-wrap .k-picker,
html[data-theme="dark"] #_docsLayer #_docsGrid .k-pager-wrap .k-dropdownlist,
body[data-theme="dark"] #_docsLayer #_docsGrid .k-pager-wrap .k-input-inner,
body[data-theme="dark"] #_docsLayer #_docsGrid .k-pager-wrap .k-picker,
body[data-theme="dark"] #_docsLayer #_docsGrid .k-pager-wrap .k-dropdownlist,
body.page-home-records[data-theme="dark"] #_docsLayer #_docsGrid .k-pager-wrap .k-input-inner,
body.page-home-records[data-theme="dark"] #_docsLayer #_docsGrid .k-pager-wrap .k-picker,
body.page-home-records[data-theme="dark"] #_docsLayer #_docsGrid .k-pager-wrap .k-dropdownlist {
    background: rgba(18, 40, 71, 0.96) !important;
    color: #edf4ff !important;
    border-color: rgba(84, 121, 181, 0.58) !important;
}

/* ===== Final document viewer and actions polish ===== */
.doc-layer:not(.pdf-mode):not(.video-mode):not(.audio-mode):not(.photo-mode) {
    background:
        radial-gradient(circle at 86% 8%, rgba(82, 142, 244, 0.14), transparent 34%),
        linear-gradient(180deg, #f4f8ff 0%, #edf3fc 100%) !important;
}

.doc-layer:not(.pdf-mode):not(.video-mode):not(.audio-mode):not(.photo-mode) .doc-canvas {
    border-color: rgba(176, 201, 232, 0.78) !important;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(238, 245, 255, 0.78)) !important;
    box-shadow: 0 22px 52px rgba(18, 46, 92, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.84) !important;
}

.doc-layer .title-bar {
    min-height: 58px;
    padding: 0.7rem 1rem;
    border-bottom: 1px solid rgba(183, 204, 232, 0.64);
    background: rgba(255, 255, 255, 0.42);
}

.doc-layer .doc-title {
    color: #0f2447 !important;
    font-weight: 850 !important;
}

.doc-layer .doc-warning {
    width: min(520px, calc(100% - 2rem));
    margin: auto;
    padding: 1.25rem 1.35rem;
    border: 1px solid rgba(176, 201, 232, 0.78);
    border-radius: 20px;
    background:
        radial-gradient(circle at 12% 0%, rgba(31, 98, 240, 0.12), transparent 34%),
        rgba(255, 255, 255, 0.8);
    color: #17365f;
    text-align: center;
    font-weight: 850;
    box-shadow: 0 18px 40px rgba(18, 46, 92, 0.12);
}

.doc-layer #docHost,
.doc-layer #docHostGeneric {
    background: transparent !important;
}

.doc-layer .doc-fit {
    border: 0 !important;
    background: transparent !important;
}

.doc-layer .k-loading-mask,
.doc-layer .doc-loader {
    background:
        radial-gradient(circle at center, rgba(31, 98, 240, 0.1), transparent 34%),
        rgba(237, 245, 255, 0.78) !important;
    color: #17365f !important;
    backdrop-filter: blur(10px);
}

#_docsGrid .ctx-wrap.open .js-ctx-toggle {
    border-color: rgba(31, 98, 240, 0.5) !important;
    background: linear-gradient(135deg, #2a73ff, #0d3ca7) !important;
    color: #fff !important;
}

#_docsGrid .ctx-actions {
    right: calc(100% + 12px) !important;
    gap: 8px !important;
    padding: 10px !important;
    border: 1px solid rgba(163, 190, 226, 0.76) !important;
    border-radius: 22px !important;
    background:
        radial-gradient(circle at 0 0, rgba(31, 98, 240, 0.1), transparent 32%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(239, 246, 255, 0.96)) !important;
    box-shadow: 0 22px 46px rgba(12, 39, 76, 0.18) !important;
}

#_docsGrid .ctx-btn {
    width: 78px !important;
    height: 68px !important;
    min-width: 78px !important;
    padding: 0.55rem 0.45rem !important;
    border: 1px solid rgba(175, 200, 232, 0.88) !important;
    border-radius: 16px !important;
    background:
        linear-gradient(180deg, rgba(250, 253, 255, 0.98), rgba(235, 244, 255, 0.94)) !important;
    color: #1e63d8 !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88), 0 10px 18px rgba(14, 45, 91, 0.08) !important;
    transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, background 140ms ease !important;
}

#_docsGrid .ctx-btn:hover,
#_docsGrid .ctx-btn:focus-visible {
    border-color: rgba(31, 98, 240, 0.48) !important;
    background: linear-gradient(135deg, #f8fbff, #e5f0ff) !important;
    color: #0b58d8 !important;
    box-shadow: 0 14px 24px rgba(31, 98, 240, 0.14) !important;
    transform: translateY(-1px);
}

#_docsGrid .ctx-btn i {
    display: inline-grid !important;
    place-items: center;
    width: 24px;
    height: 24px;
    color: currentColor !important;
    font-size: 1.05rem !important;
    line-height: 1 !important;
}

#_docsGrid .ctx-btn span {
    max-width: 100%;
    color: inherit !important;
    font-size: 0.7rem !important;
    font-weight: 850 !important;
    line-height: 1.05 !important;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
}

html[data-theme="dark"] .doc-layer:not(.pdf-mode):not(.video-mode):not(.audio-mode):not(.photo-mode),
body[data-theme="dark"] .doc-layer:not(.pdf-mode):not(.video-mode):not(.audio-mode):not(.photo-mode),
body.page-home-records[data-theme="dark"] .doc-layer:not(.pdf-mode):not(.video-mode):not(.audio-mode):not(.photo-mode) {
    background:
        radial-gradient(circle at 86% 8%, rgba(68, 215, 255, 0.12), transparent 34%),
        radial-gradient(circle at 12% 0%, rgba(75, 157, 255, 0.12), transparent 30%),
        linear-gradient(180deg, #06182f 0%, #0a2547 100%) !important;
}

html[data-theme="dark"] .doc-layer:not(.pdf-mode):not(.video-mode):not(.audio-mode):not(.photo-mode) .doc-canvas,
body[data-theme="dark"] .doc-layer:not(.pdf-mode):not(.video-mode):not(.audio-mode):not(.photo-mode) .doc-canvas,
body.page-home-records[data-theme="dark"] .doc-layer:not(.pdf-mode):not(.video-mode):not(.audio-mode):not(.photo-mode) .doc-canvas {
    border-color: rgba(76, 114, 177, 0.62) !important;
    background:
        radial-gradient(circle at 18% 0%, rgba(68, 215, 255, 0.08), transparent 36%),
        linear-gradient(180deg, rgba(12, 33, 63, 0.94), rgba(7, 24, 47, 0.96)) !important;
    box-shadow: 0 26px 64px rgba(1, 8, 22, 0.42), inset 0 1px 0 rgba(142, 186, 255, 0.08) !important;
}

html[data-theme="dark"] .doc-layer .title-bar,
body[data-theme="dark"] .doc-layer .title-bar,
body.page-home-records[data-theme="dark"] .doc-layer .title-bar {
    border-bottom-color: rgba(76, 114, 177, 0.44) !important;
    background: rgba(11, 34, 66, 0.74) !important;
}

html[data-theme="dark"] .doc-layer .doc-title,
body[data-theme="dark"] .doc-layer .doc-title,
body.page-home-records[data-theme="dark"] .doc-layer .doc-title {
    color: #edf5ff !important;
    -webkit-text-fill-color: #edf5ff !important;
}

html[data-theme="dark"] .doc-layer .doc-warning,
body[data-theme="dark"] .doc-layer .doc-warning,
body.page-home-records[data-theme="dark"] .doc-layer .doc-warning {
    border-color: rgba(76, 114, 177, 0.58) !important;
    background:
        radial-gradient(circle at 12% 0%, rgba(68, 215, 255, 0.12), transparent 34%),
        rgba(12, 33, 63, 0.9) !important;
    color: #eaf2ff !important;
    box-shadow: 0 20px 46px rgba(1, 8, 22, 0.38) !important;
}

html[data-theme="dark"] .doc-layer .k-loading-mask,
html[data-theme="dark"] .doc-layer .doc-loader,
body[data-theme="dark"] .doc-layer .k-loading-mask,
body[data-theme="dark"] .doc-layer .doc-loader,
body.page-home-records[data-theme="dark"] .doc-layer .k-loading-mask,
body.page-home-records[data-theme="dark"] .doc-layer .doc-loader {
    background:
        radial-gradient(circle at center, rgba(68, 215, 255, 0.12), transparent 34%),
        rgba(5, 18, 38, 0.76) !important;
    color: #eaf2ff !important;
}

html[data-theme="dark"] #_docsGrid .js-eye-btn,
html[data-theme="dark"] #_docsGrid .js-ctx-toggle,
body[data-theme="dark"] #_docsGrid .js-eye-btn,
body[data-theme="dark"] #_docsGrid .js-ctx-toggle,
body.page-home-records[data-theme="dark"] #_docsGrid .js-eye-btn,
body.page-home-records[data-theme="dark"] #_docsGrid .js-ctx-toggle {
    border-color: rgba(100, 168, 248, 0.44) !important;
    background: rgba(17, 47, 86, 0.94) !important;
    color: #8fc6ff !important;
    box-shadow: 0 10px 20px rgba(1, 8, 22, 0.24) !important;
}

html[data-theme="dark"] #_docsGrid .ctx-wrap.open .js-ctx-toggle,
body[data-theme="dark"] #_docsGrid .ctx-wrap.open .js-ctx-toggle,
body.page-home-records[data-theme="dark"] #_docsGrid .ctx-wrap.open .js-ctx-toggle {
    border-color: rgba(68, 215, 255, 0.48) !important;
    background: linear-gradient(135deg, #2577ff, #083a9f) !important;
    color: #fff !important;
}

html[data-theme="dark"] #_docsGrid .ctx-actions,
body[data-theme="dark"] #_docsGrid .ctx-actions,
body.page-home-records[data-theme="dark"] #_docsGrid .ctx-actions {
    border-color: rgba(100, 168, 248, 0.48) !important;
    background:
        radial-gradient(circle at 0 0, rgba(68, 215, 255, 0.12), transparent 32%),
        linear-gradient(180deg, rgba(18, 50, 91, 0.98), rgba(10, 31, 59, 0.98)) !important;
    box-shadow: 0 24px 54px rgba(1, 8, 22, 0.46), 0 0 22px rgba(68, 215, 255, 0.08) !important;
}

html[data-theme="dark"] #_docsGrid .ctx-btn,
body[data-theme="dark"] #_docsGrid .ctx-btn,
body.page-home-records[data-theme="dark"] #_docsGrid .ctx-btn {
    border-color: rgba(100, 168, 248, 0.4) !important;
    background: rgba(16, 44, 82, 0.94) !important;
    color: #9fd0ff !important;
    box-shadow: inset 0 1px 0 rgba(154, 194, 255, 0.09), 0 12px 22px rgba(1, 8, 22, 0.22) !important;
}

html[data-theme="dark"] #_docsGrid .ctx-btn:hover,
html[data-theme="dark"] #_docsGrid .ctx-btn:focus-visible,
body[data-theme="dark"] #_docsGrid .ctx-btn:hover,
body[data-theme="dark"] #_docsGrid .ctx-btn:focus-visible,
body.page-home-records[data-theme="dark"] #_docsGrid .ctx-btn:hover,
body.page-home-records[data-theme="dark"] #_docsGrid .ctx-btn:focus-visible {
    border-color: rgba(68, 215, 255, 0.58) !important;
    background: rgba(25, 70, 124, 0.98) !important;
    color: #eaf6ff !important;
    box-shadow: 0 16px 30px rgba(2, 10, 25, 0.32), 0 0 18px rgba(68, 215, 255, 0.1) !important;
}

/* PDF viewer final overrides loaded after pdf-viewer.css */
body.page-home-records .xpdf-shell {
    min-height: 0 !important;
    overflow: hidden !important;
    gap: 0.85rem !important;
}

body.page-home-records .xpdf-hero,
body.page-home-records .xpdf-hero-main {
    min-height: 0 !important;
    overflow: hidden !important;
}

body.page-home-records .xpdf-hero-left,
body.page-home-records .xpdf-header-copy,
body.page-home-records .xpdf-title-wrap {
    min-width: 0 !important;
}

body.page-home-records .xpdf-header-copy {
    flex: 1 1 auto !important;
    overflow: hidden !important;
}

body.page-home-records .xpdf-title-wrap {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 0.65rem !important;
    width: 100% !important;
    flex-wrap: nowrap !important;
}

body.page-home-records .xpdf-title {
    display: block !important;
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: clamp(1.38rem, 1.35vw, 2rem) !important;
    line-height: 1.08 !important;
    letter-spacing: 0 !important;
}

body.page-home-records .xpdf-record-tag,
body.page-home-records .xpdf-meta {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

body.page-home-records .xpdf-record-tag {
    max-width: 150px !important;
}

body.page-home-records .xpdf-meta-row {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
}

body.page-home-records .xpdf-header-actions {
    max-width: 48% !important;
}

body.page-home-records .xpdf-header-actions .xpdf-action-btn {
    min-height: 44px !important;
    max-width: 210px !important;
    padding: 0 0.9rem !important;
}

body.page-home-records .xpdf-header-actions .xpdf-action-btn span {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

body.page-home-records .xpdf-tabs {
    min-height: 58px !important;
    flex: 0 0 58px !important;
}

body.page-home-records .xpdf-tab {
    min-height: 58px !important;
    font-size: 0.95rem !important;
}

body.page-home-records .xpdf-right-panel,
body.page-home-records .xpdf-tab-panel {
    min-height: 0 !important;
    overflow: hidden !important;
}

body.page-home-records .xpdf-tab-panel {
    padding: 1rem !important;
}

body.page-home-records .xpdf-tab-panel.is-active {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
}

body.page-home-records .xpdf-summary-panel-card,
body.page-home-records .xpdf-rag-panel-card {
    display: flex !important;
    flex: 1 1 auto !important;
    flex-direction: column !important;
    min-height: 0 !important;
    padding: 1rem !important;
    border: 1px solid rgba(186, 205, 232, 0.58) !important;
    border-radius: 18px !important;
    background:
        radial-gradient(circle at 8% 0%, rgba(31, 98, 240, 0.08), transparent 34%),
        rgba(255, 255, 255, 0.74) !important;
    box-shadow: 0 14px 30px rgba(15, 44, 88, 0.08) !important;
}

body.page-home-records .xpdf-summary-panel-card .xpdf-card-head,
body.page-home-records .xpdf-rag-panel-card .xpdf-card-head {
    flex: 0 0 auto !important;
    margin-bottom: 0.85rem !important;
}

body.page-home-records .xpdf-summary-body,
body.page-home-records .xpdf-rag-body {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow: auto !important;
    border: 1px solid rgba(190, 205, 232, 0.52) !important;
    border-radius: 14px !important;
    background: rgba(248, 251, 255, 0.82) !important;
}

body.page-home-records .xpdf-summary-refresh {
    flex: 0 0 auto !important;
    margin-top: 0.85rem !important;
}

body.page-home-records .xpdf-rag-body {
    justify-content: center !important;
}

body.page-home-records .xpdf-quick-grid,
body.page-home-records .xpdf-quick-btn,
body.page-home-records .xpdf-outline-list {
    display: none !important;
}

html[data-theme="dark"] body.page-home-records .xpdf-summary-panel-card,
html[data-theme="dark"] body.page-home-records .xpdf-rag-panel-card,
body.page-home-records[data-theme="dark"] .xpdf-summary-panel-card,
body.page-home-records[data-theme="dark"] .xpdf-rag-panel-card {
    border-color: rgba(97, 134, 192, 0.46) !important;
    background:
        radial-gradient(circle at 8% 0%, rgba(68, 215, 255, 0.1), transparent 34%),
        rgba(10, 31, 59, 0.78) !important;
    box-shadow: 0 14px 30px rgba(1, 8, 22, 0.22) !important;
}

html[data-theme="dark"] body.page-home-records .xpdf-summary-body,
html[data-theme="dark"] body.page-home-records .xpdf-rag-body,
body.page-home-records[data-theme="dark"] .xpdf-summary-body,
body.page-home-records[data-theme="dark"] .xpdf-rag-body {
    border-color: rgba(97, 134, 192, 0.42) !important;
    background: rgba(6, 22, 45, 0.72) !important;
    color: #dbeaff !important;
}

@media (max-width: 1440px) {
    body.page-home-records .xpdf-header-actions {
        max-width: 42% !important;
    }

    body.page-home-records .xpdf-header-actions .xpdf-action-btn {
        max-width: 178px !important;
    }
}

@media (max-width: 1180px) {
    body.page-home-records .xpdf-header-actions {
        max-width: none !important;
    }

    body.page-home-records .xpdf-title-wrap {
        grid-template-columns: 1fr !important;
    }
}

/* PDF viewer right panel cleanup and final sizing */
body.page-home-records .xpdf-header-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    align-items: stretch !important;
    gap: 0.6rem !important;
    width: min(520px, 48%) !important;
    max-width: min(520px, 48%) !important;
    flex: 0 0 min(520px, 48%) !important;
}

body.page-home-records .xpdf-header-actions .xpdf-action-btn {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 52px !important;
    height: auto !important;
    justify-content: flex-start !important;
    padding: 0.55rem 0.75rem !important;
    gap: 0.55rem !important;
}

body.page-home-records .xpdf-header-actions .xpdf-action-btn span {
    display: block !important;
    min-width: 0 !important;
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: normal !important;
    line-height: 1.15 !important;
}

body.page-home-records .xpdf-header-actions .xpdf-action-btn[data-act="download"] {
    grid-column: 2 !important;
    justify-content: center !important;
}

body.page-home-records .xpdf-right-panel {
    display: grid !important;
    grid-template-rows: 58px minmax(0, 1fr) !important;
    min-height: 0 !important;
    overflow: hidden !important;
}

body.page-home-records .xpdf-tabs {
    height: 58px !important;
    min-height: 58px !important;
}

body.page-home-records .xpdf-tab {
    height: 58px !important;
    min-height: 58px !important;
}

body.page-home-records .xpdf-tab-panel {
    min-height: 0 !important;
    height: 100% !important;
    overflow: hidden !important;
}

body.page-home-records .xpdf-tab-panel.is-active {
    display: flex !important;
    min-height: 0 !important;
    height: 100% !important;
}

body.page-home-records .xpdf-card-fill,
body.page-home-records .xpdf-summary-panel-card,
body.page-home-records .xpdf-rag-panel-card {
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) auto !important;
    min-height: 0 !important;
    height: 100% !important;
    flex: 1 1 auto !important;
    overflow: hidden !important;
}

body.page-home-records .xpdf-summary-panel-card .xpdf-card-head,
body.page-home-records .xpdf-rag-panel-card .xpdf-card-head {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.45rem !important;
}

body.page-home-records .xpdf-summary-body,
body.page-home-records .xpdf-rag-body {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    min-height: 0 !important;
    overflow: auto !important;
}

body.page-home-records .xpdf-card:has(.xpdf-quick-grid) {
    display: none !important;
}

body.page-home-records .xpdf-card-title {
    min-width: 0 !important;
}

@media (max-width: 1440px) {
    body.page-home-records .xpdf-header-actions {
        width: min(500px, 52%) !important;
        max-width: min(500px, 52%) !important;
        flex-basis: min(500px, 52%) !important;
    }

    body.page-home-records .xpdf-header-actions .xpdf-action-btn {
        min-height: 50px !important;
        font-size: 0.92rem !important;
    }
}

@media (max-width: 1180px) {
    body.page-home-records .xpdf-header-actions {
        width: 100% !important;
        max-width: 100% !important;
        flex-basis: 100% !important;
    }
}

/* PDF viewer header actions: keep record AI buttons readable */
body.page-home-records .xpdf-hero-main {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(560px, 620px) !important;
    align-items: center !important;
}

body.page-home-records .xpdf-header-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    width: 100% !important;
    max-width: 620px !important;
    flex: 0 0 620px !important;
    justify-self: end !important;
    gap: 0.65rem !important;
}

body.page-home-records .xpdf-header-actions .xpdf-action-btn,
body.page-home-records .xpdf-header-actions .xpdf-action-btn[data-act="record-sum"],
body.page-home-records .xpdf-header-actions .xpdf-action-btn[data-act="record-rag"] {
    display: inline-flex !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 54px !important;
    justify-content: flex-start !important;
    overflow: hidden !important;
    padding-inline: 1rem !important;
}

body.page-home-records .xpdf-header-actions .xpdf-action-btn span,
body.page-home-records .xpdf-header-actions .xpdf-action-btn[data-act="record-sum"] span,
body.page-home-records .xpdf-header-actions .xpdf-action-btn[data-act="record-rag"] span {
    display: block !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    max-width: none !important;
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: nowrap !important;
    font-size: 0.92rem !important;
    line-height: 1.1 !important;
}

body.page-home-records .xpdf-header-actions .xpdf-action-btn[data-act="download"] {
    grid-column: 2 !important;
    justify-content: center !important;
}

@media (max-width: 1480px) {
    body.page-home-records .xpdf-hero-main {
        grid-template-columns: minmax(0, 1fr) minmax(520px, 560px) !important;
    }

    body.page-home-records .xpdf-header-actions {
        max-width: 560px !important;
        flex-basis: 560px !important;
    }

    body.page-home-records .xpdf-header-actions .xpdf-action-btn span,
    body.page-home-records .xpdf-header-actions .xpdf-action-btn[data-act="record-sum"] span,
    body.page-home-records .xpdf-header-actions .xpdf-action-btn[data-act="record-rag"] span {
        white-space: normal !important;
    }
}

@media (max-width: 1260px) {
    body.page-home-records .xpdf-hero-main {
        grid-template-columns: 1fr !important;
    }

    body.page-home-records .xpdf-header-actions {
        width: 100% !important;
        max-width: none !important;
        flex-basis: auto !important;
        justify-self: stretch !important;
    }
}

/* PDF viewer header now only carries record AI actions; reprography lives in the toolbar. */
body.page-home-records .xpdf-hero-main {
    grid-template-columns: minmax(0, 1fr) minmax(420px, 480px) !important;
}

body.page-home-records .xpdf-header-actions {
    max-width: 480px !important;
    flex-basis: 480px !important;
}

body.page-home-records .xpdf-reprography-tool {
    min-width: 150px !important;
    max-width: 170px !important;
    border-color: rgba(31, 98, 240, 0.36) !important;
    background: linear-gradient(135deg, #2a73ff, #0d62ff) !important;
    color: #fff !important;
    font-weight: 850 !important;
    box-shadow: 0 10px 24px rgba(31, 98, 240, 0.24) !important;
}

body.page-home-records .xpdf-reprography-tool i {
    color: inherit !important;
}

body.page-home-records .xpdf-reprography-tool:hover,
body.page-home-records .xpdf-reprography-tool:focus-visible {
    border-color: rgba(90, 170, 255, 0.68) !important;
    background: linear-gradient(135deg, #3380ff, #0b55df) !important;
    color: #fff !important;
}

html[data-theme="dark"] body.page-home-records .xpdf-reprography-tool,
body.page-home-records[data-theme="dark"] .xpdf-reprography-tool {
    border-color: rgba(68, 215, 255, 0.42) !important;
    background:
        radial-gradient(circle at 20% 0%, rgba(68, 215, 255, 0.28), transparent 38%),
        linear-gradient(135deg, #176dff, #083f9f) !important;
    color: #f6fbff !important;
    box-shadow: 0 12px 26px rgba(3, 16, 40, 0.38), 0 0 18px rgba(68, 215, 255, 0.12) !important;
}

@media (max-width: 1480px) {
    body.page-home-records .xpdf-hero-main {
        grid-template-columns: minmax(0, 1fr) minmax(400px, 460px) !important;
    }

    body.page-home-records .xpdf-header-actions {
        max-width: 460px !important;
        flex-basis: 460px !important;
    }
}

@media (max-width: 1260px) {
    body.page-home-records .xpdf-hero-main {
        grid-template-columns: 1fr !important;
    }

    body.page-home-records .xpdf-header-actions {
        max-width: none !important;
        flex-basis: auto !important;
    }
}

/* Native records modals */
.records-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-height: 100%;
}

.records-search-bar {
    width: 100%;
}

.record-doc-icon {
    margin-right: 0.25rem;
}

.records-doc-close {
    appearance: none;
    border: 1px solid rgba(148, 170, 207, 0.45);
    background: rgba(255, 255, 255, 0.86);
    color: #17345f;
    border-radius: 12px;
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease;
}

.records-doc-close:hover {
    transform: translateY(-1px);
    border-color: rgba(59, 112, 210, 0.6);
    background: #ffffff;
}

.records-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: grid;
    place-items: center;
    padding: clamp(1rem, 3vw, 2.25rem);
    background: rgba(8, 22, 45, 0);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease, background-color 180ms ease;
}

.records-modal.is-open {
    background: rgba(8, 22, 45, 0.54);
    opacity: 1;
    pointer-events: auto;
}

.records-modal[hidden] {
    display: none !important;
}

.records-modal__dialog {
    width: min(100%, 760px);
    max-height: min(86vh, 920px);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
    border-radius: 24px;
    border: 1px solid rgba(166, 194, 234, 0.86);
    background:
        radial-gradient(circle at top right, rgba(77, 137, 246, 0.14), transparent 34%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(240, 246, 255, 0.98));
    box-shadow: 0 34px 90px rgba(8, 25, 55, 0.3);
    transform: translateY(12px) scale(0.985);
    transition: transform 180ms ease;
}

.records-modal.is-open .records-modal__dialog {
    transform: translateY(0) scale(1);
}

.records-modal__dialog--sm {
    max-width: 520px;
}

.records-modal__dialog--xl {
    max-width: min(1180px, 96vw);
}

.records-modal__header,
.records-modal__footer {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.05rem clamp(1.1rem, 2vw, 1.55rem);
    border-color: rgba(183, 203, 233, 0.78);
}

.records-modal__header {
    justify-content: space-between;
    border-bottom: 1px solid rgba(183, 203, 233, 0.78);
}

.records-modal__footer {
    justify-content: flex-end;
    border-top: 1px solid rgba(183, 203, 233, 0.78);
}

.records-modal__title {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    margin: 0;
    color: #102e5f;
    font-size: clamp(1.05rem, 1.6vw, 1.35rem);
    font-weight: 800;
    line-height: 1.2;
}

.records-modal__title img {
    width: 1.65rem;
    height: 1.65rem;
    object-fit: contain;
}

.records-modal__close {
    width: 2.55rem;
    height: 2.55rem;
    border: 1px solid rgba(157, 181, 219, 0.72);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.82);
    color: #315783;
    cursor: pointer;
    position: relative;
    transition: transform 180ms ease, background-color 180ms ease, border-color 180ms ease;
}

.records-modal__close::before,
.records-modal__close::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 1rem;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.records-modal__close::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.records-modal__close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.records-modal__close:hover {
    transform: translateY(-1px);
    border-color: rgba(70, 122, 216, 0.7);
    background: #ffffff;
}

.records-modal__body {
    min-height: 0;
    overflow: auto;
    padding: clamp(1rem, 2vw, 1.5rem);
    color: #213b63;
}

.records-modal__body--center {
    display: grid;
    place-items: center;
    text-align: center;
    min-height: 9rem;
}

.records-modal__body--center p {
    margin: 0;
    color: #243a5f;
    font-size: 1.08rem;
    font-weight: 700;
    line-height: 1.45;
}

.records-modal__primary,
.records-modal__secondary {
    min-height: 2.75rem;
    padding: 0.72rem 1.2rem;
    border-radius: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.records-modal__primary {
    border: 1px solid #1c61d5;
    background: linear-gradient(135deg, #246ff2, #164db6);
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(32, 95, 213, 0.22);
}

.records-modal__secondary {
    border: 1px solid rgba(157, 181, 219, 0.8);
    background: rgba(255, 255, 255, 0.9);
    color: #23436f;
}

.records-modal__primary:hover,
.records-modal__secondary:hover {
    transform: translateY(-1px);
}

.records-closing-layout {
    display: grid;
    grid-template-columns: minmax(240px, 0.42fr) minmax(0, 1fr);
    gap: clamp(1rem, 2vw, 1.35rem);
}

.records-closing-card,
.records-closing-table {
    min-width: 0;
    border: 1px solid rgba(176, 199, 231, 0.84);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.74);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

.records-closing-card {
    padding: 1rem;
}

.records-closing-card h3 {
    margin: 0 0 0.85rem;
    color: #15386c;
    font-size: 0.95rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.records-closing-meta {
    display: grid;
    gap: 0.72rem;
}

.records-closing-meta p {
    margin: 0;
    color: #405b84;
    font-size: 0.92rem;
    line-height: 1.4;
}

.records-closing-meta strong {
    color: #173767;
}

.records-closing-table {
    overflow: hidden;
    padding: 0.25rem;
}

.records-closing-table #docsTable {
    min-height: 550px;
}

html[data-theme="dark"] .records-doc-close,
body[data-theme="dark"] .records-doc-close {
    border-color: rgba(95, 143, 216, 0.48);
    background: rgba(15, 41, 78, 0.9);
    color: #dceaff;
}

html[data-theme="dark"] .records-modal.is-open,
body[data-theme="dark"] .records-modal.is-open {
    background: rgba(1, 8, 20, 0.68);
}

html[data-theme="dark"] .records-modal__dialog,
body[data-theme="dark"] .records-modal__dialog {
    border-color: rgba(82, 126, 192, 0.66);
    background:
        radial-gradient(circle at top right, rgba(78, 137, 229, 0.2), transparent 36%),
        linear-gradient(180deg, rgba(10, 31, 61, 0.98), rgba(6, 22, 44, 0.98));
    box-shadow: 0 34px 90px rgba(0, 0, 0, 0.54);
}

html[data-theme="dark"] .records-modal__header,
html[data-theme="dark"] .records-modal__footer,
body[data-theme="dark"] .records-modal__header,
body[data-theme="dark"] .records-modal__footer {
    border-color: rgba(82, 126, 192, 0.48);
}

html[data-theme="dark"] .records-modal__title,
body[data-theme="dark"] .records-modal__title {
    color: #f0f6ff;
}

html[data-theme="dark"] .records-modal__body,
body[data-theme="dark"] .records-modal__body,
html[data-theme="dark"] .records-modal__body--center p,
body[data-theme="dark"] .records-modal__body--center p {
    color: #d8e6fb;
}

html[data-theme="dark"] .records-modal__close,
html[data-theme="dark"] .records-modal__secondary,
body[data-theme="dark"] .records-modal__close,
body[data-theme="dark"] .records-modal__secondary {
    border-color: rgba(96, 145, 217, 0.54);
    background: rgba(16, 43, 80, 0.92);
    color: #dceaff;
}

html[data-theme="dark"] .records-closing-card,
html[data-theme="dark"] .records-closing-table,
body[data-theme="dark"] .records-closing-card,
body[data-theme="dark"] .records-closing-table {
    border-color: rgba(87, 130, 194, 0.56);
    background: rgba(9, 29, 57, 0.8);
}

html[data-theme="dark"] .records-closing-card h3,
html[data-theme="dark"] .records-closing-meta strong,
body[data-theme="dark"] .records-closing-card h3,
body[data-theme="dark"] .records-closing-meta strong {
    color: #f0f6ff;
}

html[data-theme="dark"] .records-closing-meta p,
body[data-theme="dark"] .records-closing-meta p {
    color: #bdd0ec;
}

@media (max-width: 760px) {
    .records-modal {
        align-items: end;
        padding: 0.75rem;
    }

    .records-modal__dialog {
        max-height: 88vh;
        border-radius: 20px;
    }

    .records-closing-layout {
        grid-template-columns: 1fr;
    }
}

/* NLP record voice controls */
.nlp-voice-enable-btn {
    min-height: 2.35rem;
    padding: 0.5rem 0.85rem;
    border: 1px solid rgba(85, 132, 205, 0.38);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    color: #173d78;
    font-weight: 800;
    cursor: pointer;
    transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease, color 180ms ease;
}

.nlp-voice-enable-btn:hover,
.nlp-voice-enable-btn:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(47, 127, 255, 0.58);
    outline: 0;
}

.nlp-voice-enable-btn.is-active {
    border-color: transparent;
    background: linear-gradient(145deg, #2f7fff, #145bd9);
    color: #ffffff;
}

.nlp-voice-toast {
    position: fixed;
    top: clamp(0.85rem, 2vw, 1.25rem);
    right: clamp(0.85rem, 2vw, 1.25rem);
    z-index: 3005;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    width: min(92vw, 420px);
    padding: 0.85rem 0.95rem;
    border-radius: 16px;
    border: 1px solid rgba(95, 143, 216, 0.46);
    background: rgba(16, 38, 72, 0.96);
    color: #f5f8ff;
    box-shadow: 0 18px 46px rgba(3, 12, 28, 0.28);
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: opacity 180ms ease, transform 180ms ease;
}

.nlp-voice-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.nlp-voice-toast[hidden] {
    display: none !important;
}

.nlp-voice-toast__body {
    min-width: 0;
    flex: 1 1 auto;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.35;
}

.nlp-voice-toast__close {
    width: 2rem;
    height: 2rem;
    flex: 0 0 auto;
    border: 1px solid rgba(206, 223, 255, 0.28);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: currentColor;
    cursor: pointer;
    position: relative;
}

.nlp-voice-toast__close::before,
.nlp-voice-toast__close::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0.9rem;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.nlp-voice-toast__close::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.nlp-voice-toast__close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

html[data-theme="dark"] .nlp-voice-enable-btn,
body[data-theme="dark"] .nlp-voice-enable-btn {
    border-color: rgba(95, 143, 216, 0.56);
    background: rgba(13, 44, 82, 0.96);
    color: #eaf2ff;
}

html[data-theme="dark"] .nlp-voice-enable-btn.is-active,
body[data-theme="dark"] .nlp-voice-enable-btn.is-active {
    border-color: rgba(77, 145, 255, 0.86);
    background: linear-gradient(145deg, #2f7fff, #145bd9);
    color: #ffffff;
}
