:root {
    color-scheme: dark;
    --bg: #070912;
    --panel: rgba(18, 22, 38, .82);
    --panel-solid: #111525;
    --panel-soft: #171c30;
    --text: #f5f7ff;
    --muted: #929ab4;
    --line: rgba(255, 255, 255, .09);
    --cyan: #45e6d0;
    --violet: #8b5cf6;
    --pink: #ff4fa3;
    --danger: #ff6978;
    --radius: 24px;
    --shadow: 0 24px 80px rgba(0, 0, 0, .45);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 12% 12%, rgba(69, 230, 208, .11), transparent 30%),
        radial-gradient(circle at 88% 20%, rgba(139, 92, 246, .16), transparent 34%),
        radial-gradient(circle at 55% 92%, rgba(255, 79, 163, .09), transparent 35%),
        var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system,
        BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

button,
input {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

.auth-page {
    display: grid;
    place-items: center;
    padding:
        max(22px, env(safe-area-inset-top))
        18px
        max(22px, env(safe-area-inset-bottom));
}

.auth-shell {
    width: min(100%, 440px);
}

.auth-card {
    position: relative;
    overflow: hidden;
    padding: clamp(26px, 7vw, 44px);
    border: 1px solid var(--line);
    border-radius: 32px;
    background: linear-gradient(
        145deg,
        rgba(23, 28, 48, .96),
        rgba(12, 15, 27, .92)
    );
    box-shadow: var(--shadow);
    backdrop-filter: blur(22px);
}

.auth-card::before {
    position: absolute;
    width: 180px;
    height: 180px;
    top: -90px;
    right: -60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cyan), var(--violet));
    filter: blur(50px);
    opacity: .22;
    content: "";
}

.brand-mark,
.mini-logo {
    display: grid;
    place-items: center;
    color: #071016;
    background: linear-gradient(135deg, var(--cyan), #67f087 46%, var(--violet));
    font-weight: 900;
    box-shadow: 0 0 35px rgba(69, 230, 208, .22);
}

.brand-mark {
    width: 58px;
    height: 58px;
    margin-bottom: 28px;
    border-radius: 19px;
    font-size: 27px;
}

.mini-logo {
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    border-radius: 13px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--cyan);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .13em;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

.auth-card h1 {
    margin-bottom: 10px;
    font-size: clamp(29px, 8vw, 42px);
    letter-spacing: -.04em;
}

.muted {
    color: var(--muted);
    line-height: 1.65;
}

.alert {
    margin: 22px 0;
    padding: 13px 15px;
    color: #ffd7dc;
    border: 1px solid rgba(255, 105, 120, .28);
    border-radius: 15px;
    background: rgba(255, 105, 120, .1);
    font-size: 14px;
}

.auth-form {
    display: grid;
    gap: 18px;
    margin-top: 28px;
}

.auth-form label {
    display: grid;
    gap: 9px;
    color: #cdd3e7;
    font-size: 14px;
    font-weight: 650;
}

.auth-form input {
    width: 100%;
    min-height: 54px;
    padding: 0 16px;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 16px;
    outline: none;
    background: rgba(5, 7, 15, .68);
    transition: border-color .2s, box-shadow .2s;
}

.auth-form input:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 0 4px rgba(69, 230, 208, .1);
}

.auth-form button,
.logout-button {
    min-height: 52px;
    border: 0;
    border-radius: 16px;
    cursor: pointer;
    font-weight: 800;
}

.auth-form button {
    margin-top: 4px;
    color: #071016;
    background: linear-gradient(110deg, var(--cyan), #72f397, var(--violet));
    box-shadow: 0 14px 35px rgba(69, 230, 208, .14);
}

.dashboard-page {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 10;
    display: flex;
    width: 270px;
    padding: 26px 18px;
    flex-direction: column;
    border-right: 1px solid var(--line);
    background: rgba(8, 10, 19, .9);
    backdrop-filter: blur(20px);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 10px 28px;
    font-size: 18px;
}

.sidebar nav {
    display: grid;
    gap: 5px;
}

.sidebar nav a {
    padding: 13px 14px;
    color: var(--muted);
    border-radius: 14px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 650;
}

.sidebar nav a:hover,
.sidebar nav a.active {
    color: var(--text);
    background: linear-gradient(
        90deg,
        rgba(69, 230, 208, .14),
        rgba(139, 92, 246, .1)
    );
}

.sidebar form {
    margin-top: auto;
}

.logout-button {
    width: 100%;
    color: #ffb8c0;
    border: 1px solid rgba(255, 105, 120, .18);
    background: rgba(255, 105, 120, .08);
}

.dashboard {
    min-height: 100vh;
    margin-left: 270px;
    padding: clamp(24px, 4vw, 54px);
}

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

.topbar h1 {
    margin-bottom: 0;
    font-size: clamp(28px, 5vw, 44px);
    letter-spacing: -.04em;
}

.account-chip {
    padding: 11px 15px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel);
    white-space: nowrap;
}

