:root {
            --background: #061225;
            --background-light: #0b1d37;
            --panel: rgba(14, 35, 65, 0.86);
            --panel-light: rgba(23, 50, 87, 0.92);
            --border: rgba(133, 185, 255, 0.18);
            --text: #f3f7ff;
            --muted: #9bb0cc;
            --primary: #008cff;
            --primary-light: #16c8ff;
            --success: #39e58c;
            --danger: #ff6b7d;
            --shadow: 0 25px 70px rgba(0, 0, 0, 0.34);
        }

        * {
            box-sizing: border-box;
        }

        html {
            scroll-behavior: smooth;
        }

        body {
            margin: 0;
            min-height: 100vh;
            color: var(--text);
            background:
                radial-gradient(
                    circle at 15% 20%,
                    rgba(0, 140, 255, 0.25),
                    transparent 32%
                ),
                radial-gradient(
                    circle at 85% 30%,
                    rgba(22, 200, 255, 0.15),
                    transparent 35%
                ),
                linear-gradient(
                    145deg,
                    #020915 0%,
                    var(--background) 45%,
                    #061a33 100%
                );
            font-family:
                Inter,
                Arial,
                Helvetica,
                sans-serif;
        }

        button,
        textarea {
            font: inherit;
        }

        button {
            cursor: pointer;
        }

        .page-shell {
            width: min(1240px, calc(100% - 32px));
            margin: 0 auto;
            padding: 24px 0 50px;
        }

        .topbar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 20px;
            padding: 12px 0 34px;
        }

        .brand {
            display: flex;
            align-items: center;
            gap: 12px;
            font-size: 1.25rem;
            font-weight: 800;
            letter-spacing: -0.03em;
        }

        .brand-mark {
            display: grid;
            place-items: center;
            width: 42px;
            height: 42px;
            border: 1px solid rgba(126, 203, 255, 0.35);
            border-radius: 13px;
            background:
                linear-gradient(
                    145deg,
                    rgba(0, 140, 255, 0.45),
                    rgba(22, 200, 255, 0.16)
                );
            box-shadow: 0 12px 30px rgba(0, 140, 255, 0.18);
        }

        .navigation {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
        }

        .menu-button {
            min-height: 44px;
            padding: 0 18px;
            color: var(--text);
            border: 1px solid var(--border);
            border-radius: 12px;
            background: rgba(255, 255, 255, 0.045);
            transition:
                transform 0.18s ease,
                border-color 0.18s ease,
                background 0.18s ease;
        }

        .menu-button:hover {
            transform: translateY(-1px);
            border-color: rgba(22, 200, 255, 0.55);
            background: rgba(0, 140, 255, 0.12);
        }

        .menu-button.primary {
            color: #03121f;
            border-color: transparent;
            background:
                linear-gradient(
                    135deg,
                    var(--primary-light),
                    var(--primary)
                );
            font-weight: 800;
        }

        .hero-grid {
            display: grid;
            grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
            gap: 42px;
            align-items: start;
        }

        .hero-copy {
            padding: 64px 10px 20px 0;
        }

        .eyebrow {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 8px 13px;
            margin-bottom: 22px;
            border: 1px solid rgba(20, 190, 255, 0.24);
            border-radius: 999px;
            color: #a9ddff;
            background: rgba(8, 94, 164, 0.14);
            font-size: 0.88rem;
            font-weight: 700;
        }

        .eyebrow-dot {
            width: 8px;
            height: 8px;
            border-radius: 999px;
            background: var(--success);
            box-shadow: 0 0 14px rgba(57, 229, 140, 0.7);
        }

        h1 {
            max-width: 760px;
            margin: 0;
            font-size: clamp(3rem, 7vw, 6.4rem);
            line-height: 0.95;
            letter-spacing: -0.065em;
        }

        .gradient-text {
            color: transparent;
            background:
                linear-gradient(
                    90deg,
                    #ffffff 0%,
                    #4ccfff 48%,
                    #008cff 100%
                );
            background-clip: text;
            -webkit-background-clip: text;
        }

        .hero-description {
            max-width: 670px;
            margin: 28px 0 0;
            color: var(--muted);
            font-size: clamp(1rem, 2vw, 1.16rem);
            line-height: 1.75;
        }

        .hero-actions {
            display: flex;
            flex-wrap: wrap;
            gap: 12px;
            margin-top: 30px;
        }

        .action-button {
            min-height: 48px;
            padding: 0 20px;
            border-radius: 13px;
            font-weight: 800;
        }

        .action-button.primary {
            color: #02111f;
            border: none;
            background:
                linear-gradient(
                    135deg,
                    var(--primary-light),
                    var(--primary)
                );
            box-shadow: 0 15px 35px rgba(0, 140, 255, 0.25);
        }

        .action-button.secondary {
            color: var(--text);
            border: 1px solid var(--border);
            background: rgba(255, 255, 255, 0.045);
        }

        .feature-strip {
            display: grid;
            grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 12px;
            margin-top: 42px;
        }

        .feature-card {
            padding: 18px;
            border: 1px solid var(--border);
            border-radius: 16px;
            background: rgba(255, 255, 255, 0.035);
        }

        .feature-card strong {
            display: block;
            margin-bottom: 7px;
        }

        .feature-card span {
            color: var(--muted);
            font-size: 0.91rem;
            line-height: 1.5;
        }

        .glass-panel {
            border: 1px solid var(--border);
            border-radius: 24px;
            background:
                linear-gradient(
                    150deg,
                    rgba(20, 47, 85, 0.9),
                    rgba(6, 24, 48, 0.88)
                );
            box-shadow: var(--shadow);
            backdrop-filter: blur(18px);
        }

        .chat-panel {
            position: sticky;
            top: 22px;
            min-height: 650px;
            overflow: hidden;
        }

        .panel-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 14px;
            padding: 22px 24px;
            border-bottom: 1px solid var(--border);
        }

        .panel-title {
            display: flex;
            align-items: center;
            gap: 10px;
            margin: 0;
            font-size: 1.05rem;
        }

        

        .reset-button {
            padding: 8px 11px;
            color: var(--muted);
            border: 1px solid var(--border);
            border-radius: 10px;
            background: rgba(255, 255, 255, 0.035);
            font-size: 0.82rem;
        }
.chat-messages {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    height: 390px;
    padding: 22px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.message {
    display: block;
    width: fit-content;
    max-width: 85%;
    padding: 14px 16px;
    border-radius: 17px;
    line-height: 1.55;
    white-space: pre-line;
    word-break: normal;
    overflow-wrap: break-word;
}

.ai-message {
    align-self: flex-start;
    margin-right: auto;
    color: #eaf3ff;
    border: 1px solid rgba(136, 181, 240, 0.12);
    border-radius: 17px;
    background: rgba(105, 143, 194, 0.17);
}

.user-message {
    align-self: flex-end;
    margin-left: auto;
    color: #ffffff;
    border-top-right-radius: 6px;
    background: linear-gradient(
        135deg,
        #058cff,
        #0069ef
    );
}
        .chat-form {
            padding: 0 22px 22px;
        }

        .chat-input {
            width: 100%;
            min-height: 115px;
            resize: vertical;
            padding: 16px;
            color: var(--text);
            border: 1px solid rgba(133, 185, 255, 0.22);
            border-radius: 16px;
            outline: none;
            background: rgba(3, 16, 34, 0.48);
            line-height: 1.5;
        }

        .chat-input:focus {
            border-color: rgba(22, 200, 255, 0.7);
            box-shadow: 0 0 0 4px rgba(22, 200, 255, 0.08);
        }

        .chat-form-footer {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 14px;
            margin-top: 12px;
        }

        .chat-status {
            min-height: 20px;
            color: var(--muted);
            font-size: 0.86rem;
            line-height: 1.4;
        }

        .send-button {
            min-width: 108px;
            min-height: 44px;
            color: #02111f;
            border: none;
            border-radius: 12px;
            background:
                linear-gradient(
                    135deg,
                    var(--primary-light),
                    var(--primary)
                );
            font-weight: 800;
        }

        .send-button:disabled {
            cursor: not-allowed;
            opacity: 0.6;
        }

        .documents-panel {
            display: none;
            margin-top: 42px;
            padding: 26px;
        }

        .documents-panel.visible {
            display: block;
        }

        .documents-heading {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 20px;
            margin-bottom: 24px;
        }

        .documents-heading h2 {
            margin: 0 0 8px;
            font-size: 1.7rem;
        }

        .documents-heading p {
            margin: 0;
            color: var(--muted);
            line-height: 1.55;
        }

        .document-actions {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
        }

        .admin-button {
            min-height: 42px;
            padding: 0 16px;
            color: var(--text);
            border: 1px solid var(--border);
            border-radius: 11px;
            background: rgba(255, 255, 255, 0.05);
            font-weight: 700;
        }

        .admin-button.primary {
            color: #02111f;
            border: none;
            background:
                linear-gradient(
                    135deg,
                    var(--primary-light),
                    var(--primary)
                );
        }

        .documents-summary {
            display: flex;
            flex-wrap: wrap;
            gap: 12px;
            margin-bottom: 18px;
        }

        .summary-box {
            min-width: 160px;
            padding: 15px 17px;
            border: 1px solid var(--border);
            border-radius: 14px;
            background: rgba(255, 255, 255, 0.035);
        }

        .summary-label {
            display: block;
            margin-bottom: 5px;
            color: var(--muted);
            font-size: 0.82rem;
        }

        .summary-value {
            font-size: 1.2rem;
            font-weight: 800;
        }

        .documents-list {
            display: grid;
            gap: 10px;
        }

        

        .document-name {
            overflow-wrap: anywhere;
            font-weight: 750;
        }

        .document-meta {
            color: var(--muted);
            font-size: 0.88rem;
        }

        .document-extension {
            padding: 5px 8px;
            color: #9de4ff;
            border: 1px solid rgba(22, 200, 255, 0.18);
            border-radius: 8px;
            background: rgba(22, 200, 255, 0.08);
            font-size: 0.78rem;
            font-weight: 800;
            text-transform: uppercase;
        }

        .empty-state {
            padding: 28px;
            color: var(--muted);
            border: 1px dashed rgba(133, 185, 255, 0.22);
            border-radius: 16px;
            text-align: center;
        }

        .admin-status {
            min-height: 22px;
            margin-top: 14px;
            color: var(--muted);
            line-height: 1.5;
        }

        .admin-status.success {
            color: var(--success);
        }

        .admin-status.error {
            color: var(--danger);
        }

        footer {
            padding: 40px 0 10px;
            color: var(--muted);
            font-size: 0.88rem;
            text-align: center;
        }

        @media (max-width: 940px) {
            .hero-grid {
                grid-template-columns: 1fr;
            }

            .hero-copy {
                padding-top: 24px;
            }

            .chat-panel {
                position: static;
            }
        }

        @media (max-width: 680px) {
            .page-shell {
                width: min(100% - 20px, 1240px);
                padding-top: 12px;
            }

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

            .navigation {
                width: 100%;
            }

            .menu-button {
                flex: 1;
            }

            h1 {
                font-size: clamp(3rem, 17vw, 5rem);
            }

            .feature-strip {
                grid-template-columns: 1fr;
            }

            .chat-panel {
                min-height: auto;
                border-radius: 19px;
            }

            .chat-messages {
                height: 370px;
                padding: 16px;
            }

            .chat-form {
                padding: 0 16px 16px;
            }

            .documents-panel {
                padding: 18px;
            }

            .documents-heading {
                flex-direction: column;
            }

            .document-actions {
                width: 100%;
            }

            .admin-button {
                flex: 1;
            }

            .document-item {
                grid-template-columns: 1fr;
                gap: 8px;
            }
        }
.document-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    gap: 14px;
    align-items: center;
    padding: 15px 17px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.035);
}







.document-action-button.danger {
    color: #ffb9c2;
    border-color: rgba(255, 107, 125, 0.25);
}

.document-action-button.danger:hover {
    color: #ffffff;
    border-color: rgba(255, 107, 125, 0.7);
    background: rgba(255, 107, 125, 0.15);
}















.document-modal-status {
    padding: 14px 21px 0;
    color: var(--muted);
}





@media (max-width: 680px) {
    .document-item {
        grid-template-columns: 1fr;
    }

    .document-buttons {
        width: 100%;
    }

    .document-action-button {
        flex: 1;
    }
}
.document-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.document-modal.visible {
    display: flex;
}

.document-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 7, 20, 0.78);
    backdrop-filter: blur(6px);
}

.document-modal-content {
    position: relative;
    z-index: 1;
    width: min(850px, 100%);
    max-height: 85vh;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: #081a32;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.55);
}

.document-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 21px;
    border-bottom: 1px solid var(--border);
}

.document-modal-header h2 {
    margin: 0;
    font-size: 1.15rem;
    overflow-wrap: anywhere;
}

.modal-close-button {
    width: 38px;
    height: 38px;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    font-size: 1.3rem;
}

.document-modal-text {
    max-height: 65vh;
    margin: 0;
    padding: 21px;
    overflow: auto;
    color: #eaf3ff;
    font-family: inherit;
    line-height: 1.65;
    white-space: pre-wrap;
    overflow-wrap: break-word;
}

body.modal-open {
    overflow: hidden;
}
.document-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.document-action-button {
    min-height: 34px;
    padding: 0 12px;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.05);
    font-size: 0.82rem;
    font-weight: 700;
}

.document-action-button:hover {
    border-color: rgba(22, 200, 255, 0.6);
    background: rgba(0, 140, 255, 0.12);
}

.message-sources-title{
    margin-top:16px;
    margin-bottom:8px;
    font-size:.82rem;
    font-weight:700;
    opacity:.75;
}

.message-sources{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
}

.source-chip{
    padding:8px 14px;
    border:none;
    border-radius:999px;
    background:#16385d;
    color:white;
    cursor:pointer;
    font-size:.82rem;
    transition:.2s;
}

.source-chip:hover{
    background:#2c6fb2;
}
.system-status-bar {
    display: flex;
    align-items: stretch;
    width: 100%;
    margin: 18px 0 26px;
    padding: 10px 14px;
    border: 1px solid rgba(120, 170, 230, 0.18);
    border-radius: 16px;
    background: rgba(8, 28, 52, 0.65);
    backdrop-filter: blur(14px);
    overflow-x: auto;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 150px;
    padding: 8px 14px;
}

