:root {
    --alice-bg: #f4f8f4;
    --alice-surface: #ffffff;
    --alice-primary: #17624d;
    --alice-primary-soft: #d7efe7;
    --alice-secondary: #f3f0e6;
    --alice-text: #1f2a2a;
    --alice-muted: #617171;
    --alice-border: #d7e1dd;
    --alice-danger: #b63b3b;
    --alice-warning: #b9851e;
}

body {
    font-family: 'Lexend', sans-serif;
    background: radial-gradient(circle at top, #fbfdf8 0%, var(--alice-bg) 55%, #eef4ef 100%);
    color: var(--alice-text);
}

.app-shell {
    min-height: 100vh;
}

.alice-card {
    background: var(--alice-surface);
    border: 1px solid var(--alice-border);
    border-radius: 24px;
    box-shadow: 0 18px 50px rgba(23, 98, 77, 0.08);
}

.alice-btn {
    border-radius: 16px;
    padding: 0.8rem 1.1rem;
    font-weight: 600;
}

.alice-btn-primary {
    background: var(--alice-primary);
    border-color: var(--alice-primary);
    color: #fff;
}

.alice-btn-primary:hover {
    background: #0f4f3d;
    border-color: #0f4f3d;
    color: #fff;
}

.login-wrapper,
.splash-wrapper {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
}

.brand-mark {
    width: 84px;
    height: 84px;
    border-radius: 24px;
    background: linear-gradient(135deg, var(--alice-primary) 0%, #59a288 100%);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 1.6rem;
    font-weight: 700;
}

.sidebar-logo-wrap {
    width: 88px;
    height: 88px;
    flex: 0 0 88px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.sidebar .sidebar-logo {
    display: block;
    width: 88px !important;
    max-width: 88px !important;
    max-height: 88px !important;
    height: auto !important;
    object-fit: contain;
    flex: 0 0 auto;
}

.dashboard-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
    position: relative;
}

.sidebar {
    background: #113a2f;
    color: #fff;
    padding: 1.5rem;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    z-index: 1100;
    min-width: 0;
}

.sidebar a {
    color: rgba(255, 255, 255, 0.88);
    text-decoration: none;
    display: block;
    padding: 0.85rem 1rem;
    border-radius: 16px;
    margin-bottom: 0.45rem;
}

.sidebar a.active,
.sidebar a:hover {
    background: rgba(255, 255, 255, 0.12);
}

.content-area {
    padding: 1.5rem;
}

.mobile-nav-trigger {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    width: 52px;
    height: 52px;
    border: 0;
    border-radius: 18px;
    background: var(--alice-primary);
    box-shadow: 0 14px 30px rgba(23, 98, 77, 0.28);
    z-index: 1300;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-direction: column;
    gap: 0.45rem;
}

.mobile-nav-trigger .list-line {
    display: block;
    position: relative;
    width: 24px;
    height: 3px;
    background: #ffffff;
    border-radius: 999px;
    margin-left: 9px;
}

.mobile-nav-trigger .list-line::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -9px;
    width: 6px;
    height: 6px;
    background: #ffffff;
    border-radius: 50%;
    transform: translateY(-50%);
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(12, 28, 23, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 1050;
}

body.sidebar-open {
    overflow: hidden;
}

body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.stats-card {
    padding: 1.2rem;
}

.chat-box {
    min-height: 420px;
    max-height: 65vh;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-message {
    overflow-wrap: anywhere;
}

.chat-composer {
    position: sticky;
    bottom: 0;
    background: linear-gradient(180deg, rgba(244, 248, 244, 0) 0%, rgba(244, 248, 244, 0.96) 18%, rgba(244, 248, 244, 1) 100%);
    padding-top: 1rem;
}

.chat-message {
    padding: 1rem;
    border-radius: 18px;
    max-width: 85%;
}

.chat-message.user {
    align-self: flex-end;
    background: var(--alice-primary);
    color: #fff;
}

.chat-message.ai {
    align-self: flex-start;
    background: var(--alice-primary-soft);
}

.chat-message.pending {
    opacity: 0.95;
}

.thinking-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--alice-muted);
    font-size: 0.95rem;
}

.thinking-indicator::after {
    content: '';
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 50%;
    background: var(--alice-primary);
    animation: alice-pulse 1s infinite ease-in-out;
}

@keyframes alice-pulse {
    0%, 100% {
        transform: scale(0.8);
        opacity: 0.45;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
}

.metric-pill {
    padding: 0.45rem 0.75rem;
    background: var(--alice-secondary);
    border-radius: 999px;
    font-size: 0.9rem;
}

.table-responsive {
    border-radius: 20px;
}

.global-footer {
    text-align: center;
    padding: 1rem 1.25rem 1.5rem;
    color: var(--alice-muted);
    font-size: 0.86rem;
}

@media (max-width: 991px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }

    .dashboard-layout > .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: min(82vw, 320px);
        height: 100vh;
        overflow-y: auto;
        transform: translate3d(-110%, 0, 0);
        box-shadow: 0 18px 45px rgba(0, 0, 0, 0.22);
        margin: 0;
        display: block !important;
        padding-top: 5.5rem;
    }

    body.sidebar-open .dashboard-layout > .sidebar {
        transform: translate3d(0, 0, 0);
    }

    .mobile-nav-trigger {
        display: inline-flex !important;
    }

    .content-area {
        padding: 5rem 1rem 1.25rem;
    }

    .chat-box {
        max-height: 56vh;
        min-height: 320px;
    }
}
