/* Reserved for global layout primitives and shell structure. */

/* NavMenu migrated from CSS isolation. */
.top-row {
    min-height: 3.5rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.96));
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

.top-row .container-fluid {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.navbar-brand {
    font-size: 1.1rem;
}

.brand-shell {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.brand-logo {
    width: 2rem;
    height: 2rem;
    object-fit: contain;
    border-radius: 0.5rem;
}

.brand-mark {
    width: 2rem;
    height: 2rem;
    border-radius: 0.65rem;
    display: inline-grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
    font-size: 0.8rem;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.brand-name {
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
}

.brand-subtitle {
    font-size: 0.72rem;
    opacity: 0.72;
    color: #64748b;
}

.sidebar-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(248, 250, 252, 0.98);
    color: #0f172a;
    font-size: 1.2rem;
    line-height: 1;
}

.sidebar-nav {
    display: grid;
    gap: 1rem;
    padding: 1rem 0.75rem 1.1rem;
}

.sidebar-hero {
    display: grid;
    gap: 0.9rem;
    padding: 0.25rem 0.25rem 0.75rem;
}

.sidebar-hero-brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.sidebar-hero-copy {
    display: grid;
    gap: 0.12rem;
    min-width: 0;
}

.sidebar-hero-app {
    font-weight: 800;
    color: #0f172a;
    font-size: 1rem;
}

.sidebar-hero-bot,
.sidebar-hero-note {
    color: #475569;
    font-size: 0.82rem;
}

.sidebar-new-chat {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    border-radius: 0.95rem;
    padding: 0.8rem 1rem;
    color: #fff;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: linear-gradient(135deg, rgba(var(--brand-primary-rgb), 0.95), rgba(var(--brand-accent-rgb), 0.75));
    box-shadow: 0 18px 34px rgba(15, 23, 42, 0.12);
}

.sidebar-new-chat:hover {
    color: white;
}

.sidebar-new-chat-icon {
    display: inline-grid;
    place-items: center;
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    font-weight: 800;
}

.sidebar-section {
    display: grid;
    gap: 0.25rem;
}

.sidebar-link {
    gap: 0.75rem;
}

.sidebar-link-icon {
    width: 1.9rem;
    height: 1.9rem;
    flex: 0 0 auto;
    border-radius: 0.65rem;
    display: inline-grid;
    place-items: center;
    font-size: 0.8rem;
    font-weight: 800;
    background: rgba(var(--brand-primary-rgb), 0.1);
    color: var(--brand-primary);
}

.sidebar-link-icon-accent {
    background: linear-gradient(135deg, rgba(var(--brand-primary-rgb), 0.14), rgba(var(--brand-accent-rgb), 0.18));
    color: var(--brand-primary);
}

.sidebar-link-muted {
    background: rgba(248, 250, 252, 0.9) !important;
}

.sidebar-footer {
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(148, 163, 184, 0.14);
}

.bi {
    display: inline-block;
    position: relative;
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.75rem;
    top: -1px;
    background-size: cover;
}

.bi-house-door-fill-nav-menu {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-house-door-fill' viewBox='0 0 16 16'%3E%3Cpath d='M6.5 14.5v-3.505c0-.245.25-.495.5-.495h2c.25 0 .5.25.5.5v3.5a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5v-7a.5.5 0 0 0-.146-.354L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293L8.354 1.146a.5.5 0 0 0-.708 0l-6 6A.5.5 0 0 0 1.5 7.5v7a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5Z'/%3E%3C/svg%3E");
}

.bi-plus-square-fill-nav-menu {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-plus-square-fill' viewBox='0 0 16 16'%3E%3Cpath d='M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2zm6.5 4.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3a.5.5 0 0 1 1 0z'/%3E%3C/svg%3E");
}

.bi-speedometer2-nav-menu {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M8 4a.5.5 0 0 1 .5.5v3.05l2.276 1.14a.5.5 0 1 1-.448.894l-2.5-1.25A.5.5 0 0 1 7.5 8V4.5A.5.5 0 0 1 8 4z'/%3E%3Cpath d='M8 1a7 7 0 1 0 4.95 11.95A7 7 0 0 0 8 1zm0 1a6 6 0 1 1-4.24 10.24A6 6 0 0 1 8 2z'/%3E%3C/svg%3E");
}

.bi-list-nested-nav-menu {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-list-nested' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M4.5 11.5A.5.5 0 0 1 5 11h10a.5.5 0 0 1 0 1H5a.5.5 0 0 1-.5-.5zm-2-4A.5.5 0 0 1 3 7h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm-2-4A.5.5 0 0 1 1 3h10a.5.5 0 0 1 0 1H1a.5.5 0 0 1-.5-.5z'/%3E%3C/svg%3E");
}

.bi-box-arrow-in-right-nav-menu {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M10 12.5a.5.5 0 0 1-.5-.5v-2H4.5a.5.5 0 0 1 0-1H9.5V7a.5.5 0 0 1 .854-.354l3 3a.5.5 0 0 1 0 .708l-3 3A.5.5 0 0 1 10 12.5z'/%3E%3Cpath d='M13.5 1A1.5 1.5 0 0 1 15 2.5v11A1.5 1.5 0 0 1 13.5 15h-9A1.5 1.5 0 0 1 3 13.5v-2a.5.5 0 0 1 1 0v2a.5.5 0 0 0 .5.5h9a.5.5 0 0 0 .5-.5v-11a.5.5 0 0 0-.5-.5h-9A.5.5 0 0 0 4 2.5v2a.5.5 0 0 1-1 0v-2A1.5 1.5 0 0 1 4.5 1h9z'/%3E%3C/svg%3E");
}

.bi-box-arrow-right-nav-menu {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M6.5 12.5a.5.5 0 0 1-.5-.5v-2H1.5a.5.5 0 0 1 0-1H6V7a.5.5 0 0 1 .854-.354l3 3a.5.5 0 0 1 0 .708l-3 3A.5.5 0 0 1 6.5 12.5z'/%3E%3Cpath d='M9.5 1A1.5 1.5 0 0 1 11 2.5v2a.5.5 0 0 1-1 0v-2a.5.5 0 0 0-.5-.5h-9A.5.5 0 0 0 0 2.5v11a.5.5 0 0 0 .5.5h9a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 15h-9A1.5 1.5 0 0 1-1 13.5v-11A1.5 1.5 0 0 1 .5 1h9z'/%3E%3C/svg%3E");
}

.bi-palette-fill-nav-menu {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M8 0a8 8 0 1 0 4.546 14.578c.316-.214.454-.606.35-.975-.103-.372-.43-.637-.816-.637H10.6c-.62 0-1.09-.56-.97-1.168l.102-.51c.12-.608-.35-1.168-.97-1.168H7.2c-.497 0-.9-.403-.9-.9v-.6c0-.497.403-.9.9-.9h2.4c.497 0 .9-.403.9-.9V6.2c0-.497-.403-.9-.9-.9H8.2c-.497 0-.9-.403-.9-.9V3.1c0-.497.403-.9.9-.9h.95c.315 0 .596-.164.762-.433C9.924 1.032 8.987 0 8 0z'/%3E%3C/svg%3E");
}

.bi-people-fill-nav-menu {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M13 7c0 1.105-.672 2-1.5 2S10 8.105 10 7s.672-2 1.5-2S13 5.895 13 7zm-7 0c0 1.105-.672 2-1.5 2S3 8.105 3 7s.672-2 1.5-2S6 5.895 6 7zm7 5c0 1.105-.672 2-1.5 2S10 13.105 10 12s.672-2 1.5-2S13 10.895 13 12zM6 12c0 1.105-.672 2-1.5 2S3 13.105 3 12s.672-2 1.5-2S6 10.895 6 12zM5.5 8C4.12 8 3 9.12 3 10.5V11h5v-.5C8 9.12 6.88 8 5.5 8zm5 0C9.12 8 8 9.12 8 10.5V11h5v-.5C13 9.12 11.88 8 10.5 8z'/%3E%3C/svg%3E");
}

.nav-section {
    margin: 0.5rem 0 0.25rem;
    padding: 0 0.25rem;
}

.nav-section-header {
    padding: 0.5rem 1rem 0.35rem;
}

.nav-section-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #64748b;
}

.nav-item {
    font-size: 0.9rem;
    padding-bottom: 0.35rem;
}

.nav-item:first-of-type {
    padding-top: 0;
}

.nav-item:last-of-type {
    padding-bottom: 0;
}

.nav-item .nav-link {
    color: #334155;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(148, 163, 184, 0.08);
    border-radius: 0.85rem;
    min-height: 3rem;
    display: flex;
    align-items: center;
    line-height: 1.2;
    width: 100%;
    padding: 0.8rem 0.9rem;
    transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease, color 120ms ease;
}

.nav-item a.active {
    background: linear-gradient(135deg, rgba(var(--brand-primary-rgb), 0.12), rgba(var(--brand-accent-rgb), 0.1));
    border-color: rgba(var(--brand-primary-rgb), 0.18);
    color: #0f172a;
}

.nav-item .nav-link:hover {
    background-color: rgba(255, 255, 255, 1);
    border-color: rgba(var(--brand-primary-rgb), 0.16);
    color: #0f172a;
    transform: translateX(1px);
}

.nav-link-muted {
    background: rgba(248, 250, 252, 0.92) !important;
}

.nav-section-footer {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(148, 163, 184, 0.14);
}

.nav-scrollable {
    display: block;
}

/* MainLayout migrated from CSS isolation. */
.app-layout {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.95), rgba(241, 245, 249, 0.98));
}