.status-item > div {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.status-label {
    color: var(--muted);
    font-size: 0.72rem;
}

.status-item strong {
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 700;
    white-space: nowrap;
}

.status-dot {
    width: 9px;
    height: 9px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #52e6a5;
    box-shadow: 0 0 10px rgba(82, 230, 165, 0.65);
}

.status-icon {
    font-size: 1rem;
}

.status-divider {
    width: 1px;
    margin: 6px 0;
    background: rgba(120, 170, 230, 0.14);
}

@media (max-width: 800px) {
    .system-status-bar {
        gap: 5px;
    }

    .status-divider {
        display: none;
    }

    .status-item {
        min-width: 135px;
    }
}
/* =========================================
   Tillgänglighet
========================================= */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* =========================================
   Dokumentuppladdning
========================================= */
.document-upload-section {
    display: grid;
    gap: 12px;
    margin-bottom: 20px;
}

.upload-area {
    display: grid;
    place-items: center;
    gap: 7px;
    min-height: 135px;
    padding: 22px;
    color: var(--muted);
    border: 1px dashed rgba(133, 185, 255, 0.30);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.025);
    text-align: center;
    transition:
        border-color 0.18s ease,
        background 0.18s ease,
        transform 0.18s ease;
}

.upload-area:hover,
.upload-area:focus-visible,
.upload-area.drag-active {
    border-color: rgba(22, 200, 255, 0.70);
    background: rgba(0, 140, 255, 0.08);
    outline: none;
}

.upload-area.drag-active {
    transform: translateY(-1px);
}

.upload-area strong {
    color: var(--text);
    font-size: 1rem;
}

.upload-area span {
    font-size: 0.86rem;
    line-height: 1.5;
}

.selected-file-name {
    min-height: 20px;
    color: #a9ddff;
    font-size: 0.86rem;
    overflow-wrap: anywhere;
}
.app-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 24px 16px;
    border-right: 1px solid var(--border);
    background: rgba(4, 16, 34, 0.92);
    backdrop-filter: blur(18px);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px 24px;
    font-weight: 800;
}

.sidebar-nav {
    display: grid;
    gap: 7px;
}

.sidebar-link {
    width: 100%;
    padding: 12px 14px;
    color: var(--muted);
    border: 1px solid transparent;
    border-radius: 11px;
    background: transparent;
    text-align: left;
    font-weight: 700;
}

.sidebar-link:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.045);
}

.sidebar-link.active {
    color: #ffffff;
    border-color: rgba(22, 200, 255, 0.18);
    background: rgba(0, 140, 255, 0.12);
}

.app-content {
    min-width: 0;
}

@media (max-width: 900px) {
    .app-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .sidebar-nav {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
/* =========================================
   Plattformens vyer
========================================= */

.app-view {
    display: none;
}

.app-view.active {
    display: block;
}

/* Dashboard använder grid-layout */
#dashboardView.app-view.active {
    display: grid;
}

/* Dokumentpanelen ska fungera som egen vy */
#documentsView.app-view.active {
    display: block;
}

.platform-view {
    margin-top: 24px;
    padding: 30px;
    min-height: 520px;
}

.view-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
}

.view-header h2 {
    margin: 5px 0 8px;
    font-size: 2rem;
}

.view-header p {
    max-width: 650px;
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.view-eyebrow {
    color: #72d8ff;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.coming-soon {
    display: grid;
    place-items: center;
    min-height: 300px;
    padding: 30px;
    color: var(--muted);
    border: 1px dashed var(--border);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.02);
    text-align: center;
}
/* =========================================
   ARJA AI DASHBOARD
========================================= */

.dashboard-view {
    padding: 4px 0 20px;
}

.view-title {
    margin: 5px 0 8px;
    font-size: clamp(2rem, 4vw, 3rem);
    letter-spacing: -0.04em;
}

.dashboard-header-status {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 14px;
    color: #bfffe0;
    border: 1px solid rgba(57, 229, 140, 0.18);
    border-radius: 12px;
    background: rgba(57, 229, 140, 0.06);
    font-size: 0.86rem;
    font-weight: 700;
}

.dashboard-grid {
    display: grid;
    grid-template-columns:
        repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin: 26px 0;
}

.dashboard-info-card {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 100px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background:
        linear-gradient(
            145deg,
            rgba(20, 47, 85, 0.72),
            rgba(7, 25, 49, 0.62)
        );
}

.dashboard-card-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border: 1px solid rgba(22, 200, 255, 0.16);
    border-radius: 12px;
    background: rgba(0, 140, 255, 0.08);
    font-size: 1.15rem;
}

.dashboard-card-label {
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 0.76rem;
}

.dashboard-info-card strong {
    font-size: 1.15rem;
}

.dashboard-columns {
    display: grid;
    grid-template-columns:
        minmax(0, 1.3fr)
        minmax(300px, 0.7fr);
    gap: 18px;
}

.dashboard-section {
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.025);
}

.dashboard-section-header {
    margin-bottom: 18px;
}

.dashboard-section-header h2 {
    margin: 5px 0 0;
    font-size: 1.25rem;
}

.quick-actions {
    display: grid;
    gap: 10px;
}

.quick-action {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 15px;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    text-align: left;
    transition:
        transform 0.18s ease,
        border-color 0.18s ease,
        background 0.18s ease;
}

.quick-action:hover {
    transform: translateY(-1px);
    border-color: rgba(22, 200, 255, 0.42);
    background: rgba(0, 140, 255, 0.08);
}

.quick-action-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 11px;
    background: rgba(0, 140, 255, 0.10);
}

.quick-action strong,
.quick-action small {
    display: block;
}

.quick-action small {
    margin-top: 4px;
    color: var(--muted);
}

.service-status-list {
    display: grid;
}

.service-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 52px;
    border-bottom: 1px solid rgba(133, 185, 255, 0.10);
}

.service-status-row:last-child {
    border-bottom: 0;
}

.service-status-row > span {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--muted);
}

.service-status-row strong {
    font-size: 0.88rem;
}

.service-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.service-dot.online {
    background: var(--success);
    box-shadow: 0 0 10px rgba(57, 229, 140, 0.55);
}


/* =========================================
   CHAT EGEN VY
========================================= */

.chat-view {
    padding-top: 4px;
}

.chat-panel-full {
    position: static;
    width: min(900px, 100%);
    min-height: 650px;
    margin: 20px auto 0;
}

.chat-panel-full .chat-messages {
    height: 400px;
}


/* =========================================
   RESPONSIVE DASHBOARD
========================================= */

@media (max-width: 1050px) {
    .dashboard-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .dashboard-columns {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-header-status {
        display: none;
    }
}
/* =========================================
   STATISTIK
========================================= */

.stats-grid {
    display: grid;
    grid-template-columns:
        repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin: 26px 0;
}

.stats-card {
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
}

.stats-label {
    display: block;
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 0.78rem;
}

.stats-card strong {
    display: block;
    margin-bottom: 7px;
    font-size: 1.6rem;
}

.stats-card small {
    color: var(--muted);
}

.stats-columns {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.stats-panel {
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.025);
}

.stats-panel-header {
    margin-bottom: 16px;
}

.stats-panel-header h2 {
    margin: 5px 0 0;
    font-size: 1.25rem;
}

.stats-status-list {
    display: grid;
}

.stats-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 52px;
    border-bottom:
        1px solid rgba(133, 185, 255, 0.10);
}

.stats-status-row:last-child {
    border-bottom: 0;
}

.stats-status-row span {
    color: var(--muted);
}

.stats-status-row strong {
    font-size: 0.9rem;
}

.stats-online {
    color: var(--success);
}

@media (max-width: 900px) {
    .stats-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .stats-columns {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 580px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}
/* =========================================
   ACTIVITY / LOGGAR
========================================= */

.activity-list {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.activity-item {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.025);
}

.activity-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(0, 140, 255, 0.10);
    font-size: 1.05rem;
}

.activity-chat {
    background: rgba(0, 140, 255, 0.12);
}

.activity-upload {
    background: rgba(57, 229, 140, 0.10);
}

.activity-delete {
    background: rgba(255, 107, 125, 0.10);
}

.activity-reindex {
    background: rgba(22, 200, 255, 0.10);
}

.activity-error {
    background: rgba(255, 180, 50, 0.10);
}

.activity-content {
    min-width: 0;
}

.activity-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.activity-top strong {
    font-size: 0.95rem;
}

.activity-top time {
    flex-shrink: 0;
    color: var(--muted);
    font-size: 0.76rem;
}

.activity-content p {
    margin: 7px 0 0;
    color: var(--muted);
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.activity-empty {
    padding: 35px;
    color: var(--muted);
    border: 1px dashed var(--border);
    border-radius: 16px;
    text-align: center;
}

@media (max-width: 620px) {

    .activity-top {
        align-items: flex-start;
        flex-direction: column;
        gap: 5px;
    }
}
/* =========================================
   DASHBOARD - SENASTE AKTIVITET
========================================= */

.recent-activity-section {
    margin-top: 18px;
}

.dashboard-activity-list {
    display: grid;
    gap: 8px;
}

.dashboard-activity-item {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    border: 1px solid rgba(133, 185, 255, 0.10);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
}

.dashboard-activity-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(0, 140, 255, 0.09);
}

.dashboard-activity-content {
    min-width: 0;
}

.dashboard-activity-content strong {
    display: block;
    font-size: 0.88rem;
}

.dashboard-activity-content span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-activity-time {
    color: var(--muted);
    font-size: 0.74rem;
    white-space: nowrap;
}

@media (max-width: 620px) {
    .dashboard-activity-item {
        grid-template-columns: 38px minmax(0, 1fr);
    }

    .dashboard-activity-time {
        grid-column: 2;
    }
}
/* =========================================
   CHAT WORKSPACE
========================================= */

.chat-workspace {
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
    gap: 18px;
    align-items: stretch;
    min-height: 620px;
}


/* =========================================
   CONVERSATION SIDEBAR
========================================= */

.conversation-sidebar {
    display: flex;
    flex-direction: column;
    min-width: 0;

    height: 620px;
    max-height: 620px;
    overflow: hidden;

    padding: 18px;

    border: 1px solid rgba(133, 185, 255, 0.12);
    border-radius: 18px;

    background: rgba(10, 18, 34, 0.72);
    backdrop-filter: blur(18px);
}

.conversation-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.conversation-sidebar-header h2 {
    margin: 4px 0 0;
    font-size: 1rem;
}


/* =========================================
   NEW CONVERSATION
========================================= */

.new-conversation-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 11px 14px;
    margin-bottom: 16px;

    border: 1px solid rgba(80, 160, 255, 0.22);
    border-radius: 11px;

    background: rgba(0, 119, 255, 0.10);
    color: inherit;

    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;

    cursor: pointer;
    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease;
}

.new-conversation-button:hover {
    background: rgba(0, 119, 255, 0.17);
    border-color: rgba(80, 160, 255, 0.38);
}

.new-conversation-button:active {
    transform: scale(0.98);
}


/* =========================================
   CONVERSATION LIST
========================================= */

.conversation-list {
    display: flex;
    flex-direction: column;
    gap: 5px;

    flex: 1;
    min-height: 0;

    overflow-y: auto;
    overflow-x: hidden;

    padding-right: 4px;
}
.conversation-list {
    scrollbar-gutter: stable;
    scrollbar-width: thin;
}

.conversation-list::-webkit-scrollbar {
    width: 8px;
}

.conversation-list::-webkit-scrollbar-track {
    background: transparent;
}

.conversation-list::-webkit-scrollbar-thumb {
    background: rgba(133, 185, 255, 0.25);
    border-radius: 10px;
}

.conversation-list::-webkit-scrollbar-thumb:hover {
    background: rgba(133, 185, 255, 0.45);
}
.conversation-empty {
    padding: 18px 10px;
    color: var(--muted);
    font-size: 0.78rem;
    text-align: center;
}

.conversation-status {
    min-height: 18px;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 0.72rem;
}


/* =========================================
   CONVERSATION ITEM
========================================= */

.conversation-item {
    position: relative;

    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;

    width: 100%;
    padding: 10px 11px;

    border: 1px solid transparent;
    border-radius: 10px;

    background: transparent;
    color: inherit;

    font: inherit;
    text-align: left;

    cursor: pointer;
    transition:
        background 0.18s ease,
        border-color 0.18s ease;
}

.conversation-item:hover {
    background: rgba(255, 255, 255, 0.045);
}

.conversation-item.active {
    border-color: rgba(65, 145, 255, 0.22);
    background: rgba(0, 119, 255, 0.11);
}

.conversation-item-title {
    display: block;
    width: 100%;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    font-size: 0.82rem;
    font-weight: 600;
}

.conversation-item-date {
    color: var(--muted);
    font-size: 0.68rem;
}


/* =========================================
   ACTIVE CHAT
========================================= */
.conversation-row {
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 6px;
    margin-bottom: 8px;
}

.conversation-row .conversation-item {
    flex: 1;
    min-width: 0;
}

.conversation-menu-container {
    position: relative;
    display: flex;
    align-items: center;
}

.conversation-menu-button {
    width: 36px;
    min-width: 36px;
    height: 100%;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: inherit;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.conversation-menu-button:hover {
    background: rgba(255, 255, 255, 0.08);
}

.conversation-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 1000;

    min-width: 150px;
    padding: 6px;

    border-radius: 10px;
    background: #111827;
    border: 1px solid rgba(255, 255, 255, 0.1);

    box-shadow:
        0 12px 30px rgba(0, 0, 0, 0.35);
}

.conversation-menu[hidden] {
    display: none;
}

.conversation-menu button {
    width: 100%;
    padding: 10px 12px;

    border: 0;
    border-radius: 8px;
    background: transparent;

    color: #f9fafb;
    text-align: left;
    cursor: pointer;
}

.conversation-menu button:hover {
    background: rgba(255, 255, 255, 0.08);
}

.conversation-delete-button {
    color: #fca5a5 !important;
}

.chat-workspace .chat-panel {
    min-width: 0;
    margin: 0;
}

.active-chat-heading {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.active-conversation-status {
    padding-left: 18px;
    color: var(--muted);
    font-size: 0.72rem;
}


/* =========================================
   RESPONSIVE
========================================= */

@media (max-width: 900px) {

    .chat-workspace {
        grid-template-columns: 220px minmax(0, 1fr);
    }

}

@media (max-width: 720px) {

    .chat-workspace {
        grid-template-columns: 1fr;
    }

   .conversation-sidebar {
    height: auto;
    max-height: 260px;
}

    .conversation-list {
        max-height: 160px;
    }

}
/* Tydligare scrollbar för konversationshistoriken */

.conversation-list {
    scrollbar-width: auto;
    scrollbar-color:
        rgba(133, 185, 255, 0.65)
        rgba(255, 255, 255, 0.04);
    scrollbar-gutter: stable;
}

.conversation-list::-webkit-scrollbar {
    width: 10px;
}

.conversation-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
}

