:root {
    --tridax-primary: #0d6efd;
    --tridax-secondary: #6610f2;
    --tridax-sidebar-bg: #0f172a;
    --tridax-sidebar-fg: #cbd5e1;
    --tridax-sidebar-active: rgba(255, 255, 255, 0.08);
    --tridax-content-bg: #f5f7fb;
    --tridax-card-radius: 12px;
}

html, body { height: 100%; }
body.app-body {
    background: var(--tridax-content-bg);
    color: #1f2937;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    margin: 0;
}

/* ---------------------------------------------------------- sidebar */
.app-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 240px;
    background: var(--tridax-sidebar-bg);
    color: var(--tridax-sidebar-fg);
    padding: 1.25rem 0.75rem;
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform 0.25s ease;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0 0.5rem 1rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar-brand .brand-mark {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--tridax-primary), var(--tridax-secondary));
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.1rem;
}
.sidebar-brand .brand-title { color: #fff; font-weight: 600; }
.sidebar-brand .brand-sub { color: var(--tridax-sidebar-fg); }

.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.sidebar-link {
    display: flex; align-items: center; gap: 0.7rem;
    color: var(--tridax-sidebar-fg);
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.92rem;
}
.sidebar-link:hover { background: rgba(255,255,255,0.04); color: #fff; }
.sidebar-link.active { background: var(--tridax-sidebar-active); color: #fff; }
.sidebar-link i { font-size: 1.05rem; opacity: 0.9; }

.sidebar-footer { padding: 0.75rem 0.5rem 0; border-top: 1px solid rgba(255,255,255,0.06); }
.sidebar-footer small { color: rgba(255,255,255,0.4) !important; }

/* ---------------------------------------------------------- main */
.app-main { margin-left: 240px; min-height: 100vh; display: flex; flex-direction: column; }
.app-topbar {
    height: 60px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    display: flex; align-items: center;
    padding: 0 1.25rem;
    position: sticky; top: 0; z-index: 1020;
}
.topbar-title { font-weight: 600; font-size: 1.05rem; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 0.35rem; }

.btn-icon {
    background: transparent; border: 1px solid transparent;
    width: 38px; height: 38px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 8px; color: #475569;
}
.btn-icon:hover { background: #f1f5f9; }

.user-btn {
    background: transparent; border: 1px solid transparent;
    display: inline-flex; align-items: center;
    padding: 0.25rem 0.5rem; border-radius: 8px;
}
.user-btn:hover { background: #f1f5f9; }
.user-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, var(--tridax-primary), var(--tridax-secondary));
    color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 600;
}

.notif-dot {
    position: absolute; top: 6px; right: 6px;
    width: 9px; height: 9px;
    background: #ef4444; border-radius: 50%; border: 2px solid #fff;
}
.notif-dropdown { width: 320px; max-height: 420px; overflow: auto; }

.app-content { flex: 1; padding: 1.5rem; }
.app-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    background: #fff;
    text-align: center;
}

/* --------------------------------------------------------- cards */
.card { border: 1px solid #e5e7eb; border-radius: var(--tridax-card-radius); box-shadow: 0 1px 2px rgba(0,0,0,0.02); }
.card-header { background: #fff; border-bottom: 1px solid #f1f5f9; padding: 0.85rem 1rem; }

/* ---------------------------------------------------- stat cards */
.stat-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: var(--tridax-card-radius);
    padding: 1rem 1.1rem;
    display: flex; align-items: center; gap: 1rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
    height: 100%;
}
.stat-icon {
    width: 48px; height: 48px;
    border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.4rem; color: #fff; flex-shrink: 0;
}
.stat-primary .stat-icon { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.stat-success .stat-icon { background: linear-gradient(135deg, #10b981, #059669); }
.stat-warning .stat-icon { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stat-info    .stat-icon { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; color: #0f172a; }
.stat-label { font-size: 0.8rem; color: #64748b; text-transform: uppercase; letter-spacing: 0.04em; }

/* ----------------------------------------------- ticket replies */
.reply-item { border-left: 3px solid #e5e7eb; padding: 0.5rem 0.85rem; }
.reply-item.reply-internal { border-left-color: #f59e0b; background: #fffbeb; }
.reply-item.reply-system   { border-left-color: #94a3b8; background: #f8fafc; font-style: italic; }
.reply-body { white-space: pre-wrap; }

/* -------------------------------------------------------- auth */
body.auth-body {
    margin: 0; min-height: 100vh;
    background:
        radial-gradient(circle at 0% 0%, rgba(13,110,253,0.12), transparent 40%),
        radial-gradient(circle at 100% 100%, rgba(102,16,242,0.12), transparent 40%),
        #f8fafc;
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.auth-shell { width: 100%; max-width: 420px; }
.auth-card { background: #fff; border-radius: 16px; padding: 2rem 1.75rem; }
.auth-brand { text-align: center; margin-bottom: 1.5rem; }
.auth-brand .auth-logo {
    width: 56px; height: 56px; margin: 0 auto 0.75rem;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--tridax-primary), var(--tridax-secondary));
    color: #fff; font-size: 1.5rem;
    display: inline-flex; align-items: center; justify-content: center;
}

/* -------------------------------------------------- responsive */
@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); }
    .app-sidebar.open { transform: translateX(0); }
    .app-main { margin-left: 0; }
}

/* ----------------------------------------------------- helpers */
.font-monospace { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.opacity-50 { opacity: 0.5; }
.btn-loader .spinner-border { vertical-align: -2px; }
