* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f5f7fa;
    color: #1f2933;
    font-family: Arial, Helvetica, sans-serif;
}

a {
    color: #0b6bcb;
    text-decoration: none;
}

.topbar {
    align-items: center;
    background: #050505;
    color: #fff;
    display: flex;
    gap: 24px;
    height: 96px;
    justify-content: space-between;
    padding: 0 32px;
}

.brand {
    align-items: center;
    display: flex;
    flex: 0 0 300px;
    gap: 14px;
    justify-content: flex-start;
    min-width: 0;
}

.brand-corner-logo {
    display: block;
    flex: 0 0 auto;
    height: 62px;
    object-fit: contain;
    object-position: center;
    width: 86px;
}

.brand-mark-img {
    display: block;
    filter: drop-shadow(0 0 10px rgba(24, 207, 255, 0.18));
    flex: 0 0 auto;
    height: 66px;
    width: 66px;
}

.brand-copy {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.brand-logo {
    display: block;
    height: 72px;
    max-width: 88px;
    object-fit: contain;
    object-position: center;
    width: 88px;
}

.brand-logo.compact {
    filter: drop-shadow(0 0 6px rgba(24, 207, 255, 0.16));
}

.brand-mark {
    align-items: center;
    border: 2px solid #29a8ff;
    border-radius: 6px;
    color: #fff;
    display: flex;
    font-size: 24px;
    font-weight: 800;
    height: 44px;
    justify-content: center;
    letter-spacing: 0;
    width: 44px;
}

.brand-name {
    color: #168eea;
    font-size: 30px;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1;
    text-shadow: 0 0 18px rgba(24, 207, 255, 0.12);
}

.brand-tech {
    color: #22a7ea;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 8.5px;
    line-height: 1;
}

.brand-subtitle {
    color: #98a2b3;
    font-size: 15px;
    line-height: 1;
}

.topbar-actions {
    align-items: center;
    display: flex;
    flex: 1 1 auto;
    gap: 14px;
    justify-content: flex-end;
    min-width: 0;
}

.topbar-contacts {
    align-items: flex-end;
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    gap: 4px;
    line-height: 1.1;
}

.contact-link {
    color: #dffaff;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.contact-link:hover {
    color: #ffffff;
    text-decoration: underline;
}

.support-link {
    align-items: center;
    background: #081321;
    border: 1px solid #176aa8;
    border-radius: 7px;
    color: #dffaff;
    display: inline-flex;
    font-size: 13px;
    font-weight: 800;
    gap: 7px;
    min-height: 36px;
    padding: 7px 10px;
    text-decoration: none;
    white-space: nowrap;
}

.support-link:hover {
    border-color: #18cfff;
    box-shadow: 0 0 16px rgba(24, 207, 255, 0.28);
    color: #ffffff;
}

.support-icon {
    align-items: center;
    border: 1px solid #18cfff;
    border-radius: 5px;
    color: #65edff;
    display: inline-flex;
    font-size: 12px;
    height: 20px;
    justify-content: center;
    width: 20px;
}

@media (max-width: 1180px) {
    .topbar {
        gap: 16px;
        padding: 0 24px;
    }

    .brand {
        flex-basis: 260px;
        gap: 10px;
    }

    .brand-corner-logo {
        height: 56px;
        width: 76px;
    }

    .brand-name {
        font-size: 26px;
    }

    .brand-subtitle {
        font-size: 13px;
    }

    .support-link {
        padding: 7px 9px;
    }

    .topbar-contacts {
        display: none;
    }
}

@media (max-width: 900px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
        height: auto;
        padding: 14px 20px 16px;
    }

    .brand {
        align-items: flex-start;
        flex-basis: auto;
    }

    .topbar-actions {
        flex-wrap: wrap;
        justify-content: flex-start;
        width: 100%;
    }

    .topbar-contacts {
        align-items: flex-start;
        display: flex;
        width: 100%;
    }

    .search {
        max-width: none;
    }
}

.actions {
    align-items: center;
    display: flex;
    gap: 10px;
}

.actions.compact {
    gap: 6px;
}

.search {
    background: #fff;
    border: 0;
    border-radius: 5px;
    color: #111827;
    flex: 0 1 260px;
    height: 38px;
    max-width: 260px;
    min-width: 160px;
    padding: 0 14px;
}