.conversation-list::-webkit-scrollbar-thumb {
    background: rgba(133, 185, 255, 0.65);
    border-radius: 10px;
}

.conversation-list::-webkit-scrollbar-thumb:hover {
    background: rgba(133, 185, 255, 0.9);
}
/* V4 - Stor dokument/PDF-visare */
.document-modal-content {
    width: calc(100vw - 40px);
    height: calc(100vh - 40px);
    max-width: 1500px;
    max-height: 1000px;

    display: flex;
    flex-direction: column;

    overflow: hidden;
}

.document-modal-header {
    flex: 0 0 auto;
}

.document-modal-status {
    flex: 0 0 auto;
}

.document-modal-frame {
    flex: 1 1 auto;

    width: 100%;
    height: 100%;
    min-height: 0;

    border: 0;
    border-radius: 0 0 12px 12px;

    background: #ffffff;
}

.document-modal-text {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

@media (max-width: 720px) {
    .document-modal-content {
        width: calc(100vw - 16px);
        height: calc(100vh - 16px);
    }
}

/* V4 - XLSX-förhandsvisning */

.document-modal-spreadsheet {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.document-modal-spreadsheet[hidden] {
    display: none;
}

.spreadsheet-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.spreadsheet-sheet-info {
    font-weight: 600;
}

.spreadsheet-sheet-select {
    padding: 7px 10px;
    border-radius: 8px;
}

.spreadsheet-table-wrapper {
    flex: 1;
    min-height: 0;
    overflow: auto;
}

.spreadsheet-table {
    border-collapse: separate;
    border-spacing: 0;
    min-width: 100%;
    width: max-content;
}

.spreadsheet-table th,
.spreadsheet-table td {
    padding: 10px 14px;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    text-align: left;
    white-space: nowrap;
    vertical-align: top;
}

.spreadsheet-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    font-weight: 700;
    background: #18243a;
}

.spreadsheet-table tbody tr:hover td {
    background: rgba(255, 255, 255, 0.04);
}

.spreadsheet-footer {
    padding: 8px 14px;
    font-size: 13px;
    opacity: 0.7;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.spreadsheet-loading {
    padding: 20px;
}

/* V5 - Markdown i AI-svar */

.ai-message p {
    margin: 0 0 10px;
    line-height: 1.6;
}

.ai-message p:last-child {
    margin-bottom: 0;
}

.ai-message h1,
.ai-message h2,
.ai-message h3,
.ai-message h4 {
    margin: 16px 0 8px;
    line-height: 1.3;
}

.ai-message ul,
.ai-message ol {
    margin: 8px 0 12px;
    padding-left: 24px;
}

.ai-message li {
    margin: 4px 0;
    line-height: 1.5;
}

.ai-message code {
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    font-family: monospace;
}

.ai-code-block {
    overflow-x: auto;
    margin: 12px 0;
    padding: 14px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.28);
}

.ai-code-block code {
    padding: 0;
    background: transparent;
    white-space: pre;
}

.ai-table-wrapper {
    width: 100%;
    overflow-x: auto;
    margin: 12px 0;
}

.ai-table {
    border-collapse: collapse;
    min-width: 100%;
}

.ai-table th,
.ai-table td {
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    text-align: left;
}

.ai-table th {
    font-weight: 700;
    background: rgba(255, 255, 255, 0.06);
}

/* V5 - Anpassade rubrikstorlekar i AI-svar */

.ai-message h1 {
    font-size: 26px;
    line-height: 1.25;
    margin: 14px 0 10px;
}

.ai-message h2 {
    font-size: 22px;
    line-height: 1.3;
    margin: 14px 0 8px;
}

.ai-message h3 {
    font-size: 19px;
    line-height: 1.35;
    margin: 12px 0 8px;
}

.ai-message h4 {
    font-size: 17px;
    line-height: 1.4;
    margin: 10px 0 6px;
}

.ai-message {
    overflow-wrap: anywhere;
}

.ai-message strong {
    font-weight: 700;
}

/* V5 - Markdown i AI-svar */

.ai-message p {
    margin: 0 0 10px;
    line-height: 1.6;
}

.ai-message p:last-child {
    margin-bottom: 0;
}

.ai-message h1,
.ai-message h2,
.ai-message h3,
.ai-message h4 {
    margin: 16px 0 8px;
    line-height: 1.3;
}

.ai-message ul,
.ai-message ol {
    margin: 8px 0 12px;
    padding-left: 24px;
}

.ai-message li {
    margin: 4px 0;
    line-height: 1.5;
}

.ai-message code {
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    font-family: monospace;
}

.ai-code-block {
    overflow-x: auto;
    margin: 12px 0;
    padding: 14px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.28);
}

.ai-code-block code {
    padding: 0;
    background: transparent;
    white-space: pre;
}

.ai-table-wrapper {
    width: 100%;
    overflow-x: auto;
    margin: 12px 0;
}

.ai-table {
    border-collapse: collapse;
    min-width: 100%;
}

.ai-table th,
.ai-table td {
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    text-align: left;
}

.ai-table th {
    font-weight: 700;
    background: rgba(255, 255, 255, 0.06);
}

/* V5 - AI message actions */
.message-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.message-action-button {
    border: 0;
    border-radius: 8px;
    padding: 6px 9px;
    background: transparent;
    color: rgba(255, 255, 255, 0.65);
    cursor: pointer;
    font-size: 12px;
}

.message-action-button:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

/* V5 - Sök konversationer */
.conversation-search {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0 8px;
    padding: 0 10px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
}

.conversation-search:focus-within {
    border-color: rgba(255, 255, 255, 0.24);
    background: rgba(255, 255, 255, 0.06);
}

.conversation-search-icon {
    opacity: 0.55;
    font-size: 16px;
}

.conversation-search-input {
    width: 100%;
    min-width: 0;
    padding: 9px 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 13px;
}

.conversation-search-input::placeholder {
    color: rgba(255, 255, 255, 0.42);
}


/* =========================================
   V6 - AUTH / LOGIN
========================================= */

[hidden] {
    display: none !important;
}

.login-view {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: min(440px, 100%);
    padding: 32px;
    border: 1px solid rgba(120, 170, 230, 0.18);
    border-radius: 22px;
    background: rgba(15, 29, 50, 0.94);
    box-shadow:
        0 24px 70px rgba(0, 0, 0, 0.30);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 34px;
}

.login-brand > div:last-child {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.login-brand strong {
    font-size: 1rem;
}

.login-brand span {
    font-size: 0.78rem;
    opacity: 0.55;
}

.login-heading {
    margin-bottom: 26px;
}

.login-heading h1 {
    margin: 5px 0 8px;
    font-size: 2rem;
}

.login-heading p {
    margin: 0;
    opacity: 0.65;
    line-height: 1.55;
}

.login-form {
    display: grid;
    gap: 18px;
}

.login-form label {
    display: grid;
    gap: 7px;
}

.login-form label > span {
    font-size: 0.82rem;
    font-weight: 700;
    opacity: 0.75;
}

.login-form input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    outline: none;
    background: rgba(255, 255, 255, 0.05);
    color: inherit;
    font: inherit;
}

.login-form input:focus {
    border-color: rgba(22, 200, 255, 0.65);
    background: rgba(255, 255, 255, 0.07);
}

.login-status {
    min-height: 20px;
    color: #ff9c9c;
    font-size: 0.82rem;
}

.login-submit {
    width: 100%;
    padding: 12px 16px;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

.login-submit:disabled {
    cursor: wait;
    opacity: 0.6;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

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

.topbar-user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.topbar-user-info strong {
    font-size: 0.82rem;
}

.topbar-user-info span {
    font-size: 0.72rem;
    opacity: 0.5;
}

.logout-button {
    padding: 7px 10px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 8px;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.logout-button:hover {
    background: rgba(255, 255, 255, 0.07);
}

@media (max-width: 620px) {
    .login-card {
        padding: 24px;
    }

    .topbar-user-info {
        display: none;
    }
}


/* =========================================
   V6 - USER ADMINISTRATION
========================================= */

.user-admin-panel {
    display: grid;
    gap: 24px;
}

.user-admin-card,
.settings-access-note {
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.025);
}

.user-admin-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.user-admin-card-header h2 {
    margin: 4px 0 6px;
}

.user-admin-card-header p,
.settings-access-note p {
    margin: 0;
    opacity: 0.65;
}

.user-create-form {
    display: grid;
    grid-template-columns:
        minmax(160px, 1fr)
        minmax(180px, 1fr)
        minmax(140px, 180px)
        auto;
    align-items: end;
    gap: 12px;
}

.user-create-form label,
.user-admin-field {
    display: grid;
    gap: 6px;
}

.user-create-form label > span,
.user-admin-field > span {
    font-size: 0.78rem;
    font-weight: 700;
    opacity: 0.65;
}

.user-create-form input,
.user-create-form select,
.user-admin-field select,
.user-password-form input {
    box-sizing: border-box;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.045);
    color: inherit;
    font: inherit;
}

.users-list {
    display: grid;
    gap: 10px;
}

.user-admin-row {
    display: grid;
    grid-template-columns:
        minmax(180px, 1.4fr)
        minmax(130px, 0.8fr)
        minmax(110px, 0.6fr)
        minmax(160px, 1fr);
    gap: 14px;
    align-items: center;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.025);
}

.user-admin-identity {
    display: grid;
    gap: 4px;
}

.user-admin-identity small {
    opacity: 0.5;
}

.user-self-badge {
    display: inline-flex;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.08);
}

.user-status-button,
.user-secondary-button {
    width: max-content;
    padding: 8px 11px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: inherit;
    cursor: pointer;
    font: inherit;
}

.user-status-button.active {
    font-weight: 700;
}

.user-status-button.inactive {
    opacity: 0.6;
}

.user-password-area {
    display: grid;
    gap: 8px;
}

.user-password-form {
    display: flex;
    gap: 7px;
}

.admin-status.error {
    color: #ff9c9c;
}

