/* ── App Shell ───────────────────────────────────── */
.kita-app-shell {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    background: var(--kita-gray-bg);
}

/* ── Sidebar ─────────────────────────────────────── */
.kita-sidebar {
    width: 220px;
    min-width: 220px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-right: 1px solid var(--kita-gray-border);
    overflow-y: auto;
    flex-shrink: 0;
    z-index: 100;
}

/* ── Sidebar Brand ───────────────────────────────── */
.kita-sidebar-brand {
    padding: 16px;
    border-bottom: 1px solid var(--kita-gray-border);
    flex-shrink: 0;
}

.kita-sidebar-brand-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
}

.kita-sidebar-brand-link:hover {
    color: inherit;
}

.kita-sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--kita-black);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

.kita-sidebar-brand-name {
    font-weight: 700;
    font-size: 15px;
    line-height: 1.2;
    color: var(--kita-text);
}

.kita-sidebar-brand-sub {
    font-size: 11px;
    color: var(--kita-gray-muted);
    margin-top: 1px;
}

/* ── Sidebar Nav ─────────────────────────────────── */
.kita-sidebar-nav {
    flex: 1;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.kita-sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--kita-text);
    font-size: 14px;
    font-weight: 500;
    transition: background .12s, color .12s;
    white-space: nowrap;
}

.kita-sidebar-link:hover {
    background: var(--kita-gray-bg);
    color: var(--kita-text);
}

.kita-sidebar-link.active {
    background: #e8edf6;
    color: var(--kita-blue);
    font-weight: 600;
}

.kita-sidebar-link svg {
    flex-shrink: 0;
    opacity: .6;
}

.kita-sidebar-link.active svg {
    opacity: 1;
}

/* ── Sidebar New-Chat Button ─────────────────────── */
.kita-sidebar-new-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: calc(100% - 16px);
    margin: 0 8px 8px;
    padding: 9px 12px;
    border: 1px dashed #ccc;
    background: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    text-align: left;
    transition: background .12s, border-color .12s, color .12s;
}

.kita-sidebar-new-btn:hover {
    background: var(--kita-gray-bg);
    border-color: #aaa;
    color: var(--kita-text);
}

/* ── Sidebar Prompt Section ──────────────────────── */
.kita-sidebar-section {
    padding: 10px 16px 12px;
    border-top: 1px solid var(--kita-gray-border);
    margin-top: auto;
    flex-shrink: 0;
}

.kita-sidebar-section-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--kita-gray-muted);
    margin-bottom: 6px;
}

.kita-sidebar-select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
    color: var(--kita-text);
    background: #fff;
    outline: none;
    cursor: pointer;
    transition: border-color .15s;
}

.kita-sidebar-select:focus {
    border-color: var(--kita-blue);
}

/* ── Sidebar Overlay (mobile) ────────────────────── */
.kita-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .4);
    z-index: 99;
}

.kita-sidebar-overlay.is-open {
    display: block;
}

/* ── Main Area ───────────────────────────────────── */
.kita-main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    min-width: 0;
}

/* ── Topbar ──────────────────────────────────────── */
.kita-topbar {
    height: 52px;
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid var(--kita-gray-border);
    background: #fff;
    flex-shrink: 0;
    gap: 12px;
}

.kita-topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.kita-topbar-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.kita-topbar-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--kita-text);
    white-space: nowrap;
}

/* ── Topbar Conversation ID ──────────────────────── */
#kita-conv-id {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: var(--kita-gray-muted);
}

#kita-copy-btn {
    display: none;
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
    color: #aaa;
    line-height: 1;
    align-items: center;
}

#kita-copy-btn:hover {
    color: #555;
}

/* ── Topbar Profile & Logout ─────────────────────── */
.kita-topbar-profile {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: var(--kita-text);
    font-size: 14px;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: 8px;
    transition: background .12s;
    white-space: nowrap;
}

.kita-topbar-profile:hover {
    background: var(--kita-gray-bg);
    color: var(--kita-text);
}

.kita-topbar-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: 8px;
    color: var(--kita-gray-muted);
    text-decoration: none;
    transition: background .12s, color .12s;
}

.kita-topbar-logout:hover {
    color: var(--kita-red);
    background: #fef2f2;
}

/* ── Hamburger (mobile) ──────────────────────────── */
.kita-hamburger {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 8px;
    color: var(--kita-text);
    flex-shrink: 0;
    transition: background .12s;
}

.kita-hamburger:hover {
    background: var(--kita-gray-bg);
}

/* ── Page Content ────────────────────────────────── */
.kita-page-content {
    flex: 1;
    overflow: auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* ── Inner Width Limiters (Profile, Users) ───────── */
.kita-inner-content {
    max-width: 600px;
    margin: 0 auto;
    padding: 32px 24px;
    width: 100%;
}

.kita-inner-content-wide {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px;
    width: 100%;
}

/* ── Topbar Admin Badge ──────────────────────────── */
.kita-topbar-badge {
    display: inline-block;
    background: var(--kita-red);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    letter-spacing: .5px;
}

/* ── Non-Authenticated Layout (Login, Register, Maintenance) ── */
.kita-app-shell--noauth {
    display: block;
    height: auto;
    min-height: 100vh;
    overflow: visible;
}

.kita-app-shell--noauth .kita-main-area {
    height: auto;
    overflow: visible;
}

.kita-app-shell--noauth .kita-page-content {
    flex: none;
    overflow: visible;
    display: block;
}

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 768px) {
    .kita-sidebar {
        position: fixed;
        left: -220px;
        top: 0;
        height: 100vh;
        transition: left .2s ease;
        box-shadow: none;
    }

    .kita-sidebar.is-open {
        left: 0;
        box-shadow: 4px 0 20px rgba(0,0,0,.12);
    }

    .kita-hamburger {
        display: flex;
    }

    .kita-topbar {
        padding: 0 14px;
    }

    .kita-topbar-profile span {
        display: none;
    }

    .kita-inner-content,
    .kita-inner-content-wide {
        padding: 20px 16px;
    }
}

@media (max-width: 576px) {
    .kita-topbar-profile {
        padding: 6px;
    }
}