.app-layout--backoffice {
    height: 100dvh;
    max-height: 100dvh;
}

.app-layout--public-home {
    height: 100dvh;
}

.app-layout--scrollable-public {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
}

.app-layout--scrollable-public .app-layout__body {
    overflow: visible;
}

.app-layout--scrollable-public .app-shell__content {
    height: auto;
    min-height: 0;
    overflow: visible;
    overscroll-behavior: auto;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.25rem;
    background:
        radial-gradient(circle at 12% 0%, rgba(var(--brand-primary-rgb), 0.08), transparent 30%),
        linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-bottom: 1px solid rgba(148, 163, 184, 0.22);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
    backdrop-filter: blur(16px);
}

.app-header__brand-row {
    display: inline-flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}

.app-header__menu-button {
    display: none !important;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 8px;
    background: #fff;
    color: #0f172a;
    border: 1px solid rgba(148, 163, 184, 0.24);
    font-weight: 900;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.app-header__brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    color: #0f172a;
    text-decoration: none;
}

.app-header a,
.app-header a:link,
.app-header a:visited,
.app-header a:hover,
.app-header a:focus,
.app-header a:focus-visible,
.app-header button,
.app-header button:hover,
.app-header button:focus,
.app-header button:focus-visible {
    color: #0f172a;
    text-decoration: none;
}