@media (max-width: 980px) {
    .user-create-form {
        grid-template-columns: 1fr 1fr;
    }

    .user-admin-row {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 620px) {
    .user-create-form,
    .user-admin-row {
        grid-template-columns: 1fr;
    }

    .user-admin-card-header {
        flex-direction: column;
    }
}


/* ==========================================================
   V7 - Mitt konto / lösenordsbyte
   ========================================================== */

.account-panel {
    margin-bottom: 22px;
}

.account-password-form {
    display: grid;
    gap: 16px;
    max-width: 620px;
}

.account-password-form label {
    display: grid;
    gap: 7px;
}

.account-password-form label > span {
    font-weight: 600;
}

.account-password-form input {
    width: 100%;
    box-sizing: border-box;
}

.account-password-form small {
    opacity: 0.7;
}

.account-password-form .admin-button {
    justify-self: start;
}

.account-password-form button:disabled {
    opacity: 0.65;
    cursor: wait;
}


/* ==========================================================
   V7.3 - Audit / säkerhetsloggar
   ========================================================== */

.activity-actor {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 7px;
    font-size: 0.82rem;
    opacity: 0.72;
}

.activity-actor strong {
    font-weight: 650;
}


/* ==========================================================
   V7.4 - Sessionshantering
   ========================================================== */

.account-session-section {
    margin-top: 30px;
    padding-top: 24px;
    border-top: 1px solid rgba(127, 127, 127, 0.2);
}

.account-session-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.account-sessions-list {
    display: grid;
    gap: 10px;
    margin: 14px 0 18px;
}

.account-session-item {
    display: grid;
    gap: 5px;
    padding: 14px 16px;
    border: 1px solid rgba(127, 127, 127, 0.2);
    border-radius: 12px;
}

.account-session-item > span {
    font-size: 0.85rem;
    opacity: 0.72;
}

.session-current-badge {
    display: inline-block;
    margin-left: 5px;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    background: rgba(127, 127, 127, 0.15);
}

.account-danger-button {
    margin-top: 4px;
}


/* ==========================================================
   V7.5 - Enskilda sessioner
   ========================================================== */

.account-session-actions {
    margin-top: 8px;
}

.session-end-button {
    font-size: 0.82rem;
}

/* V8 Security overview */
.security-overview {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.security-overview-card {
    padding: 16px;
    border: 1px solid
        rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    background:
        rgba(255, 255, 255, 0.035);
}

.security-overview-card span {
    display: block;
    font-size: 0.82rem;
    opacity: 0.72;
    margin-bottom: 8px;
}

.security-overview-card strong {
    display: block;
    font-size: 1.6rem;
    font-weight: 700;
}

/* V9.1 User overview */
.user-session-meta {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(120px, 1fr));
    gap: 8px 14px;
    margin-top: 12px;
}

.user-session-meta > span {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-session-meta small {
    opacity: 0.62;
    font-size: 0.72rem;
}

.user-session-meta strong {
    font-size: 0.82rem;
    font-weight: 600;
}

@media (max-width: 700px) {
    .user-session-meta {
        grid-template-columns: 1fr;
    }
}

/* V9.2 User search and filters */
.user-filter-bar {
    display: grid;
    grid-template-columns:
        minmax(220px, 2fr)
        minmax(140px, 1fr)
        minmax(140px, 1fr)
        minmax(180px, 1.2fr);
    gap: 10px;
    margin: 14px 0 18px;
}

.user-filter-bar input,
.user-filter-bar select {
    width: 100%;
    min-height: 42px;
}

.user-empty-state {
    padding: 24px;
    text-align: center;
    opacity: 0.7;
}

@media (max-width: 800px) {
    .user-filter-bar {
        grid-template-columns: 1fr;
    }
}

/* V9.4 Admin session details */
.user-sessions-panel {
    width: 100%;
    margin-top: 10px;
    display: grid;
    gap: 8px;
}

.user-session-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 12px;
    border: 1px solid rgba(128, 128, 128, 0.2);
    border-radius: 10px;
}

.user-session-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.user-session-details strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-session-details small {
    opacity: 0.7;
}

.user-session-empty {
    padding: 10px 0;
    opacity: 0.7;
}

@media (max-width: 700px) {
    .user-session-item {
        align-items: stretch;
        flex-direction: column;
    }
}

/* V9.5 User overview cards */
.users-overview {
    display: grid;
    grid-template-columns:
        repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 14px 0 18px;
}

.users-overview-card {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 14px 16px;
    border: 1px solid rgba(128, 128, 128, 0.18);
    border-radius: 12px;
}

.users-overview-card strong {
    font-size: 1.35rem;
}

.users-overview-card span {
    font-size: 0.78rem;
    opacity: 0.68;
}

@media (max-width: 850px) {
    .users-overview {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 500px) {
    .users-overview {
        grid-template-columns: 1fr;
    }
}

/* V10.1 Document overview */

.document-item {
    grid-template-columns:
        minmax(180px, 1.25fr)
        minmax(320px, 2fr)
        auto;
}

.document-identity {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.document-name {
    min-width: 0;
}

.document-extension {
    flex: 0 0 auto;
}

.document-meta-grid {
    display: grid;
    grid-template-columns:
        repeat(3, minmax(90px, 1fr));
    gap: 10px 16px;
}

.document-meta-grid > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.document-meta-grid span {
    color: var(--muted);
    font-size: 0.72rem;
}

.document-meta-grid strong {
    font-size: 0.84rem;
    font-weight: 650;
}

.documents-summary {
    grid-template-columns:
        repeat(3, minmax(0, 1fr));
}

@media (max-width: 900px) {
    .document-item {
        grid-template-columns: 1fr;
    }

    .document-meta-grid {
        grid-template-columns:
            repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .document-meta-grid,
    .documents-summary {
        grid-template-columns: 1fr;
    }
}

/* V10.2 Document search, filters and sorting */

.document-filter-bar {
    display: grid;
    grid-template-columns:
        minmax(240px, 2fr)
        minmax(160px, 1fr)
        minmax(180px, 1fr);
    gap: 10px;
    margin: 18px 0;
}

.document-filter-bar input,
.document-filter-bar select {
    width: 100%;
    min-height: 42px;
}

@media (max-width: 760px) {
    .document-filter-bar {
        grid-template-columns: 1fr;
    }
}

/* V10.3 Document index status */

.document-index-status {
    flex: 0 0 auto;
    padding: 5px 8px;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 750;
}

.document-index-status.indexed {
    color: #9fffc2;
    border: 1px solid rgba(80, 220, 130, 0.25);
    background: rgba(80, 220, 130, 0.09);
}

.document-index-status.warning {
    color: #ffe19d;
    border: 1px solid rgba(255, 193, 80, 0.28);
    background: rgba(255, 193, 80, 0.09);
}

.document-index-status.error {
    color: #ffb6bf;
    border: 1px solid rgba(255, 100, 120, 0.28);
    background: rgba(255, 100, 120, 0.09);
}

@media (max-width: 700px) {
    .document-identity {
        flex-wrap: wrap;
    }
}

/* V10.4 Cleaner document rows */

.document-item {
    grid-template-columns:
        minmax(260px, 1.4fr)
        minmax(320px, 2fr)
        auto;
}

.document-identity {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
    min-width: 0;
}

.document-name {
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow-wrap: normal;
}

.document-badges {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

@media (max-width: 900px) {
    .document-item {
        grid-template-columns: 1fr;
    }
}

/* V10.6 Knowledge base index health */

.document-index-health {
    display: grid;
    grid-template-columns:
        repeat(3, minmax(130px, 1fr))
        auto;
    gap: 12px;
    align-items: center;
    margin: 18px 0;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.025);
}

.document-health-stat {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.document-health-stat span {
    color: var(--muted);
    font-size: 0.75rem;
}

.document-health-stat strong {
    font-size: 1.15rem;
}

@media (max-width: 800px) {
    .document-index-health {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .document-index-health {
        grid-template-columns: 1fr;
    }
}

/* V11.2 Source details */

.message-sources {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.source-chip {
    margin: 0;
}


/* V11.3 – AI document control */

.document-ai-status {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
}

.document-ai-status.active {
    background: rgba(40, 190, 120, 0.14);
    border: 1px solid rgba(40, 190, 120, 0.34);
}

.document-ai-status.inactive {
    background: rgba(160, 170, 185, 0.10);
    border: 1px solid rgba(160, 170, 185, 0.24);
    opacity: 0.82;
}

.document-index-status.inactive {
    opacity: 0.72;
}

.document-action-button.ai-toggle {
    white-space: nowrap;
}


/* V11.3 – tydligare källor */

.message-sources {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}

.source-chip {
    display: block;
    width: fit-content;
    max-width: 100%;
    margin: 0;
    white-space: normal;
    text-align: left;
    line-height: 1.4;
}


/* V11.3 – Dokument / Chunks */

.document-modal-tabs {
    display: flex;
    gap: 8px;
    padding: 10px 22px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.document-modal-tab {
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.04);
    color: inherit;
    cursor: pointer;
    font-size: 0.84rem;
    font-weight: 700;
}

.document-modal-tab:hover {
    background: rgba(255, 255, 255, 0.08);
}

.document-modal-tab.active {
    border-color: rgba(70, 170, 255, 0.5);
    background: rgba(40, 130, 230, 0.15);
}

.document-chunks-panel {
    padding: 18px 22px 24px;
    overflow-y: auto;
}

.document-chunks-panel[hidden] {
    display: none !important;
}

.document-chunks-summary {
    margin-bottom: 14px;
    font-size: 0.85rem;
    opacity: 0.72;
}

.document-chunks-empty {
    padding: 22px;
    border: 1px dashed rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    text-align: center;
    opacity: 0.72;
}

.document-chunk-card {
    margin-bottom: 14px;
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.025);
}

.document-chunk-title {
    margin-bottom: 9px;
    font-size: 0.82rem;
    font-weight: 800;
}

.document-chunk-content {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-family: inherit;
    font-size: 0.86rem;
    line-height: 1.55;
    max-height: 320px;
    overflow-y: auto;
}


/* ==========================================================
   V13.1 – SaaS visual foundation
   ========================================================== */

:root {
    --v13-bg: #08111f;
    --v13-bg-soft: #0c1728;
    --v13-sidebar: #0a1423;
    --v13-surface: rgba(17, 31, 51, 0.82);
    --v13-surface-strong: rgba(20, 36, 59, 0.96);
    --v13-surface-hover: rgba(31, 51, 78, 0.92);

    --v13-border: rgba(148, 163, 184, 0.14);
    --v13-border-strong: rgba(148, 163, 184, 0.22);

    --v13-text: #f8fafc;
    --v13-text-soft: #cbd5e1;
    --v13-muted: #8291a8;

    --v13-accent: #3b82f6;
    --v13-accent-bright: #60a5fa;
    --v13-accent-soft: rgba(59, 130, 246, 0.13);

    --v13-success: #34d399;
    --v13-danger: #fb7185;

    --v13-radius-sm: 10px;
    --v13-radius-md: 14px;
    --v13-radius-lg: 18px;
    --v13-radius-xl: 24px;

    --v13-shadow:
        0 18px 50px rgba(0, 0, 0, 0.24);
}


/* ---------- Global ---------- */

body {
    color: var(--v13-text);
    background:
        radial-gradient(
            circle at 75% -10%,
            rgba(59, 130, 246, 0.13),
            transparent 30%
        ),
        linear-gradient(
            180deg,
            #07101d 0%,
            var(--v13-bg) 100%
        );
}

button,
input,
textarea,
select {
    font-family: inherit;
}

button {
    transition:
        background 0.16s ease,
        border-color 0.16s ease,
        color 0.16s ease,
        transform 0.16s ease,
        box-shadow 0.16s ease;
}

button:active {
    transform: scale(0.985);
}


/* ---------- Main application layout ---------- */

.app-layout {
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    min-height: 100vh;
    background: transparent;
}

.app-content {
    min-width: 0;
}

.page-shell {
    width: 100%;
    max-width: 1540px;
    margin: 0 auto;
    padding: 0 32px 48px;
}


/* ---------- Sidebar ---------- */

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 22px 14px;
    border-right: 1px solid var(--v13-border);
    background:
        linear-gradient(
            180deg,
            rgba(10, 20, 35, 0.98),
            rgba(8, 17, 31, 0.98)
        );
    backdrop-filter: blur(18px);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 54px;
    margin-bottom: 26px;
    padding: 0 10px;
    font-size: 1.05rem;
    font-weight: 750;
    letter-spacing: -0.025em;
}

.sidebar-brand .brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 11px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 44px;
    padding: 0 13px;
    border: 1px solid transparent;
    border-radius: 11px;
    color: var(--v13-muted);
    background: transparent;
    font-size: 0.92rem;
    font-weight: 600;
    text-align: left;
}

.sidebar-link:hover {
    color: var(--v13-text);
    border-color: var(--v13-border);
    background: rgba(255, 255, 255, 0.035);
    transform: none;
}

.sidebar-link.active {
    color: #dbeafe;
    border-color: rgba(96, 165, 250, 0.18);
    background:
        linear-gradient(
            90deg,
            rgba(59, 130, 246, 0.18),
            rgba(59, 130, 246, 0.07)
        );
    box-shadow:
        inset 3px 0 0 var(--v13-accent-bright);
}


/* ---------- Topbar ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    min-height: 74px;
    margin: 0 -32px 24px;
    padding: 14px 32px;
    border-bottom: 1px solid var(--v13-border);
    background: rgba(8, 17, 31, 0.82);
    backdrop-filter: blur(20px);
}

.topbar .brand {
    font-size: 1.02rem;
}

.topbar .brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 11px;
}

.topbar-user {
    gap: 12px;
}

.topbar-user-info strong {
    color: var(--v13-text);
}

.topbar-user-info span {
    color: var(--v13-muted);
}

.logout-button {
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--v13-border);
    border-radius: 10px;
    color: var(--v13-text-soft);
    background: rgba(255, 255, 255, 0.035);
}

.logout-button:hover {
    color: var(--v13-text);
    border-color: var(--v13-border-strong);
    background: rgba(255, 255, 255, 0.065);
}


/* ---------- Status bar ---------- */

.system-status-bar {
    margin-bottom: 24px;
    border: 1px solid var(--v13-border);
    border-radius: var(--v13-radius-lg);
    background: rgba(15, 28, 47, 0.62);
    box-shadow: none;
}

.status-label {
    color: var(--v13-muted);
}

.status-dot {
    background: var(--v13-success);
    box-shadow:
        0 0 0 4px rgba(52, 211, 153, 0.09),
        0 0 16px rgba(52, 211, 153, 0.24);
}


/* ---------- General surfaces ---------- */

.glass-panel,
.dashboard-section,
.dashboard-info-card,
.document-upload-section,
.documents-summary,
.document-index-health,
.stats-card,
.settings-section {
    border-color: var(--v13-border) !important;
    background:
        linear-gradient(
            145deg,
            rgba(20, 36, 59, 0.82),
            rgba(13, 26, 44, 0.82)
        ) !important;
    box-shadow: none;
    backdrop-filter: blur(14px);
}

.glass-panel,
.dashboard-section {
    border-radius: var(--v13-radius-xl);
}

.dashboard-info-card,
.stats-card {
    border-radius: var(--v13-radius-lg);
}


/* ---------- View headings ---------- */

.view-header {
    margin-bottom: 22px;
}

.view-eyebrow {
    color: var(--v13-accent-bright);
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.view-title {
    margin-top: 5px;
    color: var(--v13-text);
    font-size: clamp(1.8rem, 3vw, 2.45rem);
    line-height: 1.08;
    letter-spacing: -0.045em;
}

.view-header p {
    color: var(--v13-muted);
}


/* ---------- Dashboard ---------- */

.dashboard-grid {
    gap: 14px;
}

.dashboard-info-card {
    min-height: 104px;
    padding: 20px;
}

.dashboard-info-card:hover {
    border-color: var(--v13-border-strong) !important;
    background:
        linear-gradient(
            145deg,
            rgba(25, 43, 68, 0.9),
            rgba(15, 29, 48, 0.9)
        ) !important;
}

.dashboard-card-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--v13-accent-soft);
}

.dashboard-card-label {
    color: var(--v13-muted);
}

.dashboard-info-card strong {
    color: var(--v13-text);
}


/* ---------- Inputs ---------- */

input,
textarea,
select {
    border-color: var(--v13-border) !important;
    color: var(--v13-text);
    background: rgba(7, 17, 31, 0.68) !important;
}

input::placeholder,
textarea::placeholder {
    color: #66778f;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: rgba(96, 165, 250, 0.62) !important;
    box-shadow:
        0 0 0 3px rgba(59, 130, 246, 0.11);
}


/* ---------- Chat workspace ---------- */

.chat-workspace {
    gap: 16px;
}

.conversation-sidebar {
    border-color: var(--v13-border);
    border-radius: var(--v13-radius-xl);
    background: rgba(13, 26, 44, 0.76);
    box-shadow: none;
}

.conversation-search {
    border-color: var(--v13-border);
    background: rgba(7, 17, 31, 0.56);
}

.conversation-item {
    border: 1px solid transparent;
    border-radius: 11px;
    color: var(--v13-text-soft);
    background: transparent;
}

.conversation-item:hover {
    border-color: var(--v13-border);
    background: rgba(255, 255, 255, 0.035);
}

.conversation-item.active {
    border-color: rgba(96, 165, 250, 0.18);
    background: var(--v13-accent-soft);
}

.conversation-item-date,
.conversation-status,
.conversation-empty {
    color: var(--v13-muted);
}

.chat-workspace .chat-panel {
    border-color: var(--v13-border);
    border-radius: var(--v13-radius-xl);
    background: rgba(13, 26, 44, 0.78);
    box-shadow: none;
}

.chat-messages {
    background:
        linear-gradient(
            180deg,
            rgba(8, 18, 32, 0.22),
            rgba(8, 18, 32, 0.05)
        );
}


/* ---------- Documents ---------- */

.document-item {
    border-color: var(--v13-border);
    background: rgba(9, 20, 35, 0.52);
}

.document-item:hover {
    border-color: var(--v13-border-strong);
    background: rgba(17, 33, 54, 0.68);
}

.document-name {
    color: var(--v13-text);
}

.document-meta-grid span {
    color: var(--v13-muted);
}

.document-action-button {
    border-color: var(--v13-border);
    color: var(--v13-text-soft);
    background: rgba(255, 255, 255, 0.035);
}

.document-action-button:hover {
    border-color: var(--v13-border-strong);
    color: var(--v13-text);
    background: rgba(255, 255, 255, 0.07);
}


/* ---------- Login ---------- */

.login-view {
    background:
        radial-gradient(
            circle at 50% 0%,
            rgba(59, 130, 246, 0.18),
            transparent 35%
        ),
        var(--v13-bg);
}

.login-card {
    border-color: var(--v13-border);
    border-radius: 24px;
    background: rgba(15, 29, 49, 0.9);
    box-shadow: var(--v13-shadow);
}


/* ---------- Responsive ---------- */

@media (max-width: 1050px) {
    .app-layout {
        grid-template-columns: 210px minmax(0, 1fr);
    }

    .page-shell {
        padding-left: 22px;
        padding-right: 22px;
    }

    .topbar {
        margin-left: -22px;
        margin-right: -22px;
        padding-left: 22px;
        padding-right: 22px;
    }
}

@media (max-width: 900px) {
    .app-layout {
        display: block;
    }

    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
        padding: 12px 16px;
        border-right: 0;
        border-bottom: 1px solid var(--v13-border);
    }

    .sidebar-brand {
        margin-bottom: 10px;
    }

    .sidebar-nav {
        flex-direction: row;
        gap: 6px;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    .sidebar-link {
        width: auto;
        flex: 0 0 auto;
        padding: 0 12px;
    }

    .sidebar-link.active {
        box-shadow:
            inset 0 -3px 0 var(--v13-accent-bright);
    }
}

@media (max-width: 620px) {
    .page-shell {
        padding: 0 14px 28px;
    }

    .topbar {
        position: relative;
        margin: 0 -14px 18px;
        padding: 12px 14px;
    }

    .topbar .brand {
        display: none;
    }

    .system-status-bar {
        overflow-x: auto;
    }

    .view-title {
        font-size: 1.8rem;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}


/* ==========================================================
   V13.2 – AI Chat polish
   ========================================================== */


/* ---------- Workspace ---------- */

.chat-workspace {
    grid-template-columns: 290px minmax(0, 1fr);
    gap: 18px;
    min-height: 660px;
}


/* ---------- Conversation history ---------- */

.conversation-sidebar {
    height: 660px;
    max-height: 660px;
    padding: 16px;
}

.conversation-sidebar-header {
    margin-bottom: 12px;
    padding: 2px 2px 0;
}

.conversation-sidebar-header h2 {
    margin-top: 5px;
    color: var(--v13-text);
    font-size: 1rem;
    letter-spacing: -0.02em;
}

.new-conversation-button {
    min-height: 42px;
    margin-bottom: 12px;
    padding: 0 14px;

    border: 1px solid rgba(96, 165, 250, 0.22);
    border-radius: 11px;

    color: #dbeafe;
    background:
        linear-gradient(
            135deg,
            rgba(59, 130, 246, 0.18),
            rgba(59, 130, 246, 0.08)
        );

    font-size: 0.84rem;
    font-weight: 650;
}

.new-conversation-button:hover {
    border-color: rgba(96, 165, 250, 0.38);
    background:
        linear-gradient(
            135deg,
            rgba(59, 130, 246, 0.26),
            rgba(59, 130, 246, 0.11)
        );
}


/* ---------- Search ---------- */

.conversation-search {
    min-height: 40px;
    margin: 0 0 10px;
    padding: 0 11px;

    border-radius: 11px;
}

.conversation-search:focus-within {
    border-color: rgba(96, 165, 250, 0.46);
    background: rgba(8, 19, 34, 0.82);
    box-shadow:
        0 0 0 3px rgba(59, 130, 246, 0.08);
}

.conversation-search-icon {
    color: var(--v13-muted);
    opacity: 0.75;
}

.conversation-search-input {
    padding: 9px 0;
    font-size: 0.8rem;
}


/* ---------- Conversation rows ---------- */

.conversation-list {
    gap: 3px;
    padding-right: 3px;
}

.conversation-row {
    gap: 4px;
    margin-bottom: 3px;
}

.conversation-item {
    gap: 5px;
    min-height: 55px;
    padding: 9px 10px;

    border-radius: 11px;
}

.conversation-item-title {
    color: var(--v13-text-soft);
    font-size: 0.8rem;
    font-weight: 600;
}

.conversation-item-date {
    color: #718198;
    font-size: 0.66rem;
}

.conversation-item:hover {
    background: rgba(255, 255, 255, 0.035);
}

.conversation-item.active {
    border-color: rgba(96, 165, 250, 0.2);
    background:
        linear-gradient(
            90deg,
            rgba(59, 130, 246, 0.15),
            rgba(59, 130, 246, 0.055)
        );
}

.conversation-item.active .conversation-item-title {
    color: #eff6ff;
}


/* ---------- Conversation menu ---------- */

.conversation-menu-button {
    width: 32px;
    min-width: 32px;

    border-radius: 9px;

    color: var(--v13-muted);
    font-size: 18px;
}

.conversation-menu-button:hover {
    color: var(--v13-text);
    background: rgba(255, 255, 255, 0.055);
}

.conversation-menu {
    min-width: 160px;
    padding: 6px;

    border: 1px solid var(--v13-border-strong);
    border-radius: 12px;

    background: rgba(13, 25, 43, 0.98);

    box-shadow:
        0 18px 50px rgba(0, 0, 0, 0.34);

    backdrop-filter: blur(16px);
}

.conversation-menu button {
    border-radius: 8px;
    color: var(--v13-text-soft);
    font-size: 0.8rem;
}


/* ---------- Main chat panel ---------- */

.chat-workspace .chat-panel {
    position: relative;
    top: auto;

    display: flex;
    flex-direction: column;

    height: 660px;
    min-height: 660px;

    overflow: hidden;
}

.chat-workspace .panel-header {
    flex: 0 0 auto;
    min-height: 68px;
    padding: 15px 20px;

    border-bottom: 1px solid var(--v13-border);

    background: rgba(14, 27, 46, 0.74);
}

.active-chat-heading {
    gap: 3px;
}

.active-chat-heading .panel-title {
    color: var(--v13-text);
    font-size: 0.94rem;
    font-weight: 680;
}

.active-conversation-status {
    padding-left: 18px;
    color: var(--v13-muted);
    font-size: 0.68rem;
}


/* ---------- Message area ---------- */

.chat-panel-full .chat-messages,
.chat-workspace .chat-messages {
    flex: 1 1 auto;

    height: auto;
    min-height: 0;

    gap: 17px;
    padding: 24px 26px 28px;

    background:
        radial-gradient(
            circle at 50% 0%,
            rgba(59, 130, 246, 0.035),
            transparent 36%
        );
}

.chat-messages::-webkit-scrollbar {
    width: 7px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    border-radius: 10px;
    background: rgba(148, 163, 184, 0.18);
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.32);
}


/* ---------- Messages ---------- */

.message {
    width: fit-content;
    max-width: min(82%, 820px);

    padding: 13px 15px;

    border-radius: 16px;

    font-size: 0.91rem;
    line-height: 1.62;
}

.ai-message {
    align-self: flex-start;

    border: 1px solid var(--v13-border);
    border-top-left-radius: 6px;

    color: var(--v13-text-soft);

    background:
        linear-gradient(
            145deg,
            rgba(27, 44, 68, 0.76),
            rgba(19, 34, 55, 0.66)
        );
}

.user-message {
    align-self: flex-end;
    margin-left: auto;

    max-width: min(74%, 720px);

    border: 1px solid rgba(96, 165, 250, 0.23);
    border-bottom-right-radius: 6px;

    color: #f8fbff;

    background:
        linear-gradient(
            135deg,
            rgba(37, 99, 235, 0.92),
            rgba(59, 130, 246, 0.78)
        );

    box-shadow:
        0 8px 24px rgba(37, 99, 235, 0.10);
}


/* ---------- Markdown inside AI ---------- */

.ai-message p {
    margin-bottom: 9px;
    line-height: 1.62;
}

.ai-message ul,
.ai-message ol {
    margin: 8px 0 10px;
    padding-left: 21px;
}

.ai-message li {
    margin: 3px 0;
    line-height: 1.55;
}

.ai-message h1 {
    font-size: 1.35rem;
}

.ai-message h2 {
    font-size: 1.17rem;
}

.ai-message h3 {
    font-size: 1.02rem;
}

.ai-message h4 {
    font-size: 0.94rem;
}

.ai-message code {
    border: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(5, 13, 25, 0.48);
}

.ai-code-block {
    border: 1px solid var(--v13-border);
    border-radius: 12px;
    background: rgba(5, 13, 25, 0.7);
}


/* ---------- Sources ---------- */

.message-sources {
    margin-top: 12px;
    padding-top: 10px;

    border-top: 1px solid rgba(148, 163, 184, 0.11);

    color: var(--v13-muted);
    font-size: 0.76rem;
}

.message-sources-title {
    margin-bottom: 7px;

    color: var(--v13-text-soft);

    font-size: 0.72rem;
    font-weight: 700;
}


/* ---------- Message actions ---------- */

.message-actions {
    gap: 4px;
    margin-top: 8px;
}

.message-action-button {
    min-height: 28px;
    padding: 4px 7px;

    border: 1px solid transparent;
    border-radius: 7px;

    color: #8291a8;

    font-size: 0.7rem;
}

.message-action-button:hover {
    border-color: var(--v13-border);
    color: var(--v13-text-soft);
    background: rgba(255, 255, 255, 0.035);
}


/* ---------- Chat composer ---------- */

.chat-form {
    flex: 0 0 auto;

    padding: 15px 18px 16px;

    border-top: 1px solid var(--v13-border);

    background: rgba(10, 21, 37, 0.88);
}

.chat-input {
    width: 100%;
    min-height: 58px;
    max-height: 150px;

    padding: 14px 15px;

    resize: vertical;

    border: 1px solid var(--v13-border) !important;
    border-radius: 13px;

    color: var(--v13-text);

    background: rgba(5, 14, 27, 0.72) !important;

    font-size: 0.9rem;
    line-height: 1.5;
}

.chat-input:focus {
    border-color: rgba(96, 165, 250, 0.55) !important;

    box-shadow:
        0 0 0 3px rgba(59, 130, 246, 0.09);
}

.chat-form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 12px;
    margin-top: 10px;
}

.chat-status {
    min-height: 18px;

    color: var(--v13-muted);

    font-size: 0.72rem;
}

.send-button {
    min-height: 38px;
    padding: 0 17px;

    border: 1px solid rgba(96, 165, 250, 0.28);
    border-radius: 10px;

    color: #ffffff;

    background:
        linear-gradient(
            135deg,
            #3b82f6,
            #2563eb
        );

    font-size: 0.82rem;
    font-weight: 700;

    box-shadow:
        0 8px 22px rgba(37, 99, 235, 0.18);
}

.send-button:hover {
    border-color: rgba(147, 197, 253, 0.42);

    background:
        linear-gradient(
            135deg,
            #4b8df8,
            #2d6bea
        );

    box-shadow:
        0 10px 26px rgba(37, 99, 235, 0.24);
}

.send-button:disabled {
    cursor: default;
    opacity: 0.52;
    box-shadow: none;
}


/* ---------- Responsive ---------- */

@media (max-width: 1050px) {
    .chat-workspace {
        grid-template-columns: 245px minmax(0, 1fr);
    }
}

@media (max-width: 720px) {
    .chat-workspace {
        grid-template-columns: 1fr;
    }

    .conversation-sidebar {
        height: auto;
        max-height: 270px;
    }

    .conversation-list {
        max-height: 165px;
    }

    .chat-workspace .chat-panel {
        height: 640px;
        min-height: 640px;
    }

    .message {
        max-width: 90%;
    }

    .user-message {
        max-width: 86%;
    }
}

@media (max-width: 520px) {
    .chat-panel-full .chat-messages,
    .chat-workspace .chat-messages {
        padding: 18px 14px 22px;
    }

    .message {
        max-width: 94%;
        padding: 12px 13px;
        font-size: 0.88rem;
    }

    .user-message {
        max-width: 90%;
    }

    .chat-form {
        padding: 12px;
    }

    .send-button {
        min-height: 40px;
        padding: 0 15px;
    }
}


/* ==========================================================
   V13.3 – Document workspace polish
   ========================================================== */


/* ---------- Document panel ---------- */

.documents-panel {
    padding: 24px;
}

.documents-panel .view-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}


/* ---------- Header actions ---------- */

.document-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.admin-button {
    min-height: 40px;
    padding: 0 14px;

    border: 1px solid var(--v13-border);
    border-radius: 10px;

    color: var(--v13-text-soft);
    background: rgba(255, 255, 255, 0.035);

    font-size: 0.8rem;
    font-weight: 650;
}

.admin-button:hover {
    color: var(--v13-text);
    border-color: var(--v13-border-strong);
    background: rgba(255, 255, 255, 0.065);
}

.admin-button.primary {
    color: #ffffff;

    border-color: rgba(96, 165, 250, 0.26);

    background:
        linear-gradient(
            135deg,
            #3b82f6,
            #2563eb
        );

    box-shadow:
        0 8px 22px rgba(37, 99, 235, 0.15);
}

.admin-button.primary:hover {
    border-color: rgba(147, 197, 253, 0.42);

    background:
        linear-gradient(
            135deg,
            #4b8df8,
            #2d6bea
        );
}


/* ---------- Upload area ---------- */

.document-upload-section {
    display: grid;
    grid-template-columns:
        minmax(0, 1fr)
        auto;

    gap: 12px;
    align-items: center;

    margin: 20px 0;
    padding: 16px;

    border-radius: 18px;
}

.upload-area {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;

    min-height: 90px;
    padding: 18px;

    border: 1px dashed rgba(96, 165, 250, 0.32);
    border-radius: 14px;

    color: var(--v13-text-soft);
    background: rgba(59, 130, 246, 0.045);

    cursor: pointer;

    transition:
        border-color 0.16s ease,
        background 0.16s ease;
}

.upload-area:hover,
.upload-area:focus {
    outline: none;

    border-color: rgba(96, 165, 250, 0.58);

    background: rgba(59, 130, 246, 0.08);
}

.upload-area strong {
    margin-bottom: 5px;

    color: var(--v13-text);

    font-size: 0.9rem;
}

.upload-area span {
    color: var(--v13-muted);

    font-size: 0.76rem;
}

.selected-file-name {
    grid-column: 1 / -1;

    min-height: 16px;

    color: var(--v13-muted);

    font-size: 0.74rem;
}


/* ---------- Summary cards ---------- */

.documents-summary {
    display: grid;
    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 12px;

    margin: 18px 0;
}

.summary-box {
    display: flex;
    flex-direction: column;
    gap: 5px;

    min-height: 90px;
    padding: 16px;

    border: 1px solid var(--v13-border);
    border-radius: 15px;

    background:
        linear-gradient(
            145deg,
            rgba(22, 38, 62, 0.76),
            rgba(13, 26, 44, 0.64)
        );
}

.summary-label {
    color: var(--v13-muted);

    font-size: 0.72rem;
}

.summary-value {
    color: var(--v13-text);

    font-size: 1.35rem;
    font-weight: 750;
    letter-spacing: -0.03em;
}


/* ---------- Index health ---------- */

.document-index-health {
    grid-template-columns:
        repeat(3, minmax(120px, 1fr))
        auto;

    gap: 12px;

    margin: 18px 0;
    padding: 15px;

    border-radius: 16px;

    background:
        linear-gradient(
            145deg,
            rgba(20, 35, 57, 0.72),
            rgba(12, 24, 41, 0.72)
        ) !important;
}

.document-health-stat {
    padding: 4px 2px;
}

.document-health-stat span {
    color: var(--v13-muted);

    font-size: 0.7rem;
}

.document-health-stat strong {
    color: var(--v13-text);

    font-size: 1.15rem;
}


/* ---------- Search / filters ---------- */

.document-filter-bar {
    display: grid;
    grid-template-columns:
        minmax(240px, 2fr)
        minmax(150px, 0.9fr)
        minmax(170px, 1fr);

    gap: 10px;

    margin: 18px 0 14px;
}

.document-filter-bar input,
.document-filter-bar select {
    min-height: 42px;
    padding: 0 12px;

    border-radius: 11px;

    font-size: 0.8rem;
}


/* ---------- Document list ---------- */

.documents-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.document-item {
    display: grid;

    grid-template-columns:
        minmax(240px, 1.35fr)
        minmax(300px, 1.8fr)
        auto;

    gap: 16px;
    align-items: center;

    padding: 15px 16px;

    border: 1px solid var(--v13-border);
    border-radius: 14px;

    background: rgba(7, 17, 31, 0.46);

    transition:
        border-color 0.16s ease,
        background 0.16s ease;
}

.document-item:hover {
    border-color: var(--v13-border-strong);

    background: rgba(18, 34, 55, 0.7);
}

.document-identity {
    gap: 8px;
}

.document-name {
    color: var(--v13-text);

    font-size: 0.86rem;
    font-weight: 670;
}

.document-badges {
    gap: 6px;
}

.document-extension {
    padding: 4px 7px;

    border: 1px solid var(--v13-border);
    border-radius: 7px;

    color: var(--v13-muted);
    background: rgba(255, 255, 255, 0.025);

    font-size: 0.66rem;
    font-weight: 700;
}


/* ---------- Metadata ---------- */

.document-meta-grid {
    display: grid;

    grid-template-columns:
        repeat(3, minmax(90px, 1fr));

    gap: 8px 14px;
}

.document-meta-grid > div {
    gap: 3px;
}

.document-meta-grid span {
    color: var(--v13-muted);

    font-size: 0.67rem;
}

.document-meta-grid strong {
    color: var(--v13-text-soft);

    font-size: 0.78rem;
    font-weight: 620;
}


/* ---------- Status badges ---------- */

.document-index-status,
.document-ai-status {
    min-height: 25px;

    padding: 4px 8px;

    border-radius: 999px;

    font-size: 0.68rem;
    font-weight: 700;
}

.document-index-status.indexed,
.document-ai-status.active {
    color: #a7f3d0;

    border-color: rgba(52, 211, 153, 0.24);

    background: rgba(52, 211, 153, 0.09);
}

.document-index-status.warning {
    color: #fde68a;

    border-color: rgba(251, 191, 36, 0.26);

    background: rgba(251, 191, 36, 0.09);
}

.document-index-status.error {
    color: #fecdd3;

    border-color: rgba(251, 113, 133, 0.26);

    background: rgba(251, 113, 133, 0.09);
}

.document-ai-status.inactive,
.document-index-status.inactive {
    color: var(--v13-muted);

    border-color: var(--v13-border);

    background: rgba(148, 163, 184, 0.05);

    opacity: 1;
}


/* ---------- Row buttons ---------- */

.document-buttons {
    display: flex;
    align-items: center;
    justify-content: flex-end;

    gap: 6px;
    flex-wrap: wrap;
}

.document-action-button {
    min-height: 34px;
    padding: 0 10px;

    border-radius: 9px;

    font-size: 0.72rem;
}

.document-action-button.ai-toggle {
    min-width: 88px;
}

.document-action-button.danger {
    color: #fda4af;
}

.document-action-button.danger:hover {
    color: #fecdd3;

    border-color: rgba(251, 113, 133, 0.26);

    background: rgba(251, 113, 133, 0.08);
}


/* ---------- Empty / status ---------- */

.empty-state {
    padding: 32px 20px;

    border: 1px dashed var(--v13-border);
    border-radius: 14px;

    color: var(--v13-muted);
    background: rgba(255, 255, 255, 0.015);

    text-align: center;
}

.admin-status {
    min-height: 18px;
    margin-top: 12px;

    color: var(--v13-muted);

    font-size: 0.74rem;
}


/* ---------- Document modal ---------- */

.document-modal-backdrop {
    background: rgba(2, 8, 18, 0.78);

    backdrop-filter: blur(8px);
}

.document-modal-content {
    width: calc(100vw - 48px);
    height: calc(100vh - 48px);

    max-width: 1500px;
    max-height: 1000px;

    border: 1px solid var(--v13-border-strong);
    border-radius: 20px;

    background: rgba(10, 21, 37, 0.98);

    box-shadow:
        0 30px 90px rgba(0, 0, 0, 0.5);
}

.document-modal-header {
    min-height: 62px;
    padding: 14px 18px;

    border-bottom: 1px solid var(--v13-border);

    background: rgba(15, 28, 47, 0.9);
}

.document-modal-header h2 {
    color: var(--v13-text);

    font-size: 1rem;
}

.modal-close-button {
    display: grid;
    place-items: center;

    width: 36px;
    height: 36px;

    border: 1px solid var(--v13-border);
    border-radius: 10px;

    color: var(--v13-muted);
    background: rgba(255, 255, 255, 0.03);
}

.modal-close-button:hover {
    color: var(--v13-text);

    border-color: var(--v13-border-strong);

    background: rgba(255, 255, 255, 0.065);
}

.document-modal-status {
    padding: 8px 18px;

    color: var(--v13-muted);

    font-size: 0.72rem;
}

.document-modal-text {
    margin: 0;
    padding: 22px;

    color: var(--v13-text-soft);
    background: rgba(5, 14, 27, 0.6);

    font-size: 0.84rem;
    line-height: 1.65;
}

.document-modal-frame {
    border-radius: 0 0 18px 18px;
}


/* ---------- Spreadsheet viewer ---------- */

.spreadsheet-toolbar {
    min-height: 52px;

    padding: 9px 14px;

    border-color: var(--v13-border);

    background: rgba(14, 27, 46, 0.88);
}

.spreadsheet-sheet-info {
    color: var(--v13-text-soft);

    font-size: 0.78rem;
}

.spreadsheet-sheet-select {
    min-height: 34px;

    border-radius: 9px;
}

.spreadsheet-table th,
.spreadsheet-table td {
    padding: 9px 12px;

    border-color: var(--v13-border);

    font-size: 0.78rem;
}

.spreadsheet-table th {
    color: var(--v13-text);

    background: #14233a;
}

.spreadsheet-table tbody tr:hover td {
    background: rgba(59, 130, 246, 0.05);
}

.spreadsheet-footer {
    color: var(--v13-muted);

    border-color: var(--v13-border);
}


/* ---------- Responsive ---------- */

@media (max-width: 1000px) {
    .document-item {
        grid-template-columns:
            minmax(220px, 1fr)
            minmax(240px, 1.3fr);
    }

    .document-buttons {
        grid-column: 1 / -1;

        justify-content: flex-start;
    }
}

@media (max-width: 800px) {
    .documents-panel {
        padding: 18px;
    }

    .documents-panel .view-header {
        flex-direction: column;
    }

    .document-upload-section {
        grid-template-columns: 1fr;
    }

    .document-index-health {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .document-filter-bar {
        grid-template-columns: 1fr;
    }

    .document-item {
        grid-template-columns: 1fr;
    }

    .document-buttons {
        grid-column: auto;
    }
}

@media (max-width: 560px) {
    .documents-summary {
        grid-template-columns: 1fr;
    }

    .document-index-health {
        grid-template-columns: 1fr;
    }

    .document-meta-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .document-modal-content {
        width: calc(100vw - 14px);
        height: calc(100vh - 14px);

        border-radius: 14px;
    }
}


/* ==========================================================
   V13.4 – Stats logs settings polish
   ========================================================== */


/* ---------- Shared admin views ---------- */

#statsView,
#logsView,
#settingsView {
    min-width: 0;
}

#settingsView {
    padding: 24px;
}

