/* ==========================================================================
   Secure Email Gateway — Admin theme
   Local stylesheet layered on top of Bootstrap 5. No external resources.
   ========================================================================== */

:root {
    --sidebar-bg: #171e2e;
    --sidebar-bg-active: #232c42;
    --sidebar-fg: #aeb9d0;
    --sidebar-fg-active: #ffffff;
    --sidebar-heading: #5f6c86;
    --brand: #4f6ef7;
    --brand-dark: #3f57d6;
    --content-bg: #f4f6fb;
    --card-border: #e9edf5;
    --sidebar-width: 260px;
}

body {
    background: var(--content-bg);
    color: #33384a;
    font-size: 0.925rem;
}

/* ---- Layout shell ------------------------------------------------------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-fg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 1040;
    transition: transform .25s ease;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 1.15rem 1.35rem;
    color: #fff;
    font-weight: 700;
    letter-spacing: .3px;
    border-bottom: 1px solid rgba(255,255,255,.05);
}
.sidebar-brand .logo-badge {
    width: 34px; height: 34px; border-radius: 9px;
    background: linear-gradient(135deg, var(--brand), #8a63f4);
    display: grid; place-items: center; color: #fff;
}

.sidebar-nav { padding: .75rem 0 2rem; }
.sidebar-heading {
    font-size: .68rem; text-transform: uppercase; letter-spacing: .09em;
    color: var(--sidebar-heading); padding: 1rem 1.5rem .35rem; font-weight: 600;
}
.sidebar-nav .nav-link {
    display: flex; align-items: center; gap: .75rem;
    color: var(--sidebar-fg);
    padding: .58rem 1.5rem; font-weight: 500; border-radius: 0;
}
.sidebar-nav .nav-link svg { width: 18px; height: 18px; flex: 0 0 18px; opacity: .85; }
.sidebar-nav .nav-link:hover { color: var(--sidebar-fg-active); background: rgba(255,255,255,.035); }
.sidebar-nav .nav-link.active {
    color: var(--sidebar-fg-active);
    background: var(--sidebar-bg-active);
    box-shadow: inset 3px 0 0 var(--brand);
}
.sidebar-nav .nav-link .badge { margin-left: auto; }

/* ---- Main column -------------------------------------------------------- */
.main-column {
    margin-left: var(--sidebar-width);
    flex: 1; min-width: 0;
    display: flex; flex-direction: column;
}

.topbar {
    background: #fff;
    border-bottom: 1px solid var(--card-border);
    padding: .7rem 1.5rem;
    position: sticky; top: 0; z-index: 1030;
    display: flex; align-items: center; gap: 1rem;
}
.topbar .page-title { font-size: 1.05rem; font-weight: 600; margin: 0; }
.content { padding: 1.5rem; flex: 1; }

/* ---- Cards -------------------------------------------------------------- */
.card { border: 1px solid var(--card-border); border-radius: .7rem; box-shadow: 0 1px 2px rgba(20,30,60,.04); }
.card-header { background: #fff; border-bottom: 1px solid var(--card-border); font-weight: 600; }

.stat-card { border-radius: .7rem; overflow: hidden; }
.stat-card .stat-icon {
    width: 46px; height: 46px; border-radius: 11px;
    display: grid; place-items: center;
}
.stat-card .stat-value { font-size: 1.65rem; font-weight: 700; line-height: 1; }
.stat-card .stat-label { color: #7a869a; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }

.soft-primary { background: rgba(79,110,247,.12); color: var(--brand); }
.soft-success { background: rgba(25,168,110,.13); color: #199a68; }
.soft-danger  { background: rgba(230,74,90,.13);  color: #db4256; }
.soft-warning { background: rgba(240,168,40,.15); color: #cf8a12; }
.soft-info    { background: rgba(40,170,205,.14); color: #1893b4; }
.soft-secondary { background: rgba(120,130,150,.14); color: #64708a; }

/* ---- Tables ------------------------------------------------------------- */
.table-card .table { margin-bottom: 0; }
.table thead th {
    text-transform: uppercase; font-size: .72rem; letter-spacing: .04em;
    color: #8a94a8; font-weight: 600; border-bottom-width: 1px;
}
.table td { vertical-align: middle; }
.table-hover tbody tr:hover { background: #f8fafd; }

.badge.rounded-pill { font-weight: 600; padding: .38em .7em; }

.code-pill {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    background: #eef1f8; border-radius: .4rem; padding: .15rem .45rem; font-size: .82rem;
}

/* ---- Forms -------------------------------------------------------------- */
.form-label { font-weight: 600; font-size: .82rem; color: #4a5266; }
.required-mark { color: #db4256; }
.form-help { font-size: .78rem; color: #8a94a8; }

.btn-brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-brand:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }

/* ---- Auth pages --------------------------------------------------------- */
.auth-wrap {
    min-height: 100vh; display: grid; place-items: center;
    background: radial-gradient(1200px 600px at 20% -10%, #2b3a63 0%, #141a29 55%);
    padding: 1.5rem;
}
.auth-card { width: 100%; max-width: 420px; }
.auth-brand { display:flex; align-items:center; gap:.6rem; justify-content:center; color:#fff; margin-bottom:1.25rem; font-weight:700; font-size:1.15rem; }
.auth-brand .logo-badge { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, var(--brand), #8a63f4); display:grid; place-items:center; }

/* ---- Misc --------------------------------------------------------------- */
.empty-state { text-align: center; padding: 3rem 1rem; color: #9aa4b8; }
.empty-state svg { width: 46px; height: 46px; opacity: .4; margin-bottom: .75rem; }
.breadcrumb { margin-bottom: 0; font-size: .82rem; }
.sidebar-backdrop { display:none; }

/* ---- Responsive --------------------------------------------------------- */
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); }
    .main-column { margin-left: 0; }
    .sidebar-backdrop.show {
        display: block; position: fixed; inset: 0; background: rgba(10,15,25,.5); z-index: 1035;
    }
}