.app-header a.app-header__action,
.app-header a.app-header__action:link,
.app-header a.app-header__action:visited,
.app-header a.app-header__action:hover,
.app-header a.app-header__action:focus,
.app-header a.app-header__action:focus-visible {
    color: #0f172a;
    text-decoration: none;
}

.app-header a.app-header__action:hover,
.app-header a.app-header__action:focus {
    border-color: rgba(var(--brand-primary-rgb), 0.28);
    background: rgba(var(--brand-primary-rgb), 0.08);
}

.app-header a.app-header__action:focus-visible,
.app-header button:focus-visible {
    outline: 3px solid rgba(var(--brand-primary-rgb), 0.28);
    outline-offset: 3px;
}

.app-header__brand-logo,
.app-header__brand-mark {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.85rem;
    object-fit: contain;
    flex: 0 0 auto;
}

.app-header__brand-mark {
    display: inline-grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(135deg, var(--brand-primary), #7c83ff);
    box-shadow: 0 10px 24px rgba(var(--brand-primary-rgb), 0.18);
    font-weight: 900;
}

.app-header__brand-text {
    display: grid;
    gap: 0.06rem;
    min-width: 0;
}

.app-header__brand-name {
    font-size: 1.02rem;
    font-weight: 900;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.app-header__brand-subtitle {
    font-size: 0.82rem;
    color: #64748b;
    line-height: 1.1;
}

.app-header__actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.55rem;
    flex-wrap: wrap;
    min-width: 0;
}

.app-header__actions--panel {
    flex: 1 1 auto;
}

.app-header__user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 2.6rem;
    padding: 0.32rem 0.7rem 0.32rem 0.38rem;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: #fff;
    color: #0f172a;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.app-header__user-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: #475569;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
}