#logsView .view-header,
#settingsView .view-header,
#statsView .view-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}


/* ==========================================================
   STATISTIK
   ========================================================== */

.stats-grid {
    display: grid;
    grid-template-columns:
        repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stats-card {
    display: flex;
    flex-direction: column;
    gap: 5px;

    min-height: 118px;
    padding: 19px;

    border: 1px solid var(--v13-border);
    border-radius: 16px;

    background:
        linear-gradient(
            145deg,
            rgba(21, 38, 62, 0.82),
            rgba(13, 26, 44, 0.72)
        ) !important;
}

.stats-card:hover {
    border-color:
        var(--v13-border-strong) !important;
}

.stats-label {
    color: var(--v13-muted);
    font-size: 0.72rem;
    font-weight: 600;
}

.stats-card strong {
    margin-top: 3px;

    color: var(--v13-text);

    font-size: 1.45rem;
    font-weight: 750;
    letter-spacing: -0.04em;
}

.stats-card small {
    margin-top: auto;

    color: #718198;

    font-size: 0.68rem;
}

.stats-columns {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.stats-panel {
    padding: 20px;

    border: 1px solid var(--v13-border);
    border-radius: 18px;

    background:
        linear-gradient(
            145deg,
            rgba(20, 36, 59, 0.74),
            rgba(12, 25, 42, 0.72)
        );
}

.stats-panel-header {
    margin-bottom: 14px;
}

.stats-panel-header h2 {
    margin: 5px 0 0;

    color: var(--v13-text);

    font-size: 1rem;
    letter-spacing: -0.02em;
}

.stats-status-list {
    border-top: 1px solid var(--v13-border);
}

.stats-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 18px;
    min-height: 48px;

    border-bottom: 1px solid var(--v13-border);
}

.stats-status-row span {
    color: var(--v13-muted);

    font-size: 0.78rem;
}

.stats-status-row strong {
    color: var(--v13-text-soft);

    font-size: 0.8rem;
}

.stats-online {
    display: inline-flex;
    align-items: center;
    gap: 6px;

    color: #86efac !important;
}

.stats-online::before {
    content: "";

    width: 7px;
    height: 7px;

    border-radius: 999px;

    background: var(--v13-success);

    box-shadow:
        0 0 10px rgba(52, 211, 153, 0.38);
}


/* ==========================================================
   LOGGAR / SÄKERHET
   ========================================================== */

.security-overview {
    display: grid;
    grid-template-columns:
        repeat(5, minmax(0, 1fr));

    gap: 10px;

    margin: 18px 0;
}

.security-overview-card {
    display: flex;
    flex-direction: column;
    gap: 7px;

    min-height: 98px;
    padding: 15px;

    border: 1px solid var(--v13-border);
    border-radius: 14px;

    background:
        linear-gradient(
            145deg,
            rgba(20, 36, 59, 0.7),
            rgba(11, 24, 41, 0.68)
        );
}

.security-overview-card span {
    color: var(--v13-muted);

    font-size: 0.68rem;
    line-height: 1.35;
}

.security-overview-card strong {
    color: var(--v13-text);

    font-size: 1.25rem;
    font-weight: 750;
}

.activity-list {
    display: flex;
    flex-direction: column;

    gap: 8px;
    margin-top: 12px;
}

.activity-item {
    display: grid;
    grid-template-columns:
        38px minmax(0, 1fr);

    gap: 12px;

    padding: 13px 15px;

    border: 1px solid var(--v13-border);
    border-radius: 13px;

    background: rgba(8, 19, 33, 0.5);
}

.activity-item:hover {
    border-color: var(--v13-border-strong);

    background: rgba(16, 31, 51, 0.68);
}

.activity-icon {
    display: grid;
    place-items: center;

    width: 36px;
    height: 36px;

    border-radius: 10px;

    background: rgba(59, 130, 246, 0.1);

    font-size: 0.9rem;
}

.activity-content {
    min-width: 0;
}

.activity-top {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 12px;
}

.activity-top strong {
    color: var(--v13-text-soft);

    font-size: 0.8rem;
}

.activity-top time {
    flex: 0 0 auto;

    color: #718198;

    font-size: 0.65rem;
}

.activity-content p {
    margin: 5px 0 0;

    color: var(--v13-muted);

    font-size: 0.74rem;
    line-height: 1.5;
}

.activity-actor {
    margin-top: 5px;

    color: #718198;

    font-size: 0.67rem;
}

.activity-actor strong {
    color: var(--v13-text-soft);
}

.activity-empty {
    padding: 32px 20px;

    border: 1px dashed var(--v13-border);
    border-radius: 14px;

    color: var(--v13-muted);
    background: rgba(255, 255, 255, 0.015);

    font-size: 0.78rem;
    text-align: center;
}


/* ==========================================================
   INSTÄLLNINGAR
   ========================================================== */

.settings-access-note,
.user-admin-card,
.account-panel {
    border: 1px solid var(--v13-border);
    border-radius: 17px;

    background:
        linear-gradient(
            145deg,
            rgba(20, 36, 59, 0.72),
            rgba(12, 25, 42, 0.72)
        );
}

.settings-access-note {
    padding: 18px;
}

.settings-access-note strong {
    color: var(--v13-text);
}

.settings-access-note p {
    margin-bottom: 0;

    color: var(--v13-muted);
}

.user-admin-panel {
    display: flex;
    flex-direction: column;

    gap: 16px;
}

.user-admin-card,
.account-panel {
    padding: 20px;
}

.user-admin-card-header {
    margin-bottom: 17px;
}

.user-admin-card-header h2 {
    margin: 5px 0 6px;

    color: var(--v13-text);

    font-size: 1rem;
    letter-spacing: -0.02em;
}

.user-admin-card-header p {
    margin: 0;

    color: var(--v13-muted);

    font-size: 0.76rem;
    line-height: 1.5;
}


/* ---------- Password form ---------- */

.account-password-form {
    display: grid;
    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 12px;
}

.account-password-form label {
    display: flex;
    flex-direction: column;

    gap: 6px;
}

.account-password-form label > span {
    color: var(--v13-text-soft);

    font-size: 0.72rem;
    font-weight: 600;
}

.account-password-form input {
    width: 100%;
    min-height: 42px;

    padding: 0 11px;

    border-radius: 10px;

    font-size: 0.8rem;
}

.account-password-form small {
    color: var(--v13-muted);

    font-size: 0.65rem;
}

.account-password-form .admin-button {
    align-self: end;
}


/* ---------- Sessions ---------- */

.account-session-section {
    margin-top: 24px;
    padding-top: 20px;

    border-top: 1px solid var(--v13-border);
}

.account-session-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    gap: 16px;
    margin-bottom: 14px;
}