.welcome-panel {
    position: relative;
    overflow: hidden;
    padding: clamp(25px, 5vw, 45px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        linear-gradient(120deg, rgba(69, 230, 208, .09), transparent 42%),
        linear-gradient(300deg, rgba(139, 92, 246, .17), transparent 45%),
        var(--panel);
    box-shadow: var(--shadow);
}

.welcome-panel p {
    color: var(--cyan);
    font-weight: 750;
}

.welcome-panel h2 {
    max-width: 700px;
    margin-bottom: 0;
    font-size: clamp(25px, 5vw, 44px);
    line-height: 1.12;
    letter-spacing: -.035em;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.stats-grid article {
    display: grid;
    gap: 14px;
    min-height: 145px;
    padding: 22px;
    align-content: space-between;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--panel);
}

.stats-grid span {
    color: var(--muted);
    font-size: 14px;
}

.stats-grid strong {
    font-size: 36px;
}

@media (max-width: 800px) {
    .sidebar {
        position: static;
        width: 100%;
        padding:
            max(18px, env(safe-area-inset-top))
            16px
            14px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .sidebar-brand {
        padding-bottom: 15px;
    }

    .sidebar nav {
        display: flex;
        padding-bottom: 8px;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .sidebar nav::-webkit-scrollbar {
        display: none;
    }

    .sidebar nav a {
        flex: 0 0 auto;
    }

    .sidebar form {
        position: absolute;
        top: 18px;
        right: 16px;
    }

    .logout-button {
        width: auto;
        min-height: 40px;
        padding: 0 13px;
    }

    .dashboard {
        margin-left: 0;
        padding: 24px 16px max(28px, env(safe-area-inset-bottom));
    }

    .topbar {
        align-items: flex-start;
    }

    .account-chip {
        max-width: 130px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

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

    .stats-grid article {
        min-height: 112px;
    }
}

/* Staff Control */
.success-alert {
    margin-bottom: 20px;
    padding: 14px 17px;
    color: #baffdc;
    border: 1px solid rgba(69, 230, 208, .25);
    border-radius: 16px;
    background: rgba(69, 230, 208, .09);
}

.admin-panel {
    margin-bottom: 22px;
    padding: clamp(21px, 4vw, 32px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: 0 18px 55px rgba(0, 0, 0, .22);
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.section-heading h2 {
    margin-bottom: 0;
    font-size: clamp(22px, 4vw, 30px);
    letter-spacing: -.03em;
}

.count-badge {
    padding: 8px 12px;
    color: var(--cyan);
    border: 1px solid rgba(69, 230, 208, .18);
    border-radius: 999px;
    background: rgba(69, 230, 208, .07);
    font-size: 13px;
    white-space: nowrap;
}

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

.staff-form label {
    display: grid;
    gap: 9px;
    color: #cdd3e7;
    font-size: 14px;
    font-weight: 650;
}

.staff-form input,
.staff-form select {
    width: 100%;
    min-height: 52px;
    padding: 0 15px;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 15px;
    outline: none;
    background: rgba(5, 7, 15, .68);
}

.staff-form input:focus,
.staff-form select:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 0 4px rgba(69, 230, 208, .09);
}

.staff-form select {
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--muted) 50%),
        linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position:
        calc(100% - 20px) 22px,
        calc(100% - 14px) 22px;
    background-size: 6px 6px;
    background-repeat: no-repeat;
}

.staff-form button {
    min-height: 52px;
    align-self: end;
    color: #071016;
    border: 0;
    border-radius: 15px;
    cursor: pointer;
    background: linear-gradient(
        110deg,
        var(--cyan),
        #72f397,
        var(--violet)
    );
    font-weight: 850;
}

.staff-list {
    display: grid;
    gap: 11px;
}

.staff-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(5, 7, 15, .42);
}

.staff-avatar {
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    color: #071016;
    border-radius: 15px;
    background: linear-gradient(135deg, var(--cyan), var(--violet));
    font-weight: 900;
}

.staff-details {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.staff-details strong,
.staff-details span,
.staff-details small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.staff-details span {
    color: var(--muted);
    font-size: 13px;
}

.staff-details small {
    color: var(--cyan);
    font-size: 12px;
}

.status-badge {
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 750;
}

.status-badge.active {
    color: #a7ffd1;
    background: rgba(57, 222, 139, .11);
}

.status-badge.inactive,
.status-badge.suspended {
    color: #ffb8c0;
    background: rgba(255, 105, 120, .11);
}

@media (max-width: 650px) {
    .staff-form {
        grid-template-columns: 1fr;
    }

    .staff-item {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .staff-item .status-badge {
        grid-column: 2;
        width: max-content;
    }

    .section-heading {
        align-items: flex-start;
    }
}

/* Registration */
.register-shell {
    width: min(100%, 720px);
}

.register-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.register-form select {
    min-height: 54px;
    padding: 0 16px;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 16px;
    outline: none;
    background: rgba(5, 7, 15, .68);
}

.register-wide {
    grid-column: 1 / -1;
}

.auth-link {
    margin: 25px 0 0;
    color: var(--muted);
    text-align: center;
    font-size: 14px;
}

.auth-link a {
    color: var(--cyan);
    font-weight: 750;
    text-decoration: none;
}

/* OpenAI BD User App */
.ai-app-page {
    min-height: 100vh;
    overflow: hidden;
    background: #070912;
}

.ai-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    display: flex;
    width: 300px;
    padding: 20px 15px;
    flex-direction: column;
    border-right: 1px solid var(--line);
    background:
        radial-gradient(
            circle at 20% 0,
            rgba(69, 230, 208, .11),
            transparent 27%
        ),
        #0a0d17;
}

.ai-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 9px 19px;
    font-size: 19px;
}

.sidebar-close {
    display: none;
    width: 38px;
    height: 38px;
    margin-left: auto;
    color: var(--muted);
    border: 0;
    border-radius: 12px;
    background: var(--panel-soft);
    font-size: 26px;
}

.feature-nav {
    display: grid;
    gap: 4px;
}

.feature-nav a {
    display: flex;
    min-height: 46px;
    padding: 0 13px;
    align-items: center;
    gap: 12px;
    color: #d8dced;
    border-radius: 14px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 650;
}

.feature-nav a:hover {
    background: linear-gradient(
        90deg,
        rgba(69, 230, 208, .11),
        rgba(139, 92, 246, .08)
    );
}

.feature-nav a span {
    width: 24px;
    color: var(--cyan);
    text-align: center;
    font-size: 19px;
}

.recents {
    display: grid;
    min-height: 0;
    margin-top: 20px;
    gap: 2px;
    overflow-y: auto;
}

.recents > p {
    margin: 0 12px 9px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.recents a,
.empty-recents {
    padding: 10px 12px;
    overflow: hidden;
    color: #aeb5ca;
    border-radius: 11px;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
}

.empty-recents {
    color: #6f768d;
}

.sidebar-footer {
    display: grid;
    gap: 9px;
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid var(--line);
}

.new-chat-button {
    display: flex;
    min-height: 48px;
    padding: 0 15px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #071016;
    border-radius: 15px;
    background: linear-gradient(110deg, var(--cyan), #72f397);
    font-weight: 850;
    text-decoration: none;
}

.user-account {
    display: flex;
    min-width: 0;
    padding: 9px;
    align-items: center;
    gap: 11px;
    color: var(--text);
    border-radius: 15px;
    text-decoration: none;
}

.user-account:hover {
    background: var(--panel-soft);
}

.user-avatar {
    display: grid;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    place-items: center;
    color: #071016;
    border-radius: 13px;
    background: linear-gradient(135deg, var(--pink), var(--cyan));
    font-weight: 900;
}

.user-account > span:last-child {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.user-account strong,
.user-account small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-account small {
    color: var(--muted);
}

.sidebar-overlay {
    display: none;
}

.ai-workspace {
    display: flex;
    min-height: 100vh;
    margin-left: 300px;
    flex-direction: column;
}

.ai-topbar {
    display: flex;
    min-height: 70px;
    padding: 12px 24px;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
    background: rgba(7, 9, 18, .78);
    backdrop-filter: blur(18px);
}

.menu-button,
.mobile-brand {
    display: none;
}

.plan-chip {
    margin-left: auto;
    padding: 9px 14px;
    color: var(--cyan);
    border: 1px solid rgba(69, 230, 208, .18);
    border-radius: 999px;
    background: rgba(69, 230, 208, .06);
    text-decoration: none;
    font-size: 13px;
    font-weight: 750;
}

.chat-stage {
    display: grid;
    min-height: calc(100vh - 70px);
    padding: 44px 24px 190px;
    place-items: center;
}

.welcome-ai {
    width: min(100%, 760px);
    text-align: center;
}

.welcome-orb {
    display: grid;
    width: 76px;
    height: 76px;
    margin: 0 auto 28px;
    place-items: center;
    color: #071016;
    border-radius: 25px;
    background: linear-gradient(
        135deg,
        var(--cyan),
        #69f197 48%,
        var(--violet)
    );
    box-shadow:
        0 0 0 10px rgba(69, 230, 208, .035),
        0 24px 70px rgba(69, 230, 208, .16);
    font-size: 34px;
    font-weight: 950;
}

.welcome-ai h1 {
    margin-bottom: 15px;
    font-size: clamp(34px, 6vw, 64px);
    line-height: 1.02;
    letter-spacing: -.055em;
}

.welcome-ai > p:not(.eyebrow) {
    max-width: 580px;
    margin: 0 auto;
    color: var(--muted);
    line-height: 1.7;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 11px;
    margin-top: 30px;
}

.quick-actions a {
    padding: 16px;
    color: #dce1f3;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: var(--panel);
    text-align: left;
    text-decoration: none;
    transition: border-color .2s, transform .2s;
}

.quick-actions a:hover {
    border-color: rgba(69, 230, 208, .32);
    transform: translateY(-2px);
}

.composer-wrap {
    position: fixed;
    z-index: 20;
    right: 0;
    bottom: 0;
    left: 300px;
    padding: 16px 24px max(13px, env(safe-area-inset-bottom));
    background: linear-gradient(
        transparent,
        rgba(7, 9, 18, .96) 24%
    );
}

.composer {
    display: grid;
    width: min(100%, 860px);
    margin: 0 auto;
    padding: 10px;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    gap: 9px;
    align-items: end;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: rgba(19, 23, 39, .96);
    box-shadow: 0 18px 60px rgba(0, 0, 0, .38);
}

.composer button,
.composer select {
    height: 44px;
    border: 0;
    border-radius: 14px;
}

.attach-button {
    width: 44px;
    color: var(--text);
    background: var(--panel-soft);
    font-size: 24px;
}

.composer textarea {
    max-height: 170px;
    min-height: 44px;
    padding: 11px 5px;
    resize: none;
    color: var(--text);
    border: 0;
    outline: none;
    background: transparent;
    line-height: 1.5;
}

.composer textarea::placeholder {
    color: #777f98;
}

.composer select {
    padding: 0 30px 0 13px;
    color: #d9deef;
    outline: none;
    background: var(--panel-soft);
}

.send-button {
    width: 44px;
    color: #071016;
    background: linear-gradient(135deg, var(--cyan), var(--violet));
    font-size: 22px;
    font-weight: 900;
}

.ai-disclaimer {
    margin: 10px 0 0;
    color: #656d84;
    text-align: center;
    font-size: 11px;
}

@media (max-width: 760px) {
    .register-form {
        grid-template-columns: 1fr;
    }

    .register-wide {
        grid-column: auto;
    }

    .ai-sidebar {
        width: min(86vw, 330px);
        transform: translateX(-105%);
        transition: transform .25s ease;
    }

    body.sidebar-open .ai-sidebar {
        transform: translateX(0);
    }

    .sidebar-close {
        display: block;
    }

    body.sidebar-open .sidebar-overlay {
        position: fixed;
        inset: 0;
        z-index: 30;
        display: block;
        background: rgba(0, 0, 0, .58);
        backdrop-filter: blur(3px);
    }

    .ai-workspace {
        margin-left: 0;
    }

    .ai-topbar {
        min-height: 64px;
        padding:
            max(10px, env(safe-area-inset-top))
            14px
            10px;
    }

    .menu-button {
        display: grid;
        width: 42px;
        height: 42px;
        place-items: center;
        color: var(--text);
        border: 1px solid var(--line);
        border-radius: 14px;
        background: var(--panel);
        font-size: 20px;
    }

    .mobile-brand {
        display: flex;
        align-items: center;
        gap: 9px;
        font-size: 15px;
    }

    .mobile-brand .mini-logo {
        width: 34px;
        height: 34px;
        border-radius: 11px;
    }

    .chat-stage {
        min-height: calc(100vh - 64px);
        padding: 38px 17px 190px;
    }

    .welcome-ai {
        text-align: left;
    }

    .welcome-orb {
        width: 60px;
        height: 60px;
        margin: 0 0 24px;
        border-radius: 20px;
        font-size: 27px;
    }

    .welcome-ai h1 {
        font-size: clamp(36px, 12vw, 52px);
    }

    .welcome-ai > p:not(.eyebrow) {
        margin-left: 0;
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }

    .composer-wrap {
        left: 0;
        padding: 12px 12px max(10px, env(safe-area-inset-bottom));
    }

    .composer {
        grid-template-columns: auto minmax(0, 1fr) auto;
        border-radius: 22px;
    }

    .composer select {
        grid-column: 2;
        width: max-content;
        height: 34px;
    }

    .send-button {
        grid-column: 3;
        grid-row: 1 / span 2;
        align-self: end;
    }

    .attach-button {
        grid-row: 1 / span 2;
        align-self: end;
    }
}

/* Voice Input */
.composer {
    grid-template-columns:
        auto minmax(0, 1fr) auto auto auto;
}

.voice-button {
    width: 44px;
    color: var(--cyan);
    border: 1px solid rgba(69, 230, 208, .15) !important;
    background: rgba(69, 230, 208, .08);
    font-size: 19px;
    transition: background .2s, box-shadow .2s, transform .2s;
}

.voice-button.listening {
    color: #071016;
    background: var(--pink);
    box-shadow: 0 0 0 7px rgba(255, 79, 163, .12);
    animation: voicePulse 1.1s infinite;
}

@keyframes voicePulse {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.08);
    }
}

@media (max-width: 760px) {
    .composer {
        grid-template-columns:
            auto minmax(0, 1fr) auto auto;
    }

    .voice-button {
        grid-column: 3;
        grid-row: 1 / span 2;
        align-self: end;
    }

    .send-button {
        grid-column: 4;
        grid-row: 1 / span 2;
    }
}

/* Composer mobile layout correction */
@media (max-width: 760px) {
    .composer {
        grid-template-columns: 48px minmax(0, 1fr) 48px 48px;
        align-items: center;
    }

    .composer textarea {
        grid-column: 1 / -1;
        grid-row: 1;
        width: 100%;
        padding: 10px 9px;
    }

    .attach-button {
        grid-column: 1;
        grid-row: 2;
        align-self: center;
    }

    .composer select {
        grid-column: 2;
        grid-row: 2;
        width: 100%;
        height: 44px;
    }

    .voice-button {
        grid-column: 3;
        grid-row: 2;
        align-self: center;
    }

    .send-button {
        grid-column: 4;
        grid-row: 2;
        align-self: center;
    }
}

/* OPENAIBD_LIVE_CHAT_STYLE */
.live-chat-thread {
    width: min(860px, calc(100% - 32px));
    margin: 22px auto 190px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.live-message {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
}

.live-message-user {
    flex-direction: row-reverse;
}

.live-message-avatar {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: #071018;
    font-weight: 900;
    background: linear-gradient(135deg, #42e8d0, #6df39b, #8c67f8);
}

.live-message-user .live-message-avatar {
    background: linear-gradient(135deg, #ef63aa, #61d9dc);
}

.live-message-bubble {
    max-width: min(76%, 680px);
    padding: 14px 16px;
    border-radius: 18px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    line-height: 1.65;
    color: #eef1ff;
    background: rgba(18, 23, 43, .96);
    border: 1px solid rgba(145, 157, 210, .18);
    box-shadow: 0 15px 40px rgba(0, 0, 0, .18);
}

.live-message-user .live-message-bubble {
    background: linear-gradient(
        135deg,
        rgba(70, 231, 207, .16),
        rgba(137, 99, 248, .18)
    );
}

.live-message.is-pending .live-message-bubble {
    color: #9fa7c4;
    animation: openaibdPulse 1.2s ease-in-out infinite;
}

.live-message.is-error .live-message-bubble {
    color: #ffb9c6;
    border-color: rgba(255, 82, 120, .42);
}

.hero.chat-active,
.quick-actions.chat-active {
    display: none;
}

.composer.is-sending .send-button {
    opacity: .55;
    cursor: wait;
}

@keyframes openaibdPulse {
    50% {
        opacity: .55;
    }
}

@media (max-width: 640px) {
    .live-chat-thread {
        width: calc(100% - 24px);
        margin-top: 16px;
        margin-bottom: 180px;
    }

    .live-message-bubble {
        max-width: 82%;
        padding: 12px 14px;
    }

    .live-message-avatar {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
        border-radius: 12px;
    }
}

/* OPENAIBD_CHAT_LAYOUT_FIX_STYLE */
.openaibd-chat-hidden {
    display: none !important;
}

body.openaibd-chat-mode .live-chat-thread {
    display: flex !important;
    position: relative;
    z-index: 2;
    min-height: calc(100dvh - 260px);
    padding-top: 24px;
    padding-bottom: 30px;
    margin-top: 0;
    margin-bottom: 180px;
}

body.openaibd-chat-mode .live-message {
    display: flex !important;
}

body.openaibd-chat-mode .live-message-avatar {
    display: grid !important;
}

body.openaibd-chat-mode .live-message-bubble {
    display: block !important;
}

@media (max-width: 640px) {
    body.openaibd-chat-mode .live-chat-thread {
        min-height: calc(100dvh - 225px);
        padding-top: 16px;
        margin-bottom: 170px;
    }
}

/* OPENAIBD_GUEST_HEADER_ALWAYS_VISIBLE */
.guest-header {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 9999 !important;
}

.guest-header .guest-actions,
.guest-header .auth-actions {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* OPENAIBD_CHATGPT_LAYOUT_STYLE */
.guest-header,
.app-header,
.top-header {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 10000 !important;
}

.guest-header > *,
.app-header > *,
.top-header > * {
    visibility: visible !important;
    opacity: 1 !important;
}

body.chat-active .hero,
body.chat-active .welcome-section,
body.chat-active .starter-section,
body.chat-active .quick-actions,
body.chat-active .suggestion-list {
    display: none !important;
}

body.chat-active .message-list,
body.chat-active .chat-messages,
body.chat-active .conversation-thread {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

@media (max-width: 768px) {
    .guest-header,
    .app-header,
    .top-header {
        width: 100% !important;
        min-height: 72px !important;
    }

    .sidebar,
    .app-sidebar,
    .navigation-drawer {
        z-index: 20000 !important;
    }
}

/* OPENAIBD_ORIGINAL_HEADER_LOGOUT_STYLE */
.app-header,
.guest-header,
.topbar,
.app-topbar,
.mobile-header,
.site-header {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 10000 !important;
}

.openaibd-logout-link {
    width: calc(100% - 32px);
    min-height: 54px;
    margin: 18px 16px 24px;
    padding: 14px 18px;
    display: flex !important;
    align-items: center;
    gap: 13px;
    border: 1px solid rgba(255,92,126,.30);
    border-radius: 16px;
    background: rgba(255,72,112,.10);
    color: #ff8ca7;
    font-weight: 700;
    text-decoration: none;
}

.openaibd-logout-icon {
    font-size: 23px;
}

body {
    padding-top: 0 !important;
}

/* OPENAIBD_UNIFIED_CHATGPT_ENGINE_STYLE_V1 */
#openaibd-unified-thread {
    position: fixed !important;
    top: 74px !important;
    right: 0 !important;
    bottom: 178px !important;
    left: 0 !important;
    z-index: 5000 !important;
    display: none;
    flex-direction: column !important;
    gap: 24px !important;
    padding: 28px max(20px, calc((100% - 850px)/2)) 45px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    background: #050914 !important;
    scrollbar-width: thin;
}

body.openaibd-unified-chat-active {
    overflow: hidden !important;
}

body.openaibd-unified-chat-active .hero,
body.openaibd-unified-chat-active .hero-section,
body.openaibd-unified-chat-active .welcome,
body.openaibd-unified-chat-active .welcome-section,
body.openaibd-unified-chat-active .quick-actions,
body.openaibd-unified-chat-active .starter-section {
    display: none !important;
}

.openaibd-chat-row {
    width: 100%;
    display: flex !important;
    align-items: flex-start;
    gap: 13px;
}

.openaibd-chat-user {
    justify-content: flex-end;
}

.openaibd-chat-assistant {
    justify-content: flex-start;
}

.openaibd-chat-avatar {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    display: grid;
    place-items: center;
    border-radius: 15px;
    background: linear-gradient(135deg,#42ead0,#73f39b,#8c63ff);
    color: #06101b;
    font-size: 20px;
    font-weight: 900;
}

.openaibd-chat-user .openaibd-chat-avatar {
    background: linear-gradient(135deg,#ff78bd,#8ce6ff);
}

.openaibd-chat-bubble {
    max-width: min(78%, 680px);
    padding: 17px 20px;
    border: 1px solid #29314e;
    border-radius: 22px;
    background: #12182d;
    color: #f2f4ff;
    font-size: 17px;
    line-height: 1.65;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.openaibd-chat-user .openaibd-chat-bubble {
    background: linear-gradient(145deg,#17243c,#17162d);
    border-bottom-right-radius: 7px;
}

.openaibd-chat-assistant .openaibd-chat-bubble {
    border-bottom-left-radius: 7px;
}

.openaibd-chat-temporary {
    opacity: .68;
}

.openaibd-chat-temporary .openaibd-chat-bubble {
    animation: openaibdThinking 1.1s ease-in-out infinite alternate;
}

@keyframes openaibdThinking {
    from { opacity: .55; }
    to { opacity: 1; }
}

.composer-wrap {
    z-index: 8000 !important;
}

.sidebar,
.app-sidebar,
.navigation-drawer,
#sidebar {
    z-index: 20000 !important;
}

@media (max-width: 768px) {
    #openaibd-unified-thread {
        top: 72px !important;
        bottom: 176px !important;
        padding: 22px 20px 38px !important;
    }

    .openaibd-chat-bubble {
        max-width: 82%;
        padding: 15px 17px;
        font-size: 16px;
    }

    .openaibd-chat-avatar {
        width: 43px;
        height: 43px;
        flex-basis: 43px;
    }
}

/* OPENAIBD_SIDEBAR_OVER_CHAT_STYLE */
[class*="sidebar"],
[class*="drawer"],
.navigation-panel,
.navigation-drawer {
    z-index: 1000000 !important;
}

body.openaibd-sidebar-visible #openaibd-unified-thread,
body.openaibd-sidebar-visible .composer-wrap,
body.openaibd-sidebar-visible .composer {
    visibility: hidden !important;
    pointer-events: none !important;
}

body.openaibd-sidebar-visible [class*="sidebar"],
body.openaibd-sidebar-visible [class*="drawer"],
body.openaibd-sidebar-visible .navigation-panel,
body.openaibd-sidebar-visible .navigation-drawer {
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

.sidebar-overlay,
.drawer-overlay,
.navigation-overlay {
    z-index: 999999 !important;
}

/* OPENAIBD_ADMIN_LOGOUT_CLICK_FIX */
.dashboard-page .sidebar form[action="/logout"] {
    position: relative !important;
    z-index: 2147483647 !important;
    pointer-events: auto !important;
}

.dashboard-page .sidebar form[action="/logout"] .logout-button {
    position: relative !important;
    z-index: 2147483647 !important;
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* OPENAIBD_ADMIN_LOGOUT_POSITION_FIX */
.dashboard-page .sidebar form[action="/logout"] {
    position: static !important;
    z-index: auto !important;
    pointer-events: auto !important;
}

.dashboard-page .sidebar form[action="/logout"] .logout-button {
    position: static !important;
    z-index: auto !important;
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* OPENAIBD_ADMIN_MOBILE_LOGOUT_TOP_RIGHT */
@media (max-width: 768px) {

    .dashboard-page .sidebar form[action="/logout"] {
        position: absolute !important;
        top: 14px !important;
        right: 14px !important;
        left: auto !important;
        bottom: auto !important;
        margin: 0 !important;
        width: auto !important;
        z-index: 2147483647 !important;
        pointer-events: auto !important;
    }

    .dashboard-page .sidebar form[action="/logout"] .logout-button {
        position: relative !important;
        width: auto !important;
        min-width: 88px !important;
        min-height: 40px !important;
        padding: 0 14px !important;
        margin: 0 !important;
        z-index: 2147483647 !important;
        pointer-events: auto !important;
        cursor: pointer !important;
    }
}


/* OPENAIBD STAFF ROLE STATUS CONTROL */
.staff-control-actions{
    display:flex;
    align-items:center;
    justify-content:flex-end;
    flex-wrap:wrap;
    gap:8px;
}

.staff-mini-form{
    display:flex;
    align-items:center;
    gap:6px;
}

.staff-mini-form select{
    min-height:38px;
    padding:0 10px;
    color:var(--text);
    border:1px solid var(--line);
    border-radius:10px;
    background:#101629;
}

.staff-mini-form button{
    min-height:38px;
    padding:0 11px;
    border:1px solid var(--line);
    border-radius:10px;
    cursor:pointer;
    font-weight:700;
}

@media(max-width:768px){
    .staff-item{
        align-items:flex-start;
        flex-wrap:wrap;
    }

    .staff-control-actions{
        width:100%;
        justify-content:flex-start;
        margin-top:10px;
    }

    .staff-mini-form{
        width:100%;
    }

    .staff-mini-form select{
        flex:1;
        min-width:0;
    }
}

/* ==========================================================
   OpenAI BD Generated Image
   ========================================================== */

.openaibd-image-bubble {
    padding: 8px;
    width: min(100%, 680px);
    max-width: 680px;
    overflow: hidden;
}

.openaibd-generated-image {
    display: block;
    width: 100%;
    max-width: 640px;
    height: auto;
    border-radius: 14px;
    object-fit: contain;
}

@media (max-width: 768px) {
    .openaibd-image-bubble {
        width: 100%;
        max-width: calc(100vw - 76px);
        padding: 6px;
    }

    .openaibd-generated-image {
        width: 100%;
        max-width: 100%;
        border-radius: 12px;
    }
}

/* ============================================================
   OPENAIBD GPT ATTACHMENT V2
   ============================================================ */

.openaibd-attach-menu {
    position: fixed;
    z-index: 99999;
    width: 270px;
    padding: 10px;
    display: none;
    background: #242424;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 24px;
    box-shadow: 0 18px 55px rgba(0,0,0,.45);
}

.openaibd-attach-menu.is-open {
    display: block;
}

.openaibd-attach-menu button {
    width: 100%;
    min-height: 52px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 10px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.openaibd-attach-menu button:hover {
    background: rgba(255,255,255,.08);
}

.oabd-menu-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255,255,255,.09);
    font-size: 20px;
}


/* Selected attachment */

.openaibd-attachment-preview {
    display: none;
    align-items: center;
    gap: 11px;
    width: min(520px, calc(100% - 24px));
    margin: 0 auto 8px;
    padding: 9px;
    border: 1px solid rgba(148,163,184,.25);
    border-radius: 16px;
    background: rgba(20,27,45,.96);
}

.openaibd-attachment-preview.is-visible {
    display: flex;
}

.oabd-preview-thumb {
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 11px;
    background: rgba(255,255,255,.08);
}

.oabd-preview-thumb img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.oabd-file-icon {
    font-size: 11px;
    font-weight: 800;
}

.oabd-preview-info {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.oabd-preview-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
}

.oabd-preview-meta {
    opacity: .62;
    font-size: 12px;
}

.oabd-preview-remove {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    border: 0;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
    color: inherit;
    cursor: pointer;
    font-size: 20px;
}


/* Sent attachment */

.oabd-user-file-message {
    overflow: hidden;
}

.oabd-sent-image {
    max-width: 420px;
    overflow: hidden;
    border-radius: 15px;
}

.oabd-sent-image img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 15px;
}

.oabd-sent-file {
    min-width: 230px;
    max-width: 390px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 14px;
    background: rgba(255,255,255,.06);
}

.oabd-sent-file-icon {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: rgba(255,255,255,.10);
    font-size: 10px;
    font-weight: 800;
}

.oabd-sent-file > span:last-child {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.oabd-sent-file strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.oabd-sent-file small {
    margin-top: 3px;
    opacity: .65;
}

.oabd-file-caption {
    margin-top: 8px;
    line-height: 1.45;
}


@media (max-width: 768px) {

    .openaibd-attach-menu {
        width: 260px;
        border-radius: 22px;
    }

    .openaibd-attachment-preview {
        width: calc(100% - 20px);
    }

    .oabd-sent-image {
        max-width: min(74vw, 420px);
    }

    .oabd-sent-file {
        min-width: 0;
        width: min(72vw, 350px);
    }
}


/* OPENAI BD GPT STYLE SEND STATE V1 */

.oabd-stop-icon{
    display:block;
    width:14px;
    height:14px;
    background:currentColor;
    border-radius:3px;
    margin:auto;
}

.is-sending{
    cursor:wait;
}


/* =========================================================
   OPENAI BD ATTACHMENT V3 UI FIX
   ========================================================= */

html,
body {
    overflow-x: hidden !important;
}

body.openaibd-unified-chat-active {
    overflow-y: auto !important;
}

.composer {
    position: relative !important;
}

.openaibd-attachment-preview {
    display: none !important;
    width: calc(100% - 20px) !important;
    margin: 0 10px 10px !important;
    box-sizing: border-box !important;
    position: relative !important;
    inset: auto !important;
    transform: none !important;
    z-index: 2 !important;
}

.openaibd-attachment-preview.is-visible {
    display: flex !important;
}

.oabd-preview-remove {
    position: static !important;
    transform: none !important;
    flex: 0 0 auto !important;
    margin-left: auto !important;
}

.oabd-sent-image img,
.openaibd-generated-image {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 14px;
}

.oabd-sent-attachment {
    overflow: hidden;
}

.send-button.is-sending {
    font-size: 18px !important;
}

@media (max-width: 768px) {
    body {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .openaibd-attachment-preview {
        width: calc(100% - 16px) !important;
        margin: 0 8px 8px !important;
    }
}

/* OPENAIBD_RECENT_PIN_V1 */

.openaibd-chat-history {
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
}

.openaibd-history-section {
    margin: 14px 0;
}

.openaibd-history-title {
    margin: 0 8px 7px;
    font-size: 12px;
    font-weight: 600;
    opacity: .62;
}

.openaibd-history-item {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    border-radius: 9px;
}

.openaibd-history-item:hover {
    background: rgba(255,255,255,.06);
}

.openaibd-history-link {
    flex: 1;
    min-width: 0;
    padding: 8px 5px 8px 9px;
    text-decoration: none;
}

.openaibd-history-text {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.openaibd-pin-form {
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
}

.openaibd-pin-button {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    cursor: pointer;
    opacity: .45;
}

.openaibd-history-item:hover
.openaibd-pin-button,
.openaibd-pin-button.is-pinned {
    opacity: 1;
}

.openaibd-pin-button:disabled {
    cursor: wait;
    opacity: .35;
}

