/* ============================================================
   IO-ERP — base styles (additive on top of Bootstrap 5)
   ============================================================ */

:root {
    --app-sidebar-width: 240px;
    --app-sidebar-bg: #1e293b;
    --app-sidebar-fg: #cbd5e1;
    --app-sidebar-fg-active: #ffffff;
    --app-sidebar-hover: rgba(255, 255, 255, 0.06);
    --app-sidebar-active: rgba(59, 130, 246, 0.18);
    --app-topbar-h: 60px;
    --app-content-bg: #f4f6fa;
}

body {
    background: var(--app-content-bg);
    font-size: 14px;
}

/* ---------- Auth layout ---------- */
.auth-body {
    min-height: 100vh;
    background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
    padding: 1.5rem;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    border: 0;
    border-radius: 14px;
}

.auth-brand {
    width: 64px; height: 64px;
    border-radius: 16px;
    background: linear-gradient(135deg, #4f46e5, #3b82f6);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

/* ---------- App shell ---------- */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: var(--app-sidebar-width);
    background: var(--app-sidebar-bg);
    color: var(--app-sidebar-fg);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 1030;
    transition: transform .25s ease;
}

.app-sidebar__brand {
    height: var(--app-topbar-h);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    font-size: 1.05rem;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.app-sidebar__nav { padding: .75rem 0; }

.app-nav-heading {
    padding: .75rem 1.25rem .25rem;
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #64748b;
}

.app-nav-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .55rem 1.25rem;
    color: var(--app-sidebar-fg);
    text-decoration: none;
    font-size: .88rem;
    border-left: 3px solid transparent;
    transition: background .15s, color .15s;
}

.app-nav-link i { font-size: 1rem; width: 18px; text-align: center; }

.app-nav-link:hover {
    background: var(--app-sidebar-hover);
    color: var(--app-sidebar-fg-active);
}

.app-nav-link.active {
    background: var(--app-sidebar-active);
    color: var(--app-sidebar-fg-active);
    border-left-color: #3b82f6;
    font-weight: 500;
}

/* ---------- Main column ---------- */
.app-main {
    margin-left: var(--app-sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: margin-left .25s ease;
}

.app-topbar {
    height: var(--app-topbar-h);
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.app-content {
    flex: 1;
    padding: 1.5rem;
}

.app-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    background: #fff;
    text-align: center;
}

/* ---------- Avatar ---------- */
.app-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f46e5, #3b82f6);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: .8rem;
}

/* ---------- Stat cards ---------- */
.stat-card .stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

/* ---------- Tables ---------- */
.table thead th {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #475569;
}

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); }
    .app-main { margin-left: 0; }
    body.sidebar-open .app-sidebar { transform: translateX(0); }
}

body.sidebar-collapsed .app-sidebar { transform: translateX(-100%); }
body.sidebar-collapsed .app-main { margin-left: 0; }

/* Bootstrap subtle text-bg helpers used in templates */
.text-bg-success-subtle { background-color: #d1fae5; color: #065f46; }
.text-bg-warning-subtle { background-color: #fef3c7; color: #92400e; }
.text-bg-secondary-subtle { background-color: #e2e8f0; color: #475569; }