.account-session-header h3 {
    margin: 5px 0;

    color: var(--v13-text);

    font-size: 0.95rem;
}

.account-session-header p {
    margin: 0;

    color: var(--v13-muted);

    font-size: 0.74rem;
}

.account-sessions-list {
    display: flex;
    flex-direction: column;

    gap: 8px;
    margin: 12px 0;
}

.account-session-item {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 14px;

    padding: 12px 13px;

    border: 1px solid var(--v13-border);
    border-radius: 11px;

    background: rgba(7, 17, 31, 0.42);
}

.account-session-item > span {
    color: var(--v13-text-soft);

    font-size: 0.76rem;
}

.account-session-actions {
    display: flex;
    align-items: center;

    gap: 7px;
}

.account-danger-button {
    color: #fda4af;

    border-color: rgba(251, 113, 133, 0.2);
}

.account-danger-button:hover {
    color: #fecdd3;

    border-color: rgba(251, 113, 133, 0.35);

    background: rgba(251, 113, 133, 0.07);
}


/* ---------- User overview ---------- */

.users-overview {
    display: grid;
    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 10px;
    margin-bottom: 16px;
}

.users-overview-card {
    display: flex;
    flex-direction: column;

    gap: 5px;

    min-height: 84px;
    padding: 14px;

    border: 1px solid var(--v13-border);
    border-radius: 13px;

    background: rgba(8, 19, 33, 0.46);
}