.app-header__user-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
    color: var(--text-1);
    text-transform: capitalize;
}

.app-header__action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 2.65rem;
    padding: 0.55rem 1rem;
    border-radius: 1rem;
    text-decoration: none;
    font-weight: 800;
    border: 1px solid transparent;
    white-space: nowrap;
}

.app-header__action i {
    font-size: 0.95rem;
    line-height: 1;
}

.app-header .app-header__action-icon {
    display: inline-grid;
    place-items: center;
    width: 1.8rem;
    height: 1.8rem;
    color: #0f172a;
    font-size: 1.65rem;
    font-weight: 900;
    line-height: 1;
}

.app-header__action--primary {
    background: linear-gradient(135deg, var(--brand-primary), #6f77f7);
    color: #fff;
    box-shadow: 0 12px 24px rgba(var(--brand-primary-rgb), 0.2);
}

.app-header a.app-header__action--primary,
.app-header a.app-header__action--primary:link,
.app-header a.app-header__action--primary:visited,
.app-header a.app-header__action--primary:hover,
.app-header a.app-header__action--primary:focus,
.app-header a.app-header__action--primary:focus-visible {
    background: linear-gradient(135deg, var(--brand-primary), #6f77f7);
    color: #fff;
}

.app-header__action--ghost {
    background: #fff;
    color: #0f172a;
    border-color: rgba(148, 163, 184, 0.24);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.app-header__action--web {
    background: transparent;
    color: #0f172a;
    border-color: transparent;
    box-shadow: none;
}

.app-header a.app-header__action--web,
.app-header a.app-header__action--web:link,
.app-header a.app-header__action--web:visited,
.app-header a.app-header__action--web:hover,
.app-header a.app-header__action--web:focus,
.app-header a.app-header__action--web:focus-visible {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    color: #0f172a;
}

.app-layout__body {
    position: relative;
    z-index: 1;
    flex: 1;
    min-height: 0;
    min-width: 0;
    display: flex;
    overflow: hidden;
    background: #fff;
}

.app-layout--backoffice .app-layout__body {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
}

.app-shell__content {
    position: relative;
    z-index: auto;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    box-sizing: border-box;
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 1.25rem 1.5rem 1.5rem;
    scrollbar-gutter: stable;
}

.app-layout--backoffice .app-shell__content {
    height: 100%;
    max-height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.app-layout--public-home .app-layout__body {
    display: block;
    overflow: auto;
}

.app-layout--public-home .app-shell__content {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
    padding: 0;
}

.app-layout--public .app-shell__content {
    overflow: hidden;
}

.app-panel-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 100%;
    max-width: 1480px;
    margin: 1.75rem auto 1.25rem;
    padding: 1.1rem 1.25rem 1.25rem;
    border-top: 1px solid rgba(var(--brand-primary-rgb), .14);
    background: linear-gradient(180deg, rgba(var(--brand-primary-rgb), .045), rgba(255, 255, 255, .72));
    color: var(--text-2);
    text-align: center;
    font-size: .82rem;
    font-weight: 800;
}

@media (max-width: 991.98px) {
    .app-header__menu-button {
        display: inline-flex !important;
    }

    .app-header {
        padding: 0.8rem 1rem;
    }

    .app-header__actions {
        gap: 0.45rem;
    }

    .app-header__action {
        min-height: 2.5rem;
    }

    .app-shell__content {
        padding: 1rem;
    }

    .app-layout--backoffice .app-layout__body {
        height: auto;
    }

    .app-layout--backoffice .app-shell__content {
        min-height: 0;
        max-height: 100%;
    }

    .app-panel-footer {
        margin-top: 1.25rem;
        margin-bottom: 1rem;
        padding: .95rem .85rem 1rem;
    }
}

@media (max-width: 767.98px) {
    .app-header {
        padding: 0.75rem 1rem;
        gap: 0.65rem;
    }

    .app-header__brand-text {
        display: none;
    }

    .app-header__action {
        min-height: 2.5rem;
        padding: 0.5rem 0.85rem;
        font-size: 0.94rem;
    }

    .app-header__action i {
        font-size: 0.95rem;
    }

    .app-shell__content {
        padding: 0.2rem 0.4rem calc(2.8rem + env(safe-area-inset-bottom));
    }
}

@media (min-width: 641px) {
    .nav-scrollable {
        display: block;
        height: calc(100dvh - 3.5rem);
        overflow-y: auto;
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(243, 246, 252, 0.96));
    }

    .sidebar-close {
        display: none;
    }
}

@media (max-width: 640.98px) {
    .sidebar-close:focus-visible {
        outline: 3px solid rgba(var(--brand-primary-rgb), 0.28);
        outline-offset: 2px;
    }
}

/* WebSidebar migrated from CSS isolation. */
.web-sidebar-shell {
    position: relative;
    z-index: 20;
    flex: 0 0 280px;
    width: 280px;
    min-width: 280px;
    height: 100%;
    pointer-events: auto;
}

.web-sidebar-shell__backdrop {
    display: none;
    appearance: none;
    border: 0;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.32);
    backdrop-filter: blur(2px);
    z-index: 1100;
}

.web-sidebar {
    position: relative;
    z-index: 1101;
    pointer-events: auto;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    background:
        radial-gradient(circle at top left, rgba(var(--brand-primary-rgb), 0.08), transparent 28%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 249, 252, 0.98));
    border-right: 1px solid var(--line);
    box-shadow: 10px 0 30px rgba(15, 23, 42, 0.04);
}

