:root {
    --ac-primary: #7c3aed;
    --ac-primary-dark: #6d28d9;
    --ac-primary-light: #ede9fe;
    --ac-sidebar-bg: #1e1b4b;
    --ac-sidebar-active: #7c3aed;
    --ac-sidebar-hover: rgba(124,58,237,0.15);
    --ac-sidebar-text: #a5b4fc;
    --ac-sidebar-icon: #a5b4fc;
    --ac-body-bg: #f5f3ff;
    --ac-card-radius: 12px;
}

* { box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--ac-body-bg); margin: 0; }

/* ---- SIDEBAR ---- */
.ac-sidebar {
    width: 64px;
    min-height: 100vh;
    background: var(--ac-sidebar-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: width 0.25s ease;
    overflow: hidden;
}
.ac-sidebar.expanded { width: 240px; align-items: stretch; padding: 12px; }
.ac-sidebar .sidebar-logo {
    width: 40px; height: 40px;
    background: var(--ac-primary);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.2rem;
    margin-bottom: 20px;
    cursor: pointer;
    flex-shrink: 0;
}
.ac-sidebar.expanded .sidebar-logo { width: 100%; height: auto; padding: 10px 12px; border-radius: 10px; justify-content: flex-start; gap: 10px; }
.ac-sidebar.expanded .sidebar-logo-text { display: inline; font-weight: 700; font-size: 1.1rem; }
.sidebar-logo-text { display: none; }

.ac-sidebar .sidebar-nav { flex: 1; width: 100%; display: flex; flex-direction: column; gap: 2px; }
.ac-sidebar .sidebar-bottom { width: 100%; display: flex; flex-direction: column; gap: 2px; margin-top: auto; }

.sidebar-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px; height: 44px;
    margin: 0 auto;
    border-radius: 12px;
    color: var(--ac-sidebar-icon);
    text-decoration: none;
    font-size: 1.2rem;
    transition: all 0.2s;
    position: relative;
    cursor: pointer;
}
.ac-sidebar.expanded .sidebar-item { width: 100%; justify-content: flex-start; padding: 0 14px; gap: 12px; height: 42px; }
.sidebar-item:hover { background: var(--ac-sidebar-hover); color: #fff; }
.sidebar-item.active { background: var(--ac-primary); color: #fff; }
.sidebar-item-text { display: none; font-size: 0.88rem; font-weight: 500; white-space: nowrap; }
.ac-sidebar.expanded .sidebar-item-text { display: inline; }

.sidebar-tooltip {
    display: none;
    position: absolute;
    left: 68px;
    top: 50%; transform: translateY(-50%);
    background: #1e293b;
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.78rem;
    white-space: nowrap;
    z-index: 1100;
    pointer-events: none;
}
.ac-sidebar:not(.expanded) .sidebar-item:hover .sidebar-tooltip { display: block; }

.sidebar-divider { height: 1px; background: rgba(255,255,255,0.08); margin: 8px 10px; }
.ac-sidebar.expanded .sidebar-divider { margin: 8px 0; }

.sidebar-section-label { display: none; }
.ac-sidebar.expanded .sidebar-section-label { display: block; padding: 4px 14px; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; color: rgba(165,180,252,0.5); margin-top: 8px; }

.sidebar-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--ac-primary);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.85rem;
    flex-shrink: 0;
}

/* ---- MAIN CONTENT ---- */
.ac-main {
    margin-left: 64px;
    min-height: 100vh;
    transition: margin-left 0.25s ease;
}
.ac-sidebar.expanded ~ .ac-main { margin-left: 240px; }

/* Top bar */
.ac-topbar {
    height: 56px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 900;
}
.ac-topbar .page-title { font-weight: 700; font-size: 1rem; color: #1e1b4b; }
.ac-topbar .topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar-icon { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #6b7280; cursor: pointer; transition: background 0.2s; font-size: 1.1rem; }
.topbar-icon:hover { background: #f3f4f6; color: var(--ac-primary); }

.ac-page { padding: 24px; }

/* ---- STAT CARDS ---- */
.stat-card {
    background: #fff;
    border-radius: var(--ac-card-radius);
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    border: 1px solid #f3f4f6;
}
.stat-card .stat-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; }
.stat-card .stat-value { font-size: 1.8rem; font-weight: 800; color: #1e1b4b; }
.stat-card .stat-label { font-size: 0.82rem; color: #6b7280; font-weight: 500; }

/* ---- INFO BANNER ---- */
.info-banner {
    background: linear-gradient(135deg, #1e1b4b, #312e81);
    border-radius: var(--ac-card-radius);
    padding: 24px 28px;
    color: #fff;
    position: relative;
    overflow: hidden;
}
.info-banner::after { content: ''; position: absolute; right: -20px; top: -20px; width: 120px; height: 120px; background: rgba(124,58,237,0.2); border-radius: 50%; }

/* ---- CSAT ---- */
.csat-ring {
    width: 90px; height: 90px;
    border-radius: 50%;
    border: 6px solid #e5e7eb;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; font-weight: 800; color: #1e1b4b;
    position: relative;
}

/* ---- TABLE ---- */
.ac-table { border-radius: var(--ac-card-radius); overflow: hidden; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.04); border: 1px solid #f3f4f6; }
.ac-table .table { margin-bottom: 0; }
.ac-table .table th { font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.5px; color: #6b7280; background: #fafbfc; border-bottom: 1px solid #f3f4f6; padding: 12px 16px; }
.ac-table .table td { padding: 12px 16px; font-size: 0.88rem; color: #374151; vertical-align: middle; border-bottom: 1px solid #f9fafb; }

/* ---- TABS ---- */
.ac-tabs { display: flex; gap: 0; border-bottom: 2px solid #f3f4f6; margin-bottom: 16px; }
.ac-tab { padding: 10px 20px; font-size: 0.88rem; font-weight: 600; color: #6b7280; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.2s; text-decoration: none; }
.ac-tab:hover { color: var(--ac-primary); }
.ac-tab.active { color: var(--ac-primary); border-bottom-color: var(--ac-primary); }

/* ---- BADGE ---- */
.badge-ac { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 6px; font-size: 0.76rem; font-weight: 600; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-open { background: #fef3c7; color: #92400e; }
.badge-hold { background: #fee2e2; color: #991b1b; }
.badge-resolved { background: #d1fae5; color: #065f46; }
.badge-active { background: #d1fae5; color: #065f46; }

/* ---- CARD ---- */
.card { border-radius: var(--ac-card-radius); border: 1px solid #f3f4f6; }

/* Chat messages */
.chat-box { scroll-behavior: smooth; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .ac-sidebar { width: 0; }
    .ac-sidebar.mobile-open { width: 240px; }
    .ac-main { margin-left: 0 !important; }
}
