:root {
    --kb-bg-soft: #f4f8fb;
    --kb-bg-alt: #e8f5ef;
    --kb-surface: #ffffff;
    --kb-border: #d6e1ea;
    --kb-text: #11283a;
    --kb-muted: #557085;
    --kb-brand: #0f6d5f;
    --kb-brand-2: #e78e2f;
    --kb-shadow: 0 16px 36px rgba(12, 31, 49, 0.09);
}

body {
    background:
        radial-gradient(1200px 420px at -10% -10%, rgba(15, 109, 95, 0.18), transparent 60%),
        radial-gradient(900px 360px at 110% -10%, rgba(231, 142, 47, 0.16), transparent 60%),
        linear-gradient(180deg, var(--kb-bg-alt), var(--kb-bg-soft));
    color: var(--kb-text);
    font-family: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
}

h1,
h2,
h3,
h4,
h5,
h6,
.card-header,
.btn,
.nav,
.table thead th {
    letter-spacing: 0.01em;
}

.card {
    border-radius: 16px;
    border: 1px solid var(--kb-border);
    box-shadow: var(--kb-shadow);
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.card-header {
    background: linear-gradient(90deg, rgba(15, 109, 95, 0.09), rgba(231, 142, 47, 0.08));
    border-bottom: 1px solid var(--kb-border);
    color: var(--kb-text);
}

.btn {
    border-radius: 12px;
    font-weight: 700;
}

.btn-primary {
    border-color: #0f6d5f;
    background: linear-gradient(135deg, #0f6d5f, #198770);
    box-shadow: 0 8px 18px rgba(15, 109, 95, 0.25);
}

.btn-primary:hover,
.btn-primary:focus {
    border-color: #0b564b;
    background: linear-gradient(135deg, #0b564b, #15735f);
}

.btn-outline-secondary,
.btn-outline-primary {
    border-width: 1px;
}

.form-control,
.form-select,
.form-check-input,
textarea,
.input-group-text {
    border-radius: 12px;
    border-color: #cfdce7;
}

.form-control:focus,
.form-select:focus,
textarea:focus {
    border-color: rgba(15, 109, 95, 0.45);
    box-shadow: 0 0 0 0.2rem rgba(15, 109, 95, 0.14);
}

.alert {
    border-radius: 14px;
}

.table {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(9, 30, 66, 0.02);
}

.table thead th {
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #486077;
}

.table td,
.table th {
    border-color: #e3ebf2;
}

.text-muted,
.small,
.form-text {
    color: var(--kb-muted) !important;
}

.badge {
    border-radius: 999px;
    padding: 0.42rem 0.68rem;
}

.mono,
code,
pre {
    font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.kb-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border: 1px solid #d5e0ea;
    border-radius: 16px;
    background: linear-gradient(118deg, rgba(255, 255, 255, 0.96), rgba(245, 251, 247, 0.94));
    box-shadow: 0 12px 24px rgba(10, 32, 53, 0.07);
}

.kb-topbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.kb-topbar-logo,
.kb-topbar-logo-fallback {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    flex-shrink: 0;
}

.kb-topbar-logo {
    object-fit: cover;
    border: 1px solid #d6e3ef;
    background: #ffffff;
}

.kb-topbar-logo-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #c9d8e9;
    font-weight: 800;
    font-size: 0.95rem;
    letter-spacing: 0.03em;
    color: #254a66;
    background: linear-gradient(140deg, #f0f7ff, #ebfff5);
}

.kb-topbar-title {
    font-size: 1rem;
    font-weight: 800;
    color: #10293d;
    line-height: 1.2;
}

.kb-topbar-subtitle {
    margin-top: 1px;
    color: #5a7389;
    font-size: 0.81rem;
    line-height: 1.2;
}

.kb-topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.conversation-item,
.inbox-item,
.ticket-item,
.contact-item,
.board-card,
.agenda-item {
    border: 1px solid #dbe6f2 !important;
    border-radius: 12px;
    background: linear-gradient(180deg, #ffffff 0%, #f9fcff 100%);
    box-shadow: 0 2px 4px rgba(15, 38, 63, 0.03);
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease, background-color 0.16s ease;
}

.conversation-item:hover,
.inbox-item:hover,
.ticket-item:hover,
.contact-item:hover,
.board-card:hover,
.agenda-item:hover {
    transform: translateY(-1px);
    border-color: #b9d4ee !important;
    box-shadow: 0 10px 20px rgba(14, 35, 57, 0.08);
}

.conversation-item.active,
.inbox-item.active,
.ticket-item.active,
.contact-item.active,
.board-card.active {
    border-color: #89b8eb !important;
    background: linear-gradient(180deg, #f4faff 0%, #eef6ff 100%) !important;
    box-shadow: 0 12px 24px rgba(22, 74, 125, 0.15);
}

.conversation-list,
.inbox-list,
.ticket-list,
.messages-wrap,
.contact-list,
.contact-board,
.notes-wrap,
.timeline-wrap,
.agenda-list {
    scrollbar-width: thin;
    scrollbar-color: #9ab3cc #edf3f9;
}

.conversation-list::-webkit-scrollbar,
.inbox-list::-webkit-scrollbar,
.ticket-list::-webkit-scrollbar,
.messages-wrap::-webkit-scrollbar,
.contact-list::-webkit-scrollbar,
.contact-board::-webkit-scrollbar,
.notes-wrap::-webkit-scrollbar,
.timeline-wrap::-webkit-scrollbar,
.agenda-list::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.conversation-list::-webkit-scrollbar-track,
.inbox-list::-webkit-scrollbar-track,
.ticket-list::-webkit-scrollbar-track,
.messages-wrap::-webkit-scrollbar-track,
.contact-list::-webkit-scrollbar-track,
.contact-board::-webkit-scrollbar-track,
.notes-wrap::-webkit-scrollbar-track,
.timeline-wrap::-webkit-scrollbar-track,
.agenda-list::-webkit-scrollbar-track {
    background: #edf3f9;
    border-radius: 999px;
}

.conversation-list::-webkit-scrollbar-thumb,
.inbox-list::-webkit-scrollbar-thumb,
.ticket-list::-webkit-scrollbar-thumb,
.messages-wrap::-webkit-scrollbar-thumb,
.contact-list::-webkit-scrollbar-thumb,
.contact-board::-webkit-scrollbar-thumb,
.notes-wrap::-webkit-scrollbar-thumb,
.timeline-wrap::-webkit-scrollbar-thumb,
.agenda-list::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #9db8d4, #84a5c7);
    border-radius: 999px;
    border: 2px solid #edf3f9;
}

.messages-wrap {
    scroll-behavior: smooth;
}

.status-pill {
    font-weight: 700;
    letter-spacing: 0.01em;
    box-shadow: inset 0 0 0 1px rgba(124, 145, 169, 0.25);
}

@media (prefers-reduced-motion: reduce) {
    .conversation-item,
    .inbox-item,
    .ticket-item,
    .contact-item,
    .board-card,
    .agenda-item {
        transition: none !important;
    }

    .messages-wrap {
        scroll-behavior: auto;
    }
}

@media (max-width: 767.98px) {
    .card {
        border-radius: 14px;
    }

    .btn {
        border-radius: 10px;
    }

    .kb-topbar {
        flex-direction: column;
        align-items: stretch;
        padding: 10px 12px;
    }

    .kb-topbar-actions {
        justify-content: flex-start;
    }
}