.web-sidebar__header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.web-sidebar__close {
    display: none;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--line);
    color: var(--text-1);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
}

.web-sidebar__body {
    min-height: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.web-sidebar__new-chat {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    min-height: 3rem;
    padding: 0.7rem 1rem;
    border-radius: 1rem;
    background: linear-gradient(135deg, var(--brand-primary), #6f77f7);
    color: #fff;
    font-weight: 800;
    box-shadow: 0 12px 24px rgba(var(--brand-primary-rgb), 0.2);
    border: 0;
    pointer-events: auto;
}

.web-sidebar__new-chat:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.web-sidebar__new-chat-icon {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.18);
    font-size: 1rem;
    line-height: 1;
}

.web-sidebar__section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 0;
    padding: 0.85rem;
    border: 1px solid rgba(var(--brand-primary-rgb), 0.08);
    border-radius: 1.25rem;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.035);
}

.web-sidebar__section--history {
    flex: 1;
    min-height: 0;
}

.web-sidebar__section-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 800;
    color: var(--text-2);
    padding: 0 0.35rem;
}

.web-sidebar__empty-state {
    padding: 1rem;
    border-radius: 1rem;
    border: 1px dashed var(--line);
    background: rgba(255, 255, 255, 0.88);
}

.web-sidebar__empty-state-title {
    font-weight: 800;
    color: var(--text-0);
    margin-bottom: 0.25rem;
}

.web-sidebar__empty-state-text {
    color: var(--text-2);
    font-size: 0.92rem;
}

