:root {
    --brand: #4f46e5;
    --brand-dark: #4338ca;
    --brand-light: #eef2ff;
    --bg: #f5f6fa;
    --sidebar: #1e293b;
    --sidebar-hover: #334155;
    --text: #1f2937;
    --muted: #6b7280;
}

* { box-sizing: border-box; }

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ---------- Auth ---------- */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    padding: 1rem;
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    padding: 2.5rem 2rem;
}
.auth-logo {
    text-align: center;
    margin-bottom: 1.5rem;
}
.auth-logo i {
    font-size: 2.5rem;
    color: var(--brand);
    background: var(--brand-light);
    width: 72px; height: 72px;
    line-height: 72px;
    border-radius: 50%;
    display: inline-block;
}
.auth-logo h1 { font-size: 1.4rem; margin-top: .8rem; font-weight: 700; }
.auth-logo p { color: var(--muted); font-size: .9rem; }

.btn-brand {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    font-weight: 600;
}
.btn-brand:hover { background: var(--brand-dark); border-color: var(--brand-dark); color:#fff; }

.form-control:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 .2rem rgba(79,70,229,.15);
}

/* ---------- App layout ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 250px;
    background: var(--sidebar);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; bottom: 0; left: 0;
}
.sidebar .brand {
    padding: 1.3rem 1.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid var(--sidebar-hover);
}
.sidebar .brand i { color: #818cf8; margin-right: .5rem; }
.sidebar .nav-link {
    color: #cbd5e1;
    padding: .8rem 1.5rem;
    display: flex;
    align-items: center;
    gap: .8rem;
    cursor: pointer;
    border: none; background: none; width: 100%; text-align: left;
}
.sidebar .nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar .nav-link.active { background: var(--brand); color: #fff; }
.sidebar .nav-link i { width: 20px; text-align: center; }
.sidebar .sidebar-footer { margin-top: auto; padding: 1rem 1.5rem; border-top: 1px solid var(--sidebar-hover); }

.main { margin-left: 250px; flex: 1; display: flex; flex-direction: column; }
.topbar {
    background: #fff;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.topbar h4 { margin: 0; font-weight: 700; }
.content { padding: 1.5rem; flex: 1; }

.section { display: none; }
.section.active { display: block; }

/* ---------- Cards / stats ---------- */
.stat-card {
    background: #fff;
    border-radius: 14px;
    padding: 1.25rem;
    box-shadow: 0 2px 12px rgba(0,0,0,.05);
    display: flex;
    align-items: center;
    gap: 1rem;
}
.stat-card .icon {
    width: 54px; height: 54px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem; color: #fff;
}
.stat-card .value { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.stat-card .label { color: var(--muted); font-size: .85rem; }
.bg-indigo { background: #6366f1; }
.bg-green { background: #10b981; }
.bg-amber { background: #f59e0b; }
.bg-pink { background: #ec4899; }

.card-panel {
    background: #fff;
    border-radius: 14px;
    padding: 1.25rem;
    box-shadow: 0 2px 12px rgba(0,0,0,.05);
}

/* ---------- Mail list ---------- */
.mail-item {
    background: #fff;
    border: 1px solid #eef0f4;
    border-radius: 10px;
    padding: .8rem 1rem;
    margin-bottom: .5rem;
    cursor: pointer;
    transition: .15s;
}
.mail-item:hover { border-color: var(--brand); box-shadow: 0 2px 10px rgba(79,70,229,.1); }
.mail-item.unread { border-left: 4px solid var(--brand); }
.mail-item .subject { font-weight: 600; }
.mail-item .from { color: var(--muted); font-size: .85rem; }
.mail-item .preview { color: var(--muted); font-size: .85rem; margin-top: .2rem; }
.mail-item .meta { font-size: .78rem; color: var(--muted); white-space: nowrap; }

.email-body { border:1px solid #e5e7eb; border-radius:10px; padding:1rem; max-height:55vh; overflow:auto; background:#fff; }

.toast-container { z-index: 1100; }

@media (max-width: 768px) {
    .sidebar { width: 70px; }
    .sidebar .brand span, .sidebar .nav-link span, .sidebar .sidebar-footer .uname { display: none; }
    .main { margin-left: 70px; }
}