.users-overview-card strong {
    color: var(--v13-text);

    font-size: 1.2rem;
    font-weight: 750;
}

.users-overview-card span {
    color: var(--v13-muted);

    font-size: 0.68rem;
}

.users-list {
    display: flex;
    flex-direction: column;

    gap: 7px;
}


/* ---------- Generic admin status ---------- */

.admin-status {
    color: var(--v13-muted);

    font-size: 0.72rem;
}

.admin-status.error {
    color: #fda4af;
}


/* ==========================================================
   RESPONSIVE
   ========================================================== */

@media (max-width: 1100px) {
    .stats-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .security-overview {
        grid-template-columns:
            repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 850px) {
    #settingsView {
        padding: 18px;
    }

    .stats-columns {
        grid-template-columns: 1fr;
    }

    .security-overview {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .account-password-form {
        grid-template-columns: 1fr;
    }

    .users-overview {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    #logsView .view-header,
    #settingsView .view-header,
    #statsView .view-header {
        flex-direction: column;
    }

    .stats-grid,
    .security-overview,
    .users-overview {
        grid-template-columns: 1fr;
    }

    .activity-top,
    .account-session-header,
    .account-session-item {
        align-items: flex-start;
        flex-direction: column;
    }

    .activity-item {
        grid-template-columns:
            32px minmax(0, 1fr);

        padding: 11px;
    }

    .activity-icon {
        width: 32px;
        height: 32px;
    }

    .user-admin-card,
    .account-panel {
        padding: 16px;
    }
}


/* ==========================================================
   V13.5 – Responsive final polish
   ========================================================== */


/* ---------- Tablet / small laptop ---------- */

@media (max-width: 900px) {

    .page-shell {
        max-width: none;
    }

    .sidebar {
        position: relative;
        z-index: 40;

        display: flex;
        flex-direction: column;

        gap: 8px;
    }

    .sidebar-brand {
        min-height: 42px;
        margin-bottom: 2px;
    }

    .sidebar-nav {
        scrollbar-width: none;
    }

    .sidebar-nav::-webkit-scrollbar {
        display: none;
    }

    .sidebar-link {
        min-height: 40px;
        white-space: nowrap;
    }

    .topbar {
        z-index: 30;
    }

    .system-status-bar {
        margin-bottom: 20px;
    }

    .view-header {
        gap: 14px;
    }

    .dashboard-columns {
        grid-template-columns: 1fr;
    }
}


/* ---------- Phone ---------- */

@media (max-width: 620px) {

    html,
    body {
        overflow-x: hidden;
    }

    body {
        min-width: 0;
    }

    .page-shell {
        width: 100%;
        padding:
            0
            12px
            calc(24px + env(safe-area-inset-bottom));
    }

    .sidebar {
        padding:
            10px
            12px
            8px;
    }

    .sidebar-brand {
        padding: 0 4px;
    }

    .sidebar-brand .brand-mark {
        width: 32px;
        height: 32px;

        border-radius: 9px;

        font-size: 0.72rem;
    }

    .sidebar-nav {
        gap: 4px;
    }

    .sidebar-link {
        min-height: 38px;
        padding: 0 10px;

        border-radius: 9px;

        font-size: 0.78rem;
    }


    /* Topbar */

    .topbar {
        min-height: 58px;

        margin:
            0
            -12px
            16px;

        padding:
            9px
            12px;
    }

    .topbar-user {
        width: 100%;

        justify-content: flex-end;
    }

    .topbar-user-info {
        min-width: 0;
    }

    .topbar-user-info strong,
    .topbar-user-info span {
        max-width: 145px;

        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .logout-button {
        flex: 0 0 auto;

        min-height: 36px;
        padding: 0 11px;
    }


    /* System status */

    .system-status-bar {
        display: grid;

        grid-template-columns:
            repeat(2, minmax(0, 1fr));

        gap: 0;

        overflow: visible;

        margin-bottom: 18px;
        padding: 4px;

        border-radius: 14px;
    }

    .system-status-bar .status-item {
        min-width: 0;
        padding: 10px;
    }

    .system-status-bar .status-divider {
        display: none;
    }

    .status-label {
        font-size: 0.62rem;
    }

    .system-status-bar strong {
        overflow: hidden;

        font-size: 0.74rem;

        text-overflow: ellipsis;
        white-space: nowrap;
    }


    /* Headers */

    .view-header {
        margin-bottom: 18px;
    }

    .view-title {
        font-size: 1.65rem;
    }

    .view-header p {
        margin-top: 7px;

        font-size: 0.78rem;
        line-height: 1.5;
    }

    .view-eyebrow {
        font-size: 0.64rem;
    }


    /* Dashboard */

    .dashboard-info-card {
        min-height: 88px;

        padding: 15px;
    }

    .dashboard-section {
        padding: 16px;
    }


    /* Chat */

    .chat-workspace {
        gap: 12px;
    }

    .conversation-sidebar {
        max-height: 250px;

        padding: 13px;

        border-radius: 16px;
    }

    .conversation-sidebar-header {
        margin-bottom: 8px;
    }

    .new-conversation-button {
        min-height: 40px;
    }

    .conversation-list {
        max-height: 145px;
    }

    .chat-workspace .chat-panel {
        height: min(680px, 68dvh);
        min-height: 520px;

        border-radius: 16px;
    }

    .chat-workspace .panel-header {
        min-height: 58px;

        padding: 12px 14px;
    }

    .chat-panel-full .chat-messages,
    .chat-workspace .chat-messages {
        gap: 14px;

        padding:
            16px
            12px
            18px;
    }

    .message {
        max-width: 95%;

        padding: 11px 12px;

        border-radius: 14px;

        font-size: 0.86rem;
        line-height: 1.55;
    }

    .user-message {
        max-width: 91%;
    }

    .ai-message {
        border-top-left-radius: 5px;
    }

    .user-message {
        border-bottom-right-radius: 5px;
    }

    .message-actions {
        flex-wrap: wrap;
    }

    .message-sources {
        gap: 7px;
    }

    .source-chip {
        max-width: 100%;
    }

    .chat-form {
        padding: 10px;
    }

    .chat-input {
        min-height: 54px;
        max-height: 120px;

        padding: 12px;

        font-size: 0.86rem;
    }

    .chat-form-footer {
        gap: 8px;

        margin-top: 8px;
    }


    /* Documents */

    .documents-panel {
        padding: 14px;
    }

    .document-actions {
        width: 100%;
    }

    .document-actions .admin-button {
        flex: 1 1 auto;
    }

    .document-upload-section {
        margin: 14px 0;
        padding: 12px;
    }

    .upload-area {
        min-height: 82px;
        padding: 14px;
    }

    .summary-box {
        min-height: 78px;

        padding: 13px;
    }

    .document-index-health {
        padding: 12px;
    }

    .document-item {
        gap: 12px;
        padding: 13px;
    }

    .document-meta-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .document-buttons {
        justify-content: stretch;
    }

    .document-action-button {
        flex: 1 1 auto;
    }


    /* Statistics */

    .stats-card {
        min-height: 96px;

        padding: 15px;
    }

    .stats-panel {
        padding: 15px;
    }

    .stats-status-row {
        min-height: 44px;
    }


    /* Logs */

    .security-overview-card {
        min-height: 82px;

        padding: 13px;
    }

    .activity-list {
        gap: 6px;
    }

    .activity-item {
        gap: 9px;
    }


    /* Settings */

    #settingsView {
        padding: 14px;
    }

    .user-admin-card,
    .account-panel {
        border-radius: 14px;
    }

    .account-password-form {
        gap: 10px;
    }

    .account-session-item {
        width: 100%;
    }

    .account-session-actions {
        width: 100%;

        flex-wrap: wrap;
    }


    /* Modal */

    .document-modal-content {
        width: calc(100vw - 10px);
        height: calc(100dvh - 10px);

        max-height: none;

        border-radius: 12px;
    }

    .document-modal-header {
        min-height: 54px;

        padding: 10px 12px;
    }

    .document-modal-text {
        padding: 14px;

        font-size: 0.78rem;
    }
}


/* ---------- Small phone ---------- */

@media (max-width: 420px) {

    .sidebar-brand span {
        font-size: 0.9rem;
    }

    .sidebar-link {
        font-size: 0.74rem;
    }

    .system-status-bar {
        grid-template-columns: 1fr 1fr;
    }

    .view-title {
        font-size: 1.5rem;
    }


    /* Chat */

    .chat-workspace .chat-panel {
        min-height: 500px;
    }

    .message {
        max-width: 97%;

        font-size: 0.84rem;
    }

    .user-message {
        max-width: 94%;
    }

    .chat-form-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .chat-status {
        min-height: 0;
    }

    .send-button {
        width: 100%;
        min-height: 42px;
    }


    /* Documents */

    .documents-summary,
    .document-index-health {
        gap: 8px;
    }

    .document-meta-grid {
        grid-template-columns: 1fr;
    }

    .document-buttons {
        flex-direction: column;
    }

    .document-action-button {
        width: 100%;
    }


    /* Admin */

    .stats-status-row {
        align-items: flex-start;
        flex-direction: column;

        gap: 3px;
        padding: 9px 0;
    }

    .activity-item {
        grid-template-columns: 1fr;
    }

    .activity-icon {
        display: none;
    }

    .account-session-actions .admin-button {
        width: 100%;
    }
}


/* ==========================================================
   V13.5.1 – Mobile conversation history
   ========================================================== */

.mobile-conversation-toggle {
    display: none;
}

@media (max-width: 720px) {

    .mobile-conversation-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;

        width: 100%;
        min-height: 42px;

        margin: 0 0 10px;
        padding: 0 14px;

        border: 1px solid var(--v13-border);
        border-radius: 11px;

        color: var(--v13-text-soft);
        background: rgba(15, 30, 50, 0.78);

        font-size: 0.82rem;
        font-weight: 650;
    }

    .mobile-conversation-toggle:hover {
        color: var(--v13-text);
        border-color: var(--v13-border-strong);

        background: rgba(22, 40, 64, 0.9);
    }

    .conversation-sidebar {
        display: none;
    }

    .conversation-sidebar.mobile-open {
        display: flex;
        max-height: 320px;

        margin-bottom: 2px;
    }

    .chat-workspace {
        display: block;
    }

    .chat-workspace .chat-panel {
        width: 100%;
    }
}

/* ==========================================================
   V13.6.1 – Compact mobile dashboard
   ========================================================== */

@media (max-width: 620px) {

    /* Tydligare horisontell mobilnavigation */
    .sidebar-nav {
        position: relative;
        padding-bottom: 6px;

        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar-link {
        scroll-snap-align: start;
    }


    /* Dashboardstatistik 2 x 2 i stället för lång lista */
    .dashboard-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));

        gap: 10px;
    }

    .dashboard-info-card {
        min-width: 0;
        min-height: 104px;

        padding: 13px;

        flex-direction: column;
        align-items: flex-start;

        gap: 10px;
    }

    .dashboard-card-icon {
        width: 38px;
        height: 38px;

        flex: 0 0 auto;
    }

    .dashboard-card-label {
        font-size: 0.68rem;
    }

    .dashboard-info-card strong {
        overflow: hidden;

        max-width: 100%;

        font-size: 1rem;

        text-overflow: ellipsis;
        white-space: nowrap;
    }


    /* Dashboard behöver inte visa hela logghistoriken */
    .dashboard-activity-list
    .dashboard-activity-item:nth-child(n+4) {
        display: none;
    }
}


@media (max-width: 360px) {

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}


/* =========================================================
   V14.4 - Business administration
   ========================================================= */

.business-admin-panel {
    margin-bottom: 24px;
}

.businesses-grid {
    display: grid;
    grid-template-columns:
        repeat(
            3,
            minmax(0, 1fr)
        );
    gap: 18px;
    margin-top: 18px;
}

.business-card {
    min-width: 0;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background:
        rgba(255, 255, 255, 0.035);
}

.business-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.business-card-header h3 {
    margin: 5px 0 0;
    font-size: 1.12rem;
}

.business-status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border: 1px solid
        rgba(65, 211, 154, 0.28);
    border-radius: 999px;
    background:
        rgba(65, 211, 154, 0.08);
    color: var(--success);
    font-size: 0.78rem;
    font-weight: 800;
    white-space: nowrap;
}

.business-status-badge.inactive {
    border-color:
        rgba(255, 107, 125, 0.25);
    background:
        rgba(255, 107, 125, 0.08);
    color: var(--danger);
}

.business-profile-form {
    display: grid;
    gap: 14px;
}

.business-form-field {
    display: grid;
    gap: 7px;
}

.business-form-field > span {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 700;
}

.business-form-field input {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    outline: none;
    background:
        rgba(3, 16, 34, 0.48);
}

.business-form-field input:focus {
    border-color:
        rgba(22, 200, 255, 0.7);
    box-shadow:
        0 0 0 4px
        rgba(22, 200, 255, 0.08);
}

.business-active-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background:
        rgba(255, 255, 255, 0.025);
    font-size: 0.88rem;
    font-weight: 700;
}

.business-active-toggle input {
    width: 17px;
    height: 17px;
    margin: 0;
}

.business-form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 3px;
}

