/* Digital Income School ERP — app styles (on top of Bootstrap 5.3) */
:root {
    --di-primary: #0b3d91;
    --di-primary-2: #1565c0;
    --di-accent: #f5a623;
    --di-bg: #f3f6fb;
    --di-side: #0a2e6e;
    --di-side-text: #c9d6ee;
    --di-radius: 14px;
    --bs-primary: #0b3d91;
    --bs-primary-rgb: 11, 61, 145;
    --bs-link-color: #1565c0;
    --bs-link-color-rgb: 21, 101, 192;
    --bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
    --bs-body-bg: var(--di-bg);
    --bottom-nav-h: 64px;
}
body { font-family: var(--bs-body-font-family); background: var(--di-bg); color: #1d2939; }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { color: #101828; }
.hero h1, .hero .h1, .public-footer, .public-footer .fs-5 { color: #fff; }
:root { --bs-heading-color: #101828; --bs-body-color: #1d2939; }
.btn { border-radius: 10px; background-image: none !important; text-shadow: none !important; }
.btn-primary { --bs-btn-bg: var(--di-primary); --bs-btn-border-color: var(--di-primary); --bs-btn-hover-bg: #082d6b; --bs-btn-hover-border-color: #082d6b; --bs-btn-active-bg: #072558; }
.btn-outline-primary { --bs-btn-color: var(--di-primary); --bs-btn-border-color: var(--di-primary); --bs-btn-hover-bg: var(--di-primary); --bs-btn-hover-border-color: var(--di-primary); }
.text-primary { color: var(--di-primary) !important; }
.bg-primary { background-color: var(--di-primary) !important; }
.form-control, .form-select { border-radius: 10px; min-height: 42px; }
.form-label { font-weight: 600; font-size: .875rem; color: #344054; }
.card { border: 0; border-radius: var(--di-radius); box-shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.04); }
.card-header { background: #fff; border-bottom: 1px solid #eef1f6; font-weight: 600; border-radius: var(--di-radius) var(--di-radius) 0 0 !important; }
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: #667085; font-weight: 600; border-bottom-width: 1px; white-space: nowrap; }
.table td { vertical-align: middle; }
.alert { border-radius: 12px; }
.badge { font-weight: 600; }

/* ---------- Admin shell ---------- */
.sidebar { position: fixed; inset: 0 auto 0 0; width: 252px; background: var(--di-side); color: var(--di-side-text); flex-direction: column; overflow-y: auto; z-index: 1030; }
.sidebar-offcanvas { background: var(--di-side); color: var(--di-side-text); width: 280px !important; }
.brand { display: flex; align-items: center; gap: .65rem; padding: 1.1rem 1.1rem; color: #fff; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand img { height: 38px; width: 38px; object-fit: contain; background: #fff; border-radius: 10px; padding: 2px; }
.brand-name { font-weight: 700; line-height: 1.15; font-size: .98rem; }
.brand-mark { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--di-accent); color: #fff; font-size: 1.1rem; flex-shrink: 0; }
.side-nav { padding: .5rem .6rem 2rem; }
.side-group { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; opacity: .55; padding: 1rem .75rem .35rem; }
.side-link { display: flex; align-items: center; gap: .75rem; padding: .62rem .75rem; border-radius: 10px; color: var(--di-side-text); text-decoration: none; font-size: .92rem; }
.side-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.side-link.active { background: rgba(255,255,255,.14); color: #fff; font-weight: 600; }
.side-link i { opacity: .85; }
.main-wrap { min-height: 100vh; display: flex; flex-direction: column; }
@media (min-width: 992px) { .main-wrap { margin-left: 252px; } }
.topbar { position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .5rem; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); padding: .6rem 1rem; border-bottom: 1px solid #e7ebf2; min-height: 60px; }
.page-title { font-size: 1.1rem; font-weight: 700; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-icon { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 12px; color: #344054; }
.btn-icon:hover { background: #eef2f8; }
.btn-user { display: flex; align-items: center; gap: .5rem; border: 0; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--di-primary); color: #fff; display: inline-grid; place-items: center; font-weight: 700; font-size: .9rem; }
.content { flex: 1; padding: 1rem; }
@media (min-width: 768px) { .content { padding: 1.5rem; } }
@media (max-width: 991.98px) { .admin-body { padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom)); } }

.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: #fff; border-top: 1px solid #e7ebf2; display: flex; z-index: 1030; box-shadow: 0 -4px 16px rgba(16,24,40,.06); }
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: #667085; text-decoration: none; font-size: .7rem; font-weight: 600; }
.bottom-nav a i { font-size: 1.15rem; }
.bottom-nav a.active { color: var(--di-primary); }

/* ---------- Components ---------- */
.stat-card { padding: 1rem; display: flex; flex-direction: column; gap: .6rem; align-items: flex-start; height: 100%; }
@media (min-width: 768px) { .stat-card { flex-direction: row; align-items: center; gap: .85rem; } }
.min-w-0 { min-width: 0; }
.stat-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.15rem; flex-shrink: 0; }
.stat-value { font-size: 1.35rem; font-weight: 800; line-height: 1.1; }
.stat-label { font-size: .78rem; color: #667085; font-weight: 600; }
.ic-blue { background: #e6efff; color: #1d4ed8; } .ic-green { background: #e3f8ee; color: #15803d; }
.ic-orange { background: #fff1e0; color: #c2410c; } .ic-purple { background: #f1e8ff; color: #7e22ce; }
.ic-red { background: #ffe8e8; color: #b91c1c; } .ic-teal { background: #e0f7f6; color: #0f766e; }
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.toolbar .form-control, .toolbar .form-select { max-width: 220px; }
@media (max-width: 575.98px) { .toolbar .form-control, .toolbar .form-select { max-width: none; flex: 1 1 140px; } }
.empty-state { text-align: center; padding: 2.5rem 1rem; color: #667085; }
.empty-state i { font-size: 2rem; opacity: .4; margin-bottom: .5rem; display: block; }
.kv dt { font-size: .75rem; color: #667085; font-weight: 600; text-transform: uppercase; }
.kv dd { margin-bottom: .75rem; }
.bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 150px; padding-top: 10px; }
.bar-chart .bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bar-chart .bar span.fill { width: 100%; max-width: 38px; background: linear-gradient(180deg, var(--di-primary-2), var(--di-primary)); border-radius: 8px 8px 3px 3px; min-height: 3px; }
.bar-chart .bar small { font-size: .7rem; color: #667085; margin-top: 4px; }
.att-row .btn-check + .btn { min-width: 42px; }
.sticky-actions { position: sticky; bottom: 0; z-index: 10; background: #fff; padding: .75rem 1rem; border-top: 1px solid #eef1f6; border-radius: 0 0 var(--di-radius) var(--di-radius); }
@media (max-width: 991.98px) { .sticky-actions { bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom)); } }

/* Mobile list cards: tables become stacked cards on small screens */
@media (max-width: 767.98px) {
    .table-cards thead { display: none; }
    .table-cards tr { display: block; padding: .75rem 1rem; border-bottom: 1px solid #eef1f6; }
    .table-cards td { display: flex; justify-content: space-between; gap: 1rem; border: 0; padding: .2rem 0; text-align: right; }
    .table-cards td::before { content: attr(data-label); font-weight: 600; color: #667085; font-size: .78rem; text-align: left; }
    .table-cards td.td-actions { justify-content: flex-end; padding-top: .5rem; }
    .table-cards td.td-actions::before { content: none; }
}

/* ---------- Footer credit ---------- */
.app-footer { text-align: center; font-size: .82rem; color: #667085; padding: 1rem; }
.di-brand { text-decoration: none; font-weight: 700; }
.di-digital { color: #1565c0; } .di-income { color: #d32f2f; }
.public-footer .app-footer { color: rgba(255,255,255,.75); border-top: 1px solid rgba(255,255,255,.1); }
.public-footer .di-digital { color: #64b5f6; } .public-footer .di-income { color: #ff6b6b; }

/* ---------- Auth ---------- */
.auth-body { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1rem; background: linear-gradient(160deg, #0b3d91 0%, #1565c0 55%, #e9f0fb 55%); }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 20px; padding: 2rem 1.5rem; box-shadow: 0 20px 50px rgba(11,61,145,.18); }
.auth-body .app-footer { color: #475467; }

/* ---------- Public site ---------- */
.public-body { background: #fff; }
.public-nav { background: #fff; box-shadow: 0 1px 0 #eef1f6; }
.public-nav .nav-link { font-weight: 600; color: #344054; }
.public-nav .nav-link.active, .public-nav .nav-link:hover { color: var(--di-primary); }
.hero { background: linear-gradient(135deg, #0b3d91, #1565c0); color: #fff; padding: 4.5rem 0 4rem; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -120px; top: -120px; width: 380px; height: 380px; border-radius: 50%; background: rgba(255,255,255,.06); }
.hero h1 { font-weight: 800; font-size: clamp(1.8rem, 4vw, 3rem); }
.section { padding: 3.5rem 0; }
.section-alt { background: var(--di-bg); }
.feature { padding: 1.5rem; border-radius: var(--di-radius); background: #fff; box-shadow: 0 1px 3px rgba(16,24,40,.08); height: 100%; }
.feature i { font-size: 1.5rem; color: var(--di-primary); }
.public-footer { background: #071f4d; color: #fff; }
.cms-content img { max-width: 100%; height: auto; }

/* ---------- Print ---------- */
.print-body { background: #fff; }
.print-sheet { max-width: 820px; margin: 0 auto; padding: 1.5rem; }
.print-head { display: flex; gap: 1rem; align-items: center; border-bottom: 2px solid #222; padding-bottom: .75rem; margin-bottom: 1rem; }
.print-logo { height: 64px; }
.print-actions { max-width: 820px; margin: 1rem auto 0; display: flex; gap: .5rem; padding: 0 1.5rem; }
@media print {
    .no-print, .sidebar, .topbar, .bottom-nav, .app-footer { display: none !important; }
    .print-sheet { padding: 0; }
    body { background: #fff; }
}
.public-nav .navbar-brand { max-width: calc(100% - 64px); min-width: 0; margin-right: .5rem; }
.public-nav .navbar-brand > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.public-nav .navbar-brand img, .public-nav .brand-mark { flex-shrink: 0; }
@media (max-width: 575.98px) { .public-nav .navbar-brand { font-size: 1rem; } }