.app-shell {
    display: grid;
    grid-template-columns: 360px 1fr;
    min-height: calc(100vh - 96px);
}

.sidebar {
    background: #fff;
    border-right: 1px solid #e5e7eb;
    overflow-y: auto;
    padding: 18px 16px 32px;
}

.tree-filter {
    border: 1px solid #d8dee6;
    border-radius: 5px;
    height: 36px;
    margin-bottom: 16px;
    padding: 0 10px;
    width: 100%;
}

.tree {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tree ul {
    list-style: none;
    margin: 4px 0 8px 18px;
    padding: 0;
}

.tree-row {
    align-items: center;
    display: flex;
    gap: 4px;
    min-width: 0;
}

.tree-toggle,
.tree-toggle-spacer {
    flex: 0 0 auto;
    height: 22px;
    width: 22px;
}

.tree-toggle {
    align-items: center;
    background: #eef2f6;
    border: 1px solid #cfd7e2;
    border-radius: 4px;
    color: #29323d;
    cursor: pointer;
    display: inline-flex;
    font-size: 16px;
    font-weight: 700;
    justify-content: center;
    line-height: 1;
    padding: 0;
}

.tree-toggle:hover {
    background: #dff5fb;
    border-color: #0077c8;
    color: #0077c8;
}

.tree-item {
    border-radius: 5px;
    color: #29323d;
    display: block;
    font-size: 14px;
    line-height: 1.35;
    margin: 2px 0;
    padding: 8px 9px;
    min-width: 0;
    overflow-wrap: anywhere;
    width: 100%;
}

.tree-actions {
    align-items: center;
    display: inline-flex;
    flex: 0 0 auto;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.tree-row:hover .tree-actions,
.tree-row:focus-within .tree-actions {
    opacity: 1;
}

.tree-actions form {
    display: inline-flex;
    margin: 0;
}

.tree-action {
    align-items: center;
    background: #eef2f6;
    border: 1px solid #cfd7e2;
    border-radius: 4px;
    color: #29323d;
    cursor: pointer;
    display: inline-flex;
    font-size: 12px;
    font-weight: 700;
    height: 22px;
    justify-content: center;
    line-height: 1;
    min-width: 22px;
    padding: 0;
}

.tree-action:hover {
    background: #dff5fb;
    border-color: #0077c8;
    color: #0077c8;
}

.tree-action-danger:hover {
    background: #fee4e2;
    border-color: #b42318;
    color: #b42318;
}

.tree-item:hover,
.tree-item.active {
    background: #dff5fb;
    color: #0077c8;
}

.tree-article {
    color: #475467;
    font-size: 13px;
    padding-left: 9px;
}

.tree-article::before {
    content: "• ";
}

.content {
    padding: 28px 40px;
}

.content-header {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 22px;
}

.panel {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 22px;
}

.article-list {
    display: grid;
    gap: 12px;
}

.article-row {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px 18px;
}

.muted {
    color: #667085;
}

.button {
    background: #0078ff;
    border: 0;
    border-radius: 5px;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    font-size: 14px;
    font-weight: 700;
    min-height: 36px;
    padding: 9px 14px;
}

.button.secondary {
    background: #eef2f6;
    color: #1f2933;
}

.button.danger {
    background: #b42318;
}

.button.compact {
    font-size: 12px;
    min-height: 30px;
    padding: 6px 10px;
}

.form {
    display: grid;
    gap: 14px;
    max-width: 840px;
}

.form label {
    display: grid;
    gap: 6px;
    font-weight: 700;
}

.form input,
.form select,
.form textarea {
    border: 1px solid #cfd7e2;
    border-radius: 6px;
    font: inherit;
    padding: 10px;
}

.form textarea {
    min-height: 260px;
    resize: vertical;
}

.auth-page {
    align-items: center;
    background: #050505;
    display: flex;
    min-height: 100vh;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    background: #fff;
    border-radius: 8px;
    max-width: 460px;
    padding: 28px;
    width: 100%;
}

.error {
    color: #b42318;
}

.message {
    color: #067647;
}

.admin-invite-form {
    align-items: end;
    display: grid;
    grid-template-columns: minmax(280px, 1fr) auto;
    max-width: none;
}

.admin-dashboard {
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(320px, 0.85fr) minmax(420px, 1.15fr);
    margin-top: 18px;
}

.admin-section-title,
.employee-details-head {
    align-items: center;
    display: flex;
    gap: 14px;
    justify-content: space-between;
    margin-bottom: 16px;
}

.admin-section-title h2,
.employee-details h2,
.employee-details h3 {
    margin: 0;
}

.admin-count,
.status-pill {
    border-radius: 999px;
    display: inline-flex;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    padding: 6px 9px;
}

.admin-count {
    background: #eef2f6;
    color: #1f2933;
}

.status-pill {
    background: #eef2f6;
    color: #475467;
    white-space: nowrap;
}

.status-pill.ok {
    background: #dcfae6;
    color: #067647;
}

.status-pill.pending {
    background: #fff4cc;
    color: #8a5b00;
}

.status-pill.blocked {
    background: #fee4e2;
    color: #b42318;
}

.admin-list,
.employee-list,
.activity-list {
    display: grid;
    gap: 10px;
}

.admin-row,
.employee-row,
.activity-row {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    display: grid;
    gap: 8px;
    padding: 12px;
}

.invitation-row {
    align-items: start;
    grid-template-columns: minmax(0, 1fr) auto;
}

.invitation-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.invitation-actions form {
    margin: 0;
}

.employee-row {
    color: inherit;
    grid-template-columns: minmax(0, 1fr) auto;
    text-decoration: none;
}

.employee-row-actions {
    grid-template-columns: minmax(0, 1fr) auto auto;
}

.employee-row-actions .employee-main {
    color: inherit;
    text-decoration: none;
}

.employee-inline-actions form {
    margin: 0;
}

.employee-row:hover,
.employee-row.active {
    background: #eefaff;
    border-color: #8ed7f0;
}

.employee-main,
.employee-meta {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.employee-meta {
    justify-items: end;
}

.employee-details {
    margin-top: 18px;
}

.employee-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.employee-actions form {
    align-items: center;
    display: inline-flex;
    gap: 8px;
    margin: 0;
}

.employee-actions select {
    border: 1px solid #cfd7e2;
    border-radius: 6px;
    font: inherit;
    min-height: 36px;
    padding: 7px 10px;
}

.employee-summary {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 16px 0 22px;
}

.employee-summary > div {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    display: grid;
    gap: 5px;
    padding: 12px;
}

.activity-row {
    grid-template-columns: 220px minmax(0, 1fr);
}

.analysis-page {
    display: grid;
    gap: 18px;
}

.analysis-metrics {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.analysis-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 0.8fr);
}

.analysis-card {
    background: #fff;
    border: 1px solid #dfe5ec;
    border-radius: 8px;
    display: grid;
    gap: 14px;
    padding: 18px;
}

.analysis-card-head {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.analysis-card-head h2 {
    margin: 0;
}

.analysis-card-head-actions {
    align-items: center;
    display: flex;
    gap: 12px;
}

.metric-card {
    gap: 8px;
}

.metric-card span,
.tech-grid span {
    color: #667085;
    font-size: 13px;
}

.metric-card strong {
    color: #111827;
    font-size: 34px;
    line-height: 1;
}

.metric-card small {
    color: #475467;
}

.activity-bars {
    display: grid;
    gap: 10px;
}

.activity-bar-row {
    align-items: center;
    display: grid;
    gap: 10px;
    grid-template-columns: 92px minmax(0, 1fr) 44px;
}

.activity-bar-row span,
.activity-bar-row strong {
    font-size: 13px;
}

.activity-bar-track {
    background: #eef2f6;
    border-radius: 999px;
    height: 10px;
    overflow: hidden;
}

.activity-bar-track i {
    background: linear-gradient(90deg, #0078ff, #25d6ff);
    border-radius: inherit;
    display: block;
    height: 100%;
    min-width: 4px;
}

.attention-list {
    display: grid;
    gap: 10px;
}

.attention-item {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    color: inherit;
    display: grid;
    gap: 5px;
    padding: 12px;
    text-decoration: none;
}

.attention-item:hover {
    background: #eefaff;
    border-color: #8ed7f0;
}

.analysis-table {
    display: grid;
    gap: 8px;
}

.analysis-table-row {
    align-items: center;
    border-bottom: 1px solid #eef2f6;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(0, 1fr) 90px 130px;
    padding: 9px 0;
}

.analysis-table-row.head {
    color: #667085;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.employee-analysis-table .analysis-table-row {
    grid-template-columns: minmax(220px, 1.4fr) 110px 180px 80px 70px 90px 60px;
}

.employee-analysis-table .analysis-table-row > div {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.tech-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tech-grid div {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    display: grid;
    gap: 5px;
    padding: 12px;
}

.tech-grid strong {
    overflow-wrap: anywhere;
}

.rag-import-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 0.42fr);
}

.rag-import-form {
    max-width: none;
}

.rag-import-textarea {
    min-height: 520px;
}

.rag-rules {
    align-content: start;
}

.checkbox-row {
    align-items: center;
    display: inline-flex;
    font-weight: 700;
    gap: 8px;
}

.checkbox-row input {
    height: 18px;
    width: 18px;
}

.activity-row p {
    margin: 4px 0;
}

.activity-time {
    color: #667085;
    font-size: 13px;
}

.admin-empty {
    color: #667085;
    padding: 8px 0;
}

@media (max-width: 980px) {
    .admin-dashboard,
    .admin-invite-form,
    .employee-summary,
    .activity-row {
        grid-template-columns: 1fr;
    }

    .employee-row {
        grid-template-columns: 1fr;
    }

    .employee-meta {
        justify-items: start;
    }
}

.smart-chat {
    bottom: 22px;
    position: fixed;
    right: 22px;
    z-index: 40;
}

.smart-chat-launcher {
    align-items: center;
    background: #02070f;
    border: 1px solid #18cfff;
    border-radius: 999px;
    box-shadow: 0 0 0 1px rgba(24, 207, 255, 0.2), 0 0 30px rgba(24, 207, 255, 0.45);
    color: #dffaff;
    cursor: pointer;
    display: inline-flex;
    font-weight: 800;
    gap: 9px;
    min-height: 58px;
    padding: 8px 16px 8px 8px;
}

.smart-chat-launcher img,
.smart-chat-persona img {
    border-radius: 50%;
    height: 42px;
    width: 42px;
}

.smart-chat.thinking .smart-chat-launcher img,
.smart-chat.thinking .smart-chat-persona img {
    filter: drop-shadow(0 0 12px #35e9ff);
}

.smart-chat-panel {
    background: radial-gradient(circle at 20% 0%, rgba(24, 207, 255, 0.18), transparent 34%), #02070f;
    border: 1px solid #168fe0;
    border-radius: 14px;
    bottom: 74px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.36), 0 0 34px rgba(24, 207, 255, 0.34);
    color: #dffaff;
    display: none;
    height: min(680px, calc(100vh - 110px));
    max-height: calc(100vh - 96px);
    max-width: calc(100vw - 28px);
    min-height: 460px;
    min-width: 420px;
    overflow: hidden;
    position: absolute;
    resize: both;
    right: 0;
    width: min(560px, calc(100vw - 28px));
}

.smart-chat.open .smart-chat-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
}

.smart-chat-head {
    align-items: center;
    border-bottom: 1px solid rgba(24, 207, 255, 0.26);
    display: flex;
    justify-content: space-between;
    padding: 12px;
}

.smart-chat-head button {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(24, 207, 255, 0.35);
    border-radius: 8px;
    color: #dffaff;
    cursor: pointer;
    font-size: 20px;
    height: 34px;
    width: 34px;
}

.smart-chat-persona {
    align-items: center;
    display: flex;
    gap: 10px;
}

.smart-chat-persona span {
    color: #78bfe8;
    display: block;
    font-size: 12px;
    margin-top: 2px;
}

.smart-chat-messages {
    display: grid;
    gap: 10px;
    align-content: start;
    max-height: none;
    overflow-y: auto;
    padding: 14px;
}

.smart-chat-message {
    border-radius: 12px;
    font-size: 15px;
    line-height: 1.45;
    max-width: 92%;
    padding: 10px 12px;
}

.smart-chat-message.bot {
    background: rgba(10, 38, 64, 0.9);
    border: 1px solid rgba(24, 207, 255, 0.28);
}

.smart-chat-message.user {
    background: #0877db;
    color: #fff;
    justify-self: end;
}

.smart-chat-message.typing {
    animation: chatPulse 1.2s ease-in-out infinite;
}

.smart-chat-links {
    display: grid;
    gap: 6px;
    margin-top: 9px;
}

.smart-chat-links a {
    border-left: 2px solid #35e9ff;
    color: #7fe9ff;
    padding-left: 8px;
}

.smart-chat-form {
    align-items: end;
    border-top: 1px solid rgba(24, 207, 255, 0.26);
    display: grid;
    gap: 8px;
    grid-template-columns: 1fr 42px;
    padding: 12px;
}

.smart-chat-form textarea {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(24, 207, 255, 0.35);
    border-radius: 9px;
    color: #fff;
    font: inherit;
    line-height: 1.35;
    max-height: 220px;
    min-height: 110px;
    min-width: 0;
    overflow-y: auto;
    padding: 10px;
    resize: vertical;
}

.smart-chat-form button {
    background: #18cfff;
    border: 0;
    border-radius: 9px;
    color: #001425;
    cursor: pointer;
    font-size: 18px;
    font-weight: 900;
    height: 42px;
}

@keyframes chatPulse {
    0%, 100% {
        box-shadow: 0 0 0 rgba(24, 207, 255, 0);
        opacity: 0.72;
    }
    50% {
        box-shadow: 0 0 18px rgba(24, 207, 255, 0.34);
        opacity: 1;
    }
}

.article-content {
    line-height: 1.65;
}

.article-content > :first-child {
    margin-top: 0;
}

.article-content > :last-child {
    margin-bottom: 0;
}

.article-content h2,
.article-content h3 {
    line-height: 1.3;
    margin: 24px 0 12px;
}

.article-content p {
    margin: 0 0 14px;
}

.article-content pre,
.rich-editor pre {
    background: #f2f4f7;
    border: 1px solid #d8dee6;
    border-radius: 8px;
    color: #101828;
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
    line-height: 1.5;
    margin: 0 0 16px;
    overflow-x: auto;
    padding: 42px 14px 14px;
    position: relative;
    white-space: pre-wrap;
}

.article-content code,
.rich-editor code {
    font-family: Consolas, "Courier New", monospace;
}

.code-copy-button {
    background: #fff;
    border: 1px solid #cfd7e2;
    border-radius: 5px;
    color: #344054;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 9px;
    position: absolute;
    right: 10px;
    top: 8px;
}

.article-content ul,
.article-content ol {
    margin: 0 0 16px 24px;
    padding: 0;
}

.article-content li {
    margin: 4px 0;
}

.article-content figure {
    display: block;
    margin: 18px 0;
    max-width: 100%;
}

.article-content figcaption,
.rich-editor figcaption {
    color: #667085;
    font-size: 14px;
    margin-top: 8px;
}

.article-content img,
.rich-editor img {
    border: 1px solid #cfd7e2;
    border-radius: 6px;
    display: block;
    height: auto;
    margin: 12px 0;
    max-width: 100%;
}

.rich-editor figure {
    cursor: grab;
    display: block;
    margin: 18px 0;
    max-width: 100%;
    position: relative;
}

.rich-editor .editor-image-selected {
    outline: 2px solid #0078ff;
    outline-offset: 4px;
}

.rich-editor .editor-image-dragging {
    cursor: grabbing;
    opacity: 0.55;
}

.rich-editor .editor-image-drop-before {
    border-top: 3px solid #0078ff;
    padding-top: 10px;
}

.rich-editor .editor-image-drop-after {
    border-bottom: 3px solid #0078ff;
    padding-bottom: 10px;
}

.rich-editor .image-resize-handle {
    background: #0078ff;
    border: 2px solid #fff;
    border-radius: 50%;
    bottom: -8px;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.25);
    cursor: nwse-resize;
    height: 16px;
    position: absolute;
    right: -8px;
    width: 16px;
    z-index: 2;
}

.rich-editor .image-inline-toolbar {
    align-items: center;
    background: #fff;
    border: 1px solid #cfd7e2;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
    display: flex;
    gap: 4px;
    left: 8px;
    padding: 4px;
    position: absolute;
    top: 8px;
    z-index: 3;
}

.rich-editor .image-inline-toolbar button {
    background: #eef2f6;
    border: 1px solid #cfd7e2;
    border-radius: 4px;
    color: #1f2933;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    height: 26px;
    min-width: 26px;
    padding: 0 7px;
}

.rich-editor .image-inline-toolbar button:hover {
    background: #dff5fb;
    border-color: #0078ff;
    color: #0077c8;
}

.rich-editor .image-move-toolbar {
    align-items: center;
    background: #fff;
    border: 1px solid #cfd7e2;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
    display: grid;
    gap: 4px;
    padding: 4px;
    position: absolute;
    right: 8px;
    top: 8px;
    z-index: 3;
}

.rich-editor .image-move-toolbar button {
    background: #eef2f6;
    border: 1px solid #cfd7e2;
    border-radius: 4px;
    color: #1f2933;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    height: 28px;
    line-height: 1;
    min-width: 28px;
    padding: 0;
}

.rich-editor .image-move-toolbar button:hover {
    background: #dff5fb;
    border-color: #0078ff;
    color: #0077c8;
}

.rich-editor .image-move-toolbar [data-image-delete]:hover {
    background: #fee4e2;
    border-color: #b42318;
    color: #b42318;
}

.article-file {
    align-items: center;
    background: #f8fafc;
    border: 1px solid #cfd7e2;
    border-radius: 6px;
    display: flex;
    gap: 10px;
    margin: 14px 0;
    max-width: 640px;
    padding: 10px 12px;
}

.article-file::before {
    color: #667085;
    content: "File";
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.article-file-title-input {
    border: 1px solid #cfd7e2;
    border-radius: 5px;
    flex: 1 1 220px;
    font: inherit;
    min-width: 180px;
    padding: 7px 9px;
}

.article-file-link {
    flex: 0 1 auto;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.article-content iframe,
.rich-editor iframe {
    aspect-ratio: 16 / 9;
    border: 0;
    border-radius: 6px;
    display: block;
    height: auto;
    max-width: 760px;
    width: 100%;
}

.video-frame {
    margin: 16px 0;
}

.editor-toolbar {
    align-items: center;
    background: #f8fafc;
    border: 1px solid #cfd7e2;
    border-radius: 6px 6px 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px;
}

.editor-toolbar button,
.editor-toolbar select,
.editor-toolbar input[type="color"],
.icon-upload {
    align-items: center;
    background: #fff;
    border: 1px solid #cfd7e2;
    border-radius: 5px;
    color: #1f2933;
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    height: 34px;
    justify-content: center;
    min-width: 34px;
    padding: 0 9px;
}

.editor-toolbar select {
    max-width: 150px;
}

.editor-toolbar input[type="color"] {
    padding: 3px;
    width: 38px;
}

.editor-toolbar .ai-button {
    background: #0b6bcb;
    color: #fff;
    min-width: 132px;
}

.editor-toolbar button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.emoji-picker {
    background: #fff;
    border: 1px solid #cfd7e2;
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(16, 24, 40, 0.16);
    display: grid;
    gap: 4px;
    grid-template-columns: repeat(8, 32px);
    padding: 8px;
    position: fixed;
    z-index: 50;
}

.emoji-picker button {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 5px;
    cursor: pointer;
    font-size: 18px;
    height: 32px;
    line-height: 1;
    padding: 0;
    width: 32px;
}

.emoji-picker button:hover {
    background: #eefaff;
    border-color: #8ed7f0;
}

.editor-status {
    min-height: 20px;
}

.icon-upload input {
    display: none;
}

.rich-editor {
    background: #fff;
    border: 1px solid #cfd7e2;
    border-radius: 0 0 6px 6px;
    line-height: 1.6;
    min-height: 360px;
    outline: none;
    padding: 14px;
}

.rich-editor:focus {
    border-color: #0078ff;
    box-shadow: 0 0 0 3px rgba(0, 120, 255, 0.12);
}

.rich-editor.rich-editor-drop {
    background: #eef7ff;
    border-color: #0078ff;
    box-shadow: inset 0 0 0 2px rgba(0, 120, 255, 0.16);
}

.asset-registry-backdrop {
    align-items: center;
    background: rgba(15, 23, 42, 0.46);
    display: flex;
    inset: 0;
    justify-content: center;
    padding: 24px;
    position: fixed;
    z-index: 20;
}

.asset-registry {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.24);
    max-height: 86vh;
    max-width: 820px;
    overflow: hidden;
    width: 100%;
}

.asset-registry-header,
.asset-registry-actions {
    align-items: center;
    display: flex;
    justify-content: space-between;
    padding: 16px 18px;
}

.asset-registry-header {
    border-bottom: 1px solid #e5e7eb;
}

.asset-registry-header h2 {
    font-size: 20px;
    margin: 0;
}

.asset-registry-header button {
    background: #eef2f6;
    border: 0;
    border-radius: 5px;
    cursor: pointer;
    font-size: 24px;
    height: 34px;
    line-height: 1;
    width: 34px;
}

.asset-registry-list {
    display: grid;
    gap: 10px;
    max-height: 56vh;
    overflow: auto;
    padding: 16px 18px;
}

.asset-registry-row {
    align-items: flex-start;
    border: 1px solid #d8dee6;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    gap: 12px;
    padding: 12px;
}

.asset-registry-thumb {
    background: #f2f4f7;
    border: 1px solid #d8dee6;
    border-radius: 5px;
    flex: 0 0 auto;
    height: 72px;
    object-fit: contain;
    width: 96px;
}

.asset-registry-row span {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.asset-registry-row small,
.asset-registry-row a {
    overflow-wrap: anywhere;
}

.asset-registry-actions {
    border-top: 1px solid #e5e7eb;
    gap: 10px;
    justify-content: flex-end;
}

.hidden-field {
    display: none;
}

.sections-panel {
    margin-top: 18px;
}

.manage-tree,
.manage-tree ul {
    list-style: none;
    margin: 8px 0 0 18px;
    padding: 0;
}

.manage-tree {
    margin-left: 0;
}

.manage-tree-row {
    align-items: center;
    border-bottom: 1px solid #eef2f6;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 8px 0;
}

.manage-tree-row form {
    margin: 0;
}

.attachments {
    border-top: 1px solid #e5e7eb;
    margin-top: 24px;
    padding-top: 16px;
}

@media (max-width: 900px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        border-right: 0;
        border-bottom: 1px solid #e5e7eb;
        max-height: 45vh;
    }

    .search {
        min-width: 0;
        width: 180px;
    }

    .analysis-metrics,
    .analysis-grid,
    .rag-import-grid,
    .tech-grid {
        grid-template-columns: 1fr;
    }

    .analysis-table-row,
    .employee-analysis-table .analysis-table-row {
        align-items: start;
        grid-template-columns: 1fr;
    }

    .activity-row {
        grid-template-columns: 1fr;
    }

    .smart-chat {
        bottom: 12px;
        right: 12px;
    }

    .smart-chat-panel {
        height: min(620px, calc(100vh - 92px));
        min-height: 380px;
        min-width: min(360px, calc(100vw - 24px));
        width: calc(100vw - 24px);
    }
}

.site-search {
    display: flex;
    flex: 0 1 260px;
    margin: 0;
    max-width: 260px;
    min-width: 160px;
}

.site-search .search {
    flex: 1 1 auto;
    max-width: none;
    min-width: 0;
    width: 100%;
}

.search-snippet {
    color: #344054;
    line-height: 1.5;
    margin: 6px 0 0;
}

.search-result mark {
    background: #fde68a;
    border-radius: 2px;
    color: inherit;
    padding: 0 1px;
}

/* Крупные структурированные статьи: хлебные крошки, оглавление, метаданные, черновики */
.breadcrumbs { font-size: 13px; color: #667085; margin: 0 0 10px; }
.breadcrumbs a { color: #475467; text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.crumb-sep { margin: 0 6px; color: #98a2b3; }
.article-summary { color: #475467; margin: 6px 0 0; max-width: 820px; }
.article-meta { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 12px 0 0; }
.article-meta div { display: flex; gap: 6px; font-size: 13px; }
.article-meta dt { color: #667085; }
.article-meta dt::after { content: ":"; }
.article-meta dd { margin: 0; font-weight: 600; color: #1d2939; }
.draft-badge { display: inline-block; font-size: 11px; font-weight: 600; line-height: 1; padding: 3px 7px; margin-left: 6px; border-radius: 10px; background: #fef0c7; color: #93370d; vertical-align: middle; }
.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 18px; align-items: start; }
.article-layout:not(:has(.article-side)) { grid-template-columns: minmax(0, 1fr); }
.article-side { position: sticky; top: 76px; display: grid; gap: 14px; max-height: calc(100vh - 96px); overflow-y: auto; }
.side-block { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px 14px; }
.side-block h3 { margin: 0 0 8px; font-size: 14px; }
.toc, .sibling-list { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.toc li, .sibling-list li { margin: 4px 0; }
.toc .toc-l3 { padding-left: 14px; }
.toc a, .sibling-list a { color: #344054; text-decoration: none; }
.toc a:hover, .sibling-list a:hover { color: #0078ff; }
.sibling-list li.current > a { color: #0078ff; font-weight: 600; }
.article-content h2, .article-content h3, .article-content h4 { scroll-margin-top: 80px; }
.heading-anchor { margin-left: 8px; color: #98a2b3; text-decoration: none; font-weight: 400; opacity: 0; }
.article-content h2:hover .heading-anchor, .article-content h3:hover .heading-anchor, .article-content h4:hover .heading-anchor { opacity: 1; }
.article-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 28px; padding-top: 16px; border-top: 1px solid #e5e7eb; }
.article-pager a { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid #e5e7eb; border-radius: 8px; text-decoration: none; color: #1d2939; }
.article-pager a:hover { border-color: #0078ff; }
.article-pager small { color: #667085; }
.pager-next { grid-column: 2; text-align: right; }
.subsection-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-bottom: 18px; }
.subsection-card { display: grid; gap: 4px; padding: 14px 16px; background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; text-decoration: none; color: #1d2939; }
.subsection-card:hover { border-color: #0078ff; }
.subsection-card small { color: #667085; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; }
@media (max-width: 1100px) {
    .article-layout { grid-template-columns: minmax(0, 1fr); }
    .article-side { position: static; max-height: none; order: -1; }
}

/* Таблицы и встроенный код в статьях базы знаний (санитайзер вырезает style у table/th/td, поэтому оформление — здесь) */
.article-content table {
    background: #fff;
    border: 1px solid #d3dbe6;
    border-collapse: separate;
    border-radius: 10px;
    border-spacing: 0;
    font-size: 14.5px;
    line-height: 1.5;
    margin: 16px 0 22px;
    overflow: hidden;
    width: 100%;
}

.article-content table th,
.article-content table td {
    border-bottom: 1px solid #e3e8ef;
    padding: 10px 14px;
    text-align: left;
    vertical-align: top;
}

.article-content table th {
    background: #24406a;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.article-content table tbody tr:nth-child(even) td {
    background: #f6f8fb;
}

.article-content table tr:last-child td {
    border-bottom: 0;
}

.article-content table td > :first-child {
    margin-top: 0;
}

.article-content table td > :last-child {
    margin-bottom: 0;
}

.article-content table td ul,
.article-content table td ol {
    margin: 0 0 0 18px;
}

.article-content table td li {
    margin: 2px 0;
}

.article-content :not(pre) > code {
    background: #eef2f8;
    border: 1px solid #d9e0ec;
    border-radius: 5px;
    color: #1b2f55;
    font-size: 0.9em;
    padding: 1px 6px;
}

.article-content table code {
    white-space: nowrap;
}

.article-content pre code {
    background: none;
    border: 0;
    padding: 0;
}

/* Аналитика: график посещений */
.visits-chart-card {
    margin-bottom: 18px;
}

.chart-toolbar {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
    margin: 4px 0 12px;
}

.segmented {
    background: #eef1f6;
    border-radius: 10px;
    display: inline-flex;
    flex-wrap: wrap;
    padding: 3px;
}

.segmented button {
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: #344054;
    cursor: pointer;
    font: inherit;
    font-size: 13.5px;
    padding: 7px 14px;
}

.segmented button.active {
    background: #fff;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.18);
    color: #1b2f55;
    font-weight: 700;
}

.chart-summary {
    color: #475467;
    display: flex;
    flex-wrap: wrap;
    font-size: 14px;
    gap: 6px 22px;
    margin-bottom: 8px;
}

.chart-wrap svg {
    display: block;
    height: auto;
    width: 100%;
}

.top-articles-scroll {
    max-height: 620px;
    overflow-y: auto;
}

.top-articles-scroll a {
    color: inherit;
    text-decoration: none;
}

.top-articles-scroll a:hover {
    color: #2f6fd0;
    text-decoration: underline;
}