.web-sidebar__conversation-groups {
    min-height: 0;
    overflow: auto;
    display: grid;
    gap: 0.85rem;
    padding-right: 0.2rem;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

.web-sidebar__conversation-group {
    display: grid;
    gap: 0.55rem;
}

.web-sidebar__conversation-group-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 900;
    color: var(--text-2);
    padding: 0 0.2rem;
}

.web-sidebar__conversation-list {
    display: grid;
    gap: 0.55rem;
}

.web-sidebar__conversation-item {
    display: grid;
    gap: 0.3rem;
    width: 100%;
    text-align: left;
    padding: 0.85rem 0.95rem;
    border-radius: 1rem;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-0);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.03);
    pointer-events: auto;
}

.web-sidebar__conversation-item:hover {
    background: rgba(var(--brand-primary-rgb), 0.06);
    border-color: rgba(var(--brand-primary-rgb), 0.18);
}

.web-sidebar__conversation-item.is-active {
    background: linear-gradient(135deg, rgba(var(--brand-primary-rgb), 0.12), rgba(255, 255, 255, 0.96));
    border-color: rgba(var(--brand-primary-rgb), 0.2);
    box-shadow: 0 10px 22px rgba(var(--brand-primary-rgb), 0.12);
}

.web-sidebar__conversation-item.is-active .web-sidebar__conversation-item-title,
.web-sidebar__conversation-item.is-active .web-sidebar__conversation-item-date {
    color: var(--brand-primary);
}

.web-sidebar__conversation-item-top {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 0.75rem;
}

.web-sidebar__conversation-item-title {
    font-weight: 800;
    line-height: 1.2;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.web-sidebar__conversation-item-date {
    flex: 0 0 auto;
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--text-2);
    white-space: nowrap;
}

.web-sidebar__conversation-item-meta {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    color: var(--text-2);
    font-size: 0.78rem;
}

.web-sidebar__conversation-item-preview {
    color: var(--text-1);
    font-size: 0.88rem;
}

.web-sidebar__nav {
    display: grid;
    gap: 0.45rem;
}

.web-sidebar__nav .web-sidebar__nav-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-height: 2.7rem;
    padding: 0.65rem 0.9rem;
    border-radius: 0.9rem;
    color: var(--text-1);
    text-decoration: none;
    border: 1px solid transparent;
    font-weight: 700;
    pointer-events: auto;
    transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.web-sidebar__nav .web-sidebar__nav-link::before {
    content: "";
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 999px;
    background: rgba(var(--brand-primary-rgb), 0.35);
    box-shadow: 0 0 0 0.28rem rgba(var(--brand-primary-rgb), 0.06);
}

.web-sidebar__nav .web-sidebar__nav-link:hover {
    background: rgba(var(--brand-primary-rgb), 0.06);
    color: var(--text-0);
    border-color: rgba(var(--brand-primary-rgb), 0.1);
    transform: translateX(2px);
}

.web-sidebar__nav .web-sidebar__nav-link.active {
    background: rgba(var(--brand-primary-rgb), 0.12);
    color: var(--brand-primary);
    border-color: rgba(var(--brand-primary-rgb), 0.15);
    box-shadow: 0 8px 18px rgba(var(--brand-primary-rgb), 0.08);
}

.web-sidebar__nav .web-sidebar__nav-link.active::before {
    background: var(--brand-primary);
}

.web-sidebar__nav .web-sidebar__nav-link--accent {
    background: rgba(var(--brand-primary-rgb), 0.08);
    border-color: rgba(var(--brand-primary-rgb), 0.12);
}

@media (max-width: 991.98px) {
    .web-sidebar-shell {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(78vw, 300px);
        min-width: 0;
        z-index: 1105;
        transform: translateX(-102%);
        transition: transform 180ms ease;
        pointer-events: none;
    }

    .web-sidebar-shell--open {
        transform: translateX(0);
        pointer-events: auto;
    }

    .web-sidebar-shell--open .web-sidebar-shell__backdrop {
        display: block;
    }

    .web-sidebar__close {
        display: inline-flex;
    }

    .web-sidebar {
        box-shadow: 22px 0 48px rgba(15, 23, 42, 0.18);
    }
}