.business-card-status {
    flex: 1;
    margin-top: 0;
    font-size: 0.82rem;
}

@media (max-width: 1100px) {
    .businesses-grid {
        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );
    }
}

@media (max-width: 720px) {
    .businesses-grid {
        grid-template-columns: 1fr;
    }

    .business-card {
        padding: 17px;
    }

    .business-form-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .business-form-actions .admin-button {
        width: 100%;
    }
}



/* =========================================================
   V14.4.2 - Business document links
   ========================================================= */

.business-sources-section {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.business-sources-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.business-sources-header h4 {
    margin: 4px 0 0;
    font-size: 0.95rem;
}

.business-source-count {
    padding: 5px 9px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.035);
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.business-source-options {
    display: grid;
    gap: 8px;
}

.business-source-option {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(3, 16, 34, 0.32);
    cursor: pointer;
}

.business-source-option:hover {
    background: rgba(255, 255, 255, 0.045);
}

.business-source-option input {
    width: 16px;
    height: 16px;
    margin: 0;
}

.business-source-option span {
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 0.84rem;
}

.business-sources-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
}

.business-source-status {
    flex: 1;
    margin-top: 0;
    font-size: 0.82rem;
}

@media (max-width: 720px) {
    .business-sources-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .business-sources-footer .admin-button {
        width: 100%;
    }
}


/* =========================================================
   V14.4.3 - Business opening hours
   ========================================================= */

.business-hours-section {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.business-hours-header {
    margin-bottom: 12px;
}

.business-hours-header h4 {
    margin: 4px 0 0;
    font-size: 0.95rem;
}

.business-hours-list {
    display: grid;
    gap: 8px;
}

.business-hours-row {
    display: grid;
    grid-template-columns:
        minmax(82px, 1fr)
        minmax(105px, 1.1fr)
        minmax(82px, 0.9fr)
        auto
        minmax(82px, 0.9fr);
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(3, 16, 34, 0.32);
}

.business-hours-row.inactive
.business-hours-time {
    opacity: 0.45;
}

.business-hours-day {
    font-size: 0.82rem;
}

.business-hours-status,
.business-hours-time {
    width: 100%;
    min-width: 0;
    min-height: 34px;
    padding: 5px 7px;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(3, 16, 34, 0.55);
}

.business-hours-time:disabled {
    cursor: not-allowed;
}

.business-hours-separator {
    color: var(--muted);
    text-align: center;
}

.business-hours-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
}

.business-hours-message {
    flex: 1;
    margin-top: 0;
    font-size: 0.82rem;
}

@media (max-width: 1100px) {
    .business-hours-row {
        grid-template-columns:
            90px
            1fr
            1fr
            auto
            1fr;
    }
}

@media (max-width: 720px) {
    .business-hours-row {
        grid-template-columns:
            1fr 1fr;
    }

    .business-hours-day {
        grid-column: 1;
    }

    .business-hours-status {
        grid-column: 2;
    }

    .business-hours-separator {
        display: none;
    }

    .business-hours-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .business-hours-footer .admin-button {
        width: 100%;
    }
}


/* V15.3.2b business aliases */

.business-aliases-section {
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid rgba(127, 127, 127, 0.22);
}

.business-aliases-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 8px;
}

.business-aliases-header h4 {
    margin: 2px 0 0;
}

.business-alias-count {
    white-space: nowrap;
    font-size: 0.85rem;
    opacity: 0.72;
}

.business-aliases-help {
    margin: 0 0 14px;
    font-size: 0.9rem;
    opacity: 0.78;
}

.business-alias-list {
    display: grid;
    gap: 8px;
}

.business-alias-row,
.business-alias-add-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.business-alias-row input,
.business-alias-add-row input {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.business-alias-remove {
    white-space: nowrap;
}

.business-alias-add-row {
    margin-top: 10px;
}

.business-aliases-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
}

.business-alias-status {
    flex: 1;
    min-width: 0;
}

@media (max-width: 680px) {
    .business-alias-row,
    .business-alias-add-row {
        grid-template-columns: 1fr;
    }

    .business-aliases-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .business-aliases-footer .admin-button {
        width: 100%;
    }
}


/* V16.0f-2 customer white-label appearance */

.customer-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(127, 127, 127, 0.18);
}

.customer-appearance-panel {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid rgba(127, 127, 127, 0.22);
}

.customer-appearance-header {
    margin-bottom: 16px;
}

.customer-appearance-header h4 {
    margin: 3px 0 5px;
}

.customer-appearance-header p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.customer-appearance-form {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.customer-appearance-form
.business-form-field {
    min-width: 0;
}

.customer-appearance-form select,
.customer-appearance-form textarea {
    width: 100%;
    box-sizing: border-box;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    outline: none;
    background: rgba(3, 16, 34, 0.48);
}

.customer-appearance-form select {
    min-height: 42px;
    padding: 9px 11px;
}

.customer-appearance-form textarea {
    min-height: 92px;
    padding: 10px 11px;
    resize: vertical;
}

.customer-appearance-form select:focus,
.customer-appearance-form textarea:focus {
    border-color: rgba(22, 200, 255, 0.7);
    box-shadow:
        0 0 0 4px
        rgba(22, 200, 255, 0.08);
}

.customer-color-field input[type="color"] {
    min-height: 42px;
    padding: 4px;
    cursor: pointer;
}

.customer-range-row {
    display: grid;
    grid-template-columns:
        minmax(0, 1fr) 55px;
    gap: 12px;
    align-items: center;
    min-height: 42px;
}

.customer-range-row input[type="range"] {
    width: 100%;
    min-height: auto;
    padding: 0;
}

.customer-range-row strong {
    text-align: right;
}

.customer-theme-preview {
    --customer-preview-accent: #16C8FF;

    grid-column: 1 / -1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 230px;
    padding: 28px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 16px;
    background-size: cover;
    background-position: center;
}

.customer-theme-preview-content {
    width: min(100%, 390px);
    padding: 22px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 14px;
    background: rgba(3, 16, 34, 0.72);
    backdrop-filter: blur(10px);
}

.customer-theme-preview-content > strong {
    display: block;
    margin-bottom: 16px;
    color: var(--customer-preview-accent);
    font-size: 0.82rem;
}

.customer-theme-preview-content h3 {
    margin: 0 0 8px;
}

.customer-theme-preview-content p {
    margin: 0 0 18px;
}

.customer-theme-preview-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 7px 18px;
    border-radius: 9px;
    background: var(--customer-preview-accent);
    color: #04111e;
    font-weight: 800;
}

.customer-appearance-form
.business-card-status,
.customer-appearance-form
.business-form-actions {
    grid-column: 1 / -1;
}

@media (max-width: 720px) {
    .customer-appearance-form {
        grid-template-columns: 1fr;
    }

    .customer-theme-preview,
    .customer-appearance-form
    .business-card-status,
    .customer-appearance-form
    .business-form-actions {
        grid-column: 1;
    }
}


/* V16.0f-5 customer asset upload */

.customer-asset-field {
    grid-column: 1 / -1;
}

.customer-asset-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 110px;
    margin-top: 2px;
    padding: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(3, 16, 34, 0.32);
}

.customer-asset-preview img {
    display: block;
    max-width: 100%;
    max-height: 180px;
    object-fit: contain;
    border-radius: 8px;
}

.customer-asset-empty {
    color: var(--muted);
    font-size: 0.86rem;
}

.customer-asset-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 10px;
}

.customer-asset-status {
    min-height: 20px;
    margin-top: 8px;
}

.customer-theme-preview-logo {
    display: block;
    max-width: 150px;
    max-height: 72px;
    margin: 0 auto 14px;
    object-fit: contain;
}

.customer-theme-preview-logo[hidden] {
    display: none;
}

@media (max-width: 720px) {
    .customer-asset-field {
        grid-column: 1;
    }
}


/* V16.0g-1 customer modules */

.customer-modules-panel {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid rgba(127, 127, 127, 0.22);
}

.customer-modules-header {
    margin-bottom: 16px;
}

.customer-modules-header h4 {
    margin: 3px 0 5px;
}

.customer-modules-header p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.customer-modules-list {
    display: grid;
    gap: 9px;
    margin-bottom: 15px;
}

.customer-module-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 62px;
    padding: 11px 13px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(3, 16, 34, 0.32);
    cursor: pointer;
}

.customer-module-text {
    display: grid;
    gap: 3px;
}

.customer-module-text strong {
    font-size: 0.92rem;
}

.customer-module-text span {
    color: var(--muted);
    font-size: 0.82rem;
}

.customer-module-row input[type="checkbox"] {
    flex: 0 0 auto;
    width: 19px;
    height: 19px;
    margin: 0;
    cursor: pointer;
}

@media (max-width: 720px) {
    .customer-module-row {
        gap: 12px;
    }
}


/* V16.0g-2 module configuration */

.customer-module-row {
    display: block;
    min-height: 0;
    padding: 0;
    cursor: default;
    overflow: hidden;
}

.customer-module-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 62px;
    padding: 11px 13px;
    cursor: pointer;
}

.customer-module-config {
    display: grid;
    gap: 0;
    padding: 5px 13px 11px;
    border-top: 1px solid rgba(127, 127, 127, 0.14);
    background: rgba(3, 16, 34, 0.18);
}

.customer-module-config[hidden] {
    display: none;
}

.customer-module-config-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 43px;
    padding: 7px 3px;
    cursor: pointer;
}

.customer-module-config-row + .customer-module-config-row {
    border-top: 1px solid rgba(127, 127, 127, 0.10);
}

.customer-module-config-row span {
    color: var(--text);
    font-size: 0.84rem;
}

.customer-module-config-row input[type="checkbox"] {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin: 0;
}

@media (max-width: 720px) {
    .customer-module-main,
    .customer-module-config-row {
        gap: 12px;
    }
}


/* V16.0j-6b — Contact requests admin */

.contact-nav-badge {
    margin-left: auto;
    min-width: 20px;
    padding: 2px 6px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    text-align: center;
}

.contact-admin-overview {
    display: grid;
    grid-template-columns:
        repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin: 24px 0;
}

.contact-count-card {
    padding: 20px;
    border: 1px solid
        var(--border, rgba(148,163,184,.18));
    border-radius: 16px;
    background:
        var(--surface, rgba(255,255,255,.04));
}

.contact-count-card span {
    display: block;
    margin-bottom: 8px;
    color:
        var(--text-muted, #94a3b8);
    font-size: 12px;
}

.contact-count-card strong {
    font-size: 28px;
}

.contact-admin-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.contact-filter.active {
    border-color:
        var(--accent, #5b8cff);
    color:
        var(--accent, #5b8cff);
}

.contact-requests-list {
    display: grid;
    gap: 12px;
}

.contact-request-card {
    overflow: hidden;
    border: 1px solid
        var(--border, rgba(148,163,184,.18));
    border-radius: 16px;
    background:
        var(--surface, rgba(255,255,255,.035));
}

.contact-request-card summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 20px;
    cursor: pointer;
    list-style: none;
}

.contact-request-card summary::-webkit-details-marker {
    display: none;
}

.contact-request-summary-main {
    display: grid;
    gap: 5px;
}

.contact-request-summary-main strong {
    font-size: 15px;
}

.contact-request-summary-main span {
    color:
        var(--text-muted, #94a3b8);
    font-size: 12px;
}

.contact-status-chip {
    flex: 0 0 auto;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
}

.contact-status-chip.new {
    background: rgba(59,130,246,.14);
    color: #60a5fa;
}

.contact-status-chip.in_progress {
    background: rgba(245,158,11,.14);
    color: #f59e0b;
}

.contact-status-chip.done {
    background: rgba(34,197,94,.14);
    color: #22c55e;
}

.contact-request-body {
    padding: 4px 20px 20px;
    border-top: 1px solid
        var(--border, rgba(148,163,184,.12));
}

.contact-request-info-grid {
    display: grid;
    grid-template-columns:
        repeat(3, minmax(0, 1fr));
    gap: 12px;
    padding-top: 18px;
}

.contact-request-info {
    display: grid;
    gap: 4px;
}

.contact-request-info span,
.contact-request-message > span {
    color:
        var(--text-muted, #94a3b8);
    font-size: 11px;
}

.contact-request-info strong {
    font-size: 13px;
    word-break: break-word;
}

.contact-request-message {
    margin-top: 20px;
    padding: 16px;
    border-radius: 12px;
    background: rgba(148,163,184,.07);
}

.contact-request-message p {
    margin: 7px 0 0;
    white-space: pre-wrap;
    line-height: 1.65;
}

.contact-request-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.contact-request-actions a {
    text-decoration: none;
}

@media (max-width: 850px) {
    .contact-admin-overview {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .contact-request-info-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 560px) {
    .contact-admin-overview,
    .contact-request-info-grid {
        grid-template-columns: 1fr;
    }

    .contact-request-card summary {
        align-items: flex-start;
        flex-direction: column;
    }
}


/* V16.0j-7c — Contact AI reply */

.contact-ai-panel {
    margin-top: 18px;
    padding: 20px;
    border: 1px solid
        rgba(91,140,255,.22);
    border-radius: 14px;
    background:
        rgba(91,140,255,.055);
}

.contact-ai-decision {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.contact-ai-decision.safe {
    background:
        rgba(34,197,94,.14);
    color: #22c55e;
}

.contact-ai-decision.human {
    background:
        rgba(245,158,11,.14);
    color: #f59e0b;
}

.contact-ai-reason {
    margin: 12px 0 18px;
    color:
        var(--text-muted, #94a3b8);
    font-size: 13px;
}

.contact-ai-reply-label {
    display: block;
    margin-bottom: 7px;
    font-size: 12px;
    font-weight: 700;
}

.contact-ai-reply-text {
    width: 100%;
    min-height: 180px;
    padding: 14px;
    resize: vertical;
    border: 1px solid
        rgba(148,163,184,.25);
    border-radius: 12px;
    background:
        rgba(15,23,42,.35);
    color: inherit;
    font: inherit;
    line-height: 1.65;
    outline: none;
}

.contact-ai-reply-text:focus {
    border-color:
        var(--accent, #5b8cff);
}

.contact-ai-meta {
    margin-top: 10px;
    color:
        var(--text-muted, #94a3b8);
    font-size: 11px;
}

.contact-ai-loading {
    color:
        var(--text-muted, #94a3b8);
}

.contact-ai-error {
    color: #f87171;
}


/* V16.0j-7g — Contact reply sending */

.contact-ai-send-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.contact-ai-send-status {
    font-size: 12px;
    font-weight: 600;
}

.contact-ai-send-status.success {
    color: #22c55e;
}

.contact-ai-send-status.error {
    color: #f87171;
}
