/* =====================================================================
   AIIC Admin — Theme
   Deep green #0B6E4F + Gold #C9A227
   ===================================================================== */
:root {
    --brand: #0B6E4F;
    --brand-dark: #07513A;
    --brand-darker: #053D2C;
    --brand-light: #E6F2EE;
    --gold: #C9A227;
    --gold-dark: #A8861C;
    --gold-light: #FBF4DC;
    --sidebar-w: 264px;
    --sidebar-mini-w: 78px;
    --topbar-h: 70px;
    --radius: 14px;
    --app-bg: #F4F7F5;
    --card-bg: #FFFFFF;
    --card-border: #E8EEEB;
    --shadow-sm: 0 1px 2px rgba(16, 40, 30, .04), 0 2px 8px rgba(16, 40, 30, .05);
    --shadow-md: 0 8px 24px rgba(16, 40, 30, .10);
    --bs-body-font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --bs-primary: var(--brand);
    --bs-primary-rgb: 11, 110, 79;
    --bs-link-color: var(--brand);
    --bs-link-hover-color: var(--brand-dark);
}

[data-bs-theme="dark"] {
    --app-bg: #0E1512;
    --card-bg: #151F1B;
    --card-border: #22302A;
    --brand-light: rgba(11, 110, 79, .22);
    --gold-light: rgba(201, 162, 39, .15);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, .4);
    --bs-body-bg: #0E1512;
    --bs-link-color: #4FBF96;
}

body {
    font-family: var(--bs-body-font-family);
    background: var(--app-bg);
    font-size: .925rem;
}

.text-brand { color: var(--brand) !important; }
[data-bs-theme="dark"] .text-brand { color: #4FBF96 !important; }
.text-gold { color: var(--gold) !important; }
.link-brand { color: var(--brand); }
[data-bs-theme="dark"] .link-brand { color: #4FBF96; }

/* ---------------- Buttons ---------------- */
.btn-brand {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--brand-dark);
    --bs-btn-hover-border-color: var(--brand-dark);
    --bs-btn-active-bg: var(--brand-darker);
    --bs-btn-active-color: #fff;
    font-weight: 500;
    box-shadow: 0 4px 14px rgba(11, 110, 79, .25);
}
.btn-outline-brand {
    --bs-btn-color: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--brand);
    --bs-btn-hover-border-color: var(--brand);
    --bs-btn-active-bg: var(--brand-dark);
    --bs-btn-active-color: #fff;
}
[data-bs-theme="dark"] .btn-outline-brand { --bs-btn-color: #4FBF96; --bs-btn-border-color: #2F8E6B; }
.btn-gold {
    --bs-btn-color: #2B2105;
    --bs-btn-bg: var(--gold);
    --bs-btn-border-color: var(--gold);
    --bs-btn-hover-color: #1A1403;
    --bs-btn-hover-bg: #D9B43A;
    --bs-btn-hover-border-color: #D9B43A;
    --bs-btn-active-bg: var(--gold-dark);
    font-weight: 600;
}
.btn-light-glass {
    color: #fff;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .25);
    backdrop-filter: blur(4px);
}
.btn-light-glass:hover { color: #fff; background: rgba(255, 255, 255, .22); }
.btn-icon {
    width: 40px; height: 40px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 10px;
    border: 1px solid var(--card-border);
    background: var(--card-bg);
    color: var(--bs-body-color);
    font-size: 1.15rem;
}
.btn-icon:hover { background: var(--brand-light); color: var(--brand); }

/* ---------------- Layout ---------------- */
.app-wrapper { display: flex; min-height: 100vh; }
.app-main {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    transition: margin-left .25s ease;
}
.app-content { flex: 1; padding: 1.5rem; }
@media (min-width: 1400px) { .app-content { padding: 1.75rem 2rem; } }

/* ---------------- Sidebar ---------------- */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--brand-darker) 0%, var(--brand-dark) 55%, var(--brand) 140%);
    color: rgba(255, 255, 255, .8);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: width .25s ease, transform .25s ease;
    overflow: hidden;
}
.sidebar::after { /* subtle geometric pattern */
    content: "";
    position: absolute; inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Cpath d='M30 0l8.8 21.2L60 30l-21.2 8.8L30 60l-8.8-21.2L0 30l21.2-8.8z' fill='none' stroke='%23ffffff' stroke-opacity='.04'/%3E%3C/svg%3E");
    pointer-events: none;
}
.sidebar-brand {
    display: flex; align-items: center; gap: .75rem;
    height: var(--topbar-h);
    padding: 0 1.25rem;
    color: #fff; text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    flex-shrink: 0;
    position: relative; z-index: 1;
}
.sidebar-brand img { width: 42px; height: 42px; border-radius: 12px; background: #fff; padding: 3px; flex-shrink: 0; }
.sidebar-brand .brand-text { display: flex; flex-direction: column; line-height: 1.15; white-space: nowrap; }
.sidebar-brand strong { font-size: 1.2rem; letter-spacing: .5px; }
.sidebar-brand small { color: var(--gold); font-size: .72rem; letter-spacing: .5px; text-transform: uppercase; }
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: .75rem .75rem 1.5rem;
    position: relative; z-index: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .15) transparent;
}
.nav-heading {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255, 255, 255, .4);
    padding: 1.1rem .85rem .4rem;
    white-space: nowrap;
}
.sidebar .nav-link {
    display: flex; align-items: center; gap: .8rem;
    padding: .65rem .85rem;
    margin-bottom: 2px;
    border-radius: 10px;
    color: rgba(255, 255, 255, .78);
    font-weight: 400;
    white-space: nowrap;
    position: relative;
    transition: background .15s, color .15s;
}
.sidebar .nav-link > .bi:first-child { font-size: 1.1rem; width: 22px; text-align: center; flex-shrink: 0; }
.sidebar .nav-link .caret { margin-left: auto; font-size: .75rem; transition: transform .2s; }
.sidebar .nav-link:not(.collapsed).has-children .caret { transform: rotate(180deg); }
.sidebar .nav-link:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.sidebar .nav-link.active { background: rgba(255, 255, 255, .12); color: #fff; font-weight: 500; }
.sidebar .nav-link.active::before {
    content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px;
    width: 4px; border-radius: 0 4px 4px 0; background: var(--gold);
}
.sidebar .nav-link.active > .bi:first-child { color: var(--gold); }
.sub-nav { padding: .2rem 0 .4rem 2.6rem; }
.sub-nav a {
    display: block;
    padding: .42rem .75rem;
    font-size: .85rem;
    color: rgba(255, 255, 255, .65);
    text-decoration: none;
    border-radius: 8px;
    position: relative;
    white-space: nowrap;
}
.sub-nav a::before {
    content: ""; position: absolute; left: -.9rem; top: 50%;
    width: 6px; height: 6px; border-radius: 50%;
    background: rgba(255, 255, 255, .25); transform: translateY(-50%);
}
.sub-nav a:hover, .sub-nav a.active { color: #fff; background: rgba(255, 255, 255, .06); }
.sub-nav a.active::before { background: var(--gold); }
.sidebar-footer {
    padding: .9rem 1.25rem;
    font-size: .75rem;
    color: rgba(255, 255, 255, .45);
    border-top: 1px solid rgba(255, 255, 255, .08);
    white-space: nowrap;
    position: relative; z-index: 1;
}
.sidebar-backdrop { display: none; }

/* Collapsed (desktop mini) */
@media (min-width: 992px) {
    body.sidebar-collapsed .sidebar { width: var(--sidebar-mini-w); }
    body.sidebar-collapsed .app-main { margin-left: var(--sidebar-mini-w); }
    body.sidebar-collapsed .sidebar .brand-text,
    body.sidebar-collapsed .sidebar .nav-link span,
    body.sidebar-collapsed .sidebar .caret,
    body.sidebar-collapsed .sidebar .sub-nav,
    body.sidebar-collapsed .sidebar-footer { display: none !important; }
    body.sidebar-collapsed .sidebar .nav-heading { font-size: 0; padding: .6rem 0; border-top: 1px solid rgba(255, 255, 255, .08); margin: .5rem .5rem 0; }
    body.sidebar-collapsed .sidebar .nav-link { justify-content: center; padding: .7rem; }
    body.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 0; }
    /* Hover to expand */
    body.sidebar-collapsed .sidebar:hover { width: var(--sidebar-w); box-shadow: var(--shadow-md); }
    body.sidebar-collapsed .sidebar:hover .brand-text,
    body.sidebar-collapsed .sidebar:hover .nav-link span,
    body.sidebar-collapsed .sidebar:hover .caret { display: inline !important; }
    body.sidebar-collapsed .sidebar:hover .brand-text { display: flex !important; }
    body.sidebar-collapsed .sidebar:hover .sub-nav { display: block !important; }
    body.sidebar-collapsed .sidebar:hover .nav-link { justify-content: flex-start; padding: .65rem .85rem; }
    body.sidebar-collapsed .sidebar:hover .sidebar-brand { justify-content: flex-start; padding: 0 1.25rem; }
    body.sidebar-collapsed .sidebar:hover .nav-heading { font-size: .68rem; padding: 1.1rem .85rem .4rem; border: 0; margin: 0; }
}

/* Mobile: off-canvas */
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .app-main { margin-left: 0; }
    body.sidebar-open .sidebar { transform: translateX(0); box-shadow: var(--shadow-md); }
    body.sidebar-open .sidebar-backdrop {
        display: block; position: fixed; inset: 0;
        background: rgba(0, 0, 0, .45); z-index: 1035;
    }
    .app-content { padding: 1rem; }
}

/* ---------------- Topbar ---------------- */
.topbar {
    position: sticky; top: 0; z-index: 1020;
    height: var(--topbar-h);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 1.5rem;
    background: color-mix(in srgb, var(--card-bg) 88%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--card-border);
}
.topbar-title { font-size: 1.1rem; font-weight: 600; margin: 0; }
.topbar .breadcrumb { font-size: .78rem; --bs-breadcrumb-divider-color: var(--bs-secondary-color); }
.topbar .breadcrumb a { color: var(--bs-secondary-color); text-decoration: none; }
.topbar .breadcrumb-item.active { color: var(--brand); }
[data-bs-theme="dark"] .topbar .breadcrumb-item.active { color: #4FBF96; }
.topbar-date {
    align-items: center;
    font-size: .8rem;
    padding: .5rem .9rem;
    border-radius: 10px;
    background: var(--brand-light);
    color: var(--brand);
    font-weight: 500;
}
[data-bs-theme="dark"] .topbar-date { color: #7FD3B3; }
.user-chip {
    display: flex; align-items: center; gap: .6rem;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: .3rem .7rem .3rem .3rem;
    background: var(--card-bg);
}
.user-chip::after { margin-left: .3rem; }
.avatar { width: 36px; height: 36px; border-radius: 10px; object-fit: cover; }
.avatar-sm { width: 32px; height: 32px; font-size: .75rem !important; }
.avatar-initials {
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    color: #fff; font-weight: 600; font-size: .85rem;
    flex-shrink: 0;
}
.dropdown-menu { border-radius: 12px; padding: .5rem; }
.dropdown-item { border-radius: 8px; padding: .5rem .75rem; }

/* ---------------- Footer ---------------- */
.app-footer {
    display: flex; justify-content: space-between;
    padding: 1rem 1.5rem;
    font-size: .8rem;
    color: var(--bs-secondary-color);
    border-top: 1px solid var(--card-border);
}

/* ---------------- Cards ---------------- */
.card-soft {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.card-header-soft {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    flex-wrap: wrap;
    padding: 1.1rem 1.35rem;
    border-bottom: 1px solid var(--card-border);
}
.card-header-soft h5 { font-size: 1rem; font-weight: 600; }
.border-alert { border-top: 3px solid var(--bs-danger); }

/* Welcome banner */
.welcome-banner {
    position: relative;
    overflow: hidden;
    border-radius: calc(var(--radius) + 4px);
    padding: 1.75rem 1.75rem 1.25rem;
    background: linear-gradient(120deg, var(--brand-darker) 0%, var(--brand) 70%, #12895F 100%);
    box-shadow: 0 12px 30px rgba(11, 110, 79, .25);
}
.welcome-pattern {
    position: absolute; inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='none' stroke='%23C9A227' stroke-opacity='.18'%3E%3Cpath d='M40 4l10 26 26 10-26 10-10 26-10-26L4 40l26-10z'/%3E%3Ccircle cx='40' cy='40' r='12'/%3E%3C/g%3E%3C/svg%3E");
    mask-image: linear-gradient(90deg, transparent 20%, #000 90%);
    -webkit-mask-image: linear-gradient(90deg, transparent 20%, #000 90%);
}
.welcome-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.1rem;
    border-top: 1px solid rgba(255, 255, 255, .15);
}
.welcome-stats span { display: block; font-size: .75rem; color: rgba(255, 255, 255, .6); }
.welcome-stats strong { color: #fff; font-weight: 600; font-size: 1rem; }
@media (max-width: 767.98px) { .welcome-stats { grid-template-columns: repeat(2, 1fr); } }

/* Stat cards */
.stat-card {
    display: block;
    height: 100%;
    padding: 1.2rem 1.25rem;
    border-radius: var(--radius);
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-sm);
    color: inherit;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease;
}
.stat-card::after {
    content: ""; position: absolute; right: -30px; bottom: -30px;
    width: 110px; height: 110px; border-radius: 50%;
    background: var(--accent); opacity: .07;
    transition: transform .3s;
}
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); color: inherit; }
.stat-card:hover::after { transform: scale(1.3); }
.stat-label { font-size: .8rem; color: var(--bs-secondary-color); font-weight: 500; }
.stat-icon {
    width: 42px; height: 42px; border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 13%, transparent);
}
.stat-value { font-size: 1.45rem; font-weight: 700; letter-spacing: -.3px; margin-bottom: .2rem; white-space: nowrap; }
.stat-sub { font-size: .75rem; color: var(--bs-secondary-color); }
.stat-green  { --accent: #0B6E4F; }
.stat-blue   { --accent: #2563EB; }
.stat-gold   { --accent: #C9A227; }
.stat-orange { --accent: #EA7317; }
.stat-red    { --accent: #DC3545; }
.stat-teal   { --accent: #0D9488; }
[data-bs-theme="dark"] .stat-green { --accent: #34B88A; }
@media (min-width: 1400px) and (max-width: 1699.98px) { .stat-value { font-size: 1.2rem; } }

/* Charts */
.chart-box { position: relative; width: 100%; }
.chart-lg { height: 330px; }
.chart-md { height: 300px; }
.chart-donut { height: 230px; }
.donut-center {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    pointer-events: none;
}
.donut-center strong { font-size: 1.8rem; font-weight: 700; line-height: 1; }
.donut-center span { font-size: .75rem; color: var(--bs-secondary-color); }
.mini-stat {
    padding: .6rem .3rem;
    border-radius: 10px;
    background: var(--app-bg);
    display: flex; flex-direction: column; align-items: center;
}
.mini-stat strong { font-size: 1.1rem; }
.mini-stat small { color: var(--bs-secondary-color); font-size: .72rem; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-bottom: .25rem; }

/* Tables & lists */
.table-soft { --bs-table-bg: transparent; }
.table-soft thead th {
    font-size: .72rem; text-transform: uppercase; letter-spacing: .6px;
    color: var(--bs-secondary-color); font-weight: 600;
    background: var(--app-bg);
    border-bottom: 0;
    padding: .7rem 1rem;
}
.table-soft td { padding: .75rem 1rem; border-color: var(--card-border); }
.card-soft .list-group-item { background: transparent; border-color: var(--card-border); padding-left: 1.35rem; padding-right: 1.35rem; }
.bg-brand-soft { background: var(--brand-light); color: var(--brand); font-weight: 500; }
[data-bs-theme="dark"] .bg-brand-soft { color: #7FD3B3; }
.table-soft td small { white-space: nowrap; }
.cat-dot {
    width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent);
}
.defaulter-item {
    display: flex; justify-content: space-between; align-items: center; gap: .75rem;
    padding: .7rem 0;
    border-bottom: 1px dashed var(--card-border);
}
.defaulter-item:last-of-type { border-bottom: 0; }

/* Filter bar */
.filter-bar { padding: 1rem 1.35rem; border-bottom: 1px solid var(--card-border); background: color-mix(in srgb, var(--app-bg) 60%, transparent); }
.filter-bar .form-label { margin-bottom: .25rem; color: var(--bs-secondary-color); }
.badge-status { font-weight: 500; padding: .4em .75em; font-size: .72rem; vertical-align: middle; }

/* Forms */
.form-control, .form-select { border-radius: 10px; border-color: var(--card-border); }
.form-control:focus, .form-select:focus, .form-check-input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 .2rem rgba(11, 110, 79, .15);
}
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }

/* DataTables tweaks (used in later modules) */
.pagination {
    --bs-pagination-active-bg: var(--brand); --bs-pagination-active-border-color: var(--brand);
    --bs-pagination-color: var(--brand); --bs-pagination-hover-color: var(--brand-dark);
    --bs-pagination-focus-box-shadow: 0 0 0 .2rem rgba(11,110,79,.15); --bs-pagination-border-radius: 8px;
}
div.dt-container .dt-buttons .btn { border-radius: 8px !important; margin-right: .35rem; }
div.dt-container .dt-search input { border-radius: 10px; min-width: 220px; }

/* SweetAlert2 */
.swal2-popup { border-radius: 16px !important; font-family: var(--bs-body-font-family) !important; }
[data-bs-theme="dark"] .swal2-popup { background: var(--card-bg) !important; color: #dee2e6 !important; }
[data-bs-theme="dark"] .swal2-title, [data-bs-theme="dark"] .swal2-html-container { color: #dee2e6 !important; }

/* =====================================================================
   Auth pages (login / forgot / reset)
   ===================================================================== */
.auth-body { background: var(--card-bg); }
.auth-wrapper { display: flex; min-height: 100vh; }
.auth-brand {
    flex: 1.1;
    position: relative;
    overflow: hidden;
    flex-direction: column;
    justify-content: center;
    padding: 3rem 4rem;
    background: radial-gradient(circle at 20% 10%, #12895F 0%, transparent 45%),
                linear-gradient(150deg, var(--brand-darker) 0%, var(--brand-dark) 50%, var(--brand) 100%);
}
.auth-pattern {
    position: absolute; inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%23C9A227' stroke-opacity='.13'%3E%3Cpath d='M60 6l15 39 39 15-39 15-15 39-15-39L6 60l39-15z'/%3E%3Crect x='38' y='38' width='44' height='44' transform='rotate(45 60 60)'/%3E%3Ccircle cx='60' cy='60' r='16'/%3E%3C/g%3E%3C/svg%3E");
}
.auth-brand-inner { position: relative; z-index: 1; }
.auth-logo { width: 64px; height: 64px; border-radius: 16px; background: #fff; padding: 5px; box-shadow: 0 8px 20px rgba(0, 0, 0, .2); }
.auth-arabic { font-size: 1.6rem; color: var(--gold); font-family: 'Amiri', 'Traditional Arabic', serif; direction: rtl; text-align: left; }
.auth-feature {
    display: flex; align-items: center; gap: .6rem;
    padding: .8rem 1rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .12);
    color: #fff; font-size: .85rem;
}
.auth-feature i { color: var(--gold); font-size: 1.1rem; }
.auth-brand-footer { position: absolute; bottom: 1.5rem; left: 4rem; color: rgba(255, 255, 255, .5); font-size: .8rem; z-index: 1; }
.auth-form-side {
    flex: 1;
    display: flex; align-items: center; justify-content: center;
    padding: 2rem 1.25rem;
    position: relative;
    background: var(--card-bg);
}
.auth-theme { position: absolute; top: 1.25rem; right: 1.25rem; }
.auth-card { width: 100%; max-width: 420px; }
.auth-input .input-group-text { background: var(--app-bg); border-color: var(--card-border); color: var(--bs-secondary-color); border-radius: 12px 0 0 12px; }
.auth-input .form-control { font-size: 1rem; }
.auth-input > :last-child:not(.invalid-feedback), .auth-input > .form-control:nth-last-child(2) { border-radius: 0 12px 12px 0; }
.auth-icon {
    width: 56px; height: 56px; border-radius: 16px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.6rem; color: var(--brand); background: var(--brand-light);
}
.demo-box {
    font-size: .8rem;
    padding: .85rem 1rem;
    border-radius: 12px;
    background: var(--gold-light);
    border: 1px dashed var(--gold);
    color: var(--bs-body-color);
}

/* ---------------- Print ---------------- */
@media print {
    .sidebar, .topbar, .app-footer, .btn, .welcome-banner .btn { display: none !important; }
    .app-main { margin-left: 0 !important; }
    .card-soft, .stat-card { box-shadow: none !important; break-inside: avoid; }
}

/* =====================================================================
   Module 2 — Students, Classes, Attendance
   ===================================================================== */
/* Photo upload */
.photo-upload { position: relative; width: 140px; height: 140px; margin: 0 auto; }
.photo-upload img, .photo-placeholder {
    width: 140px; height: 140px; border-radius: 24px; object-fit: cover;
    border: 4px solid var(--card-bg); box-shadow: var(--shadow-md);
}
.photo-placeholder {
    display: flex; align-items: center; justify-content: center;
    font-size: 4rem; color: var(--brand); background: var(--brand-light);
}
.photo-upload img:not(.d-none) + .photo-placeholder { display: none; }
.photo-btn {
    position: absolute; right: -6px; bottom: -6px;
    width: 40px; height: 40px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    background: var(--gold); color: #2B2105; cursor: pointer;
    border: 3px solid var(--card-bg); transition: transform .15s;
}
.photo-btn:hover { transform: scale(1.08); }
.roll-chip {
    display: flex; flex-direction: column; align-items: center;
    padding: .8rem; border-radius: 12px;
    background: var(--brand-light); border: 1px dashed var(--brand);
}
.roll-chip span { font-size: .72rem; text-transform: uppercase; letter-spacing: 1px; color: var(--bs-secondary-color); }
.roll-chip strong { font-size: 1.25rem; color: var(--brand); letter-spacing: .5px; }
[data-bs-theme="dark"] .roll-chip strong { color: #7FD3B3; }
.roll-chip small { font-size: .7rem; color: var(--bs-secondary-color); }
.net-fee {
    height: 38px; display: flex; align-items: center; padding: 0 .9rem;
    border-radius: 10px; background: var(--gold-light); font-weight: 700; font-size: 1.05rem;
}

/* Profile */
.profile-cover {
    height: 110px;
    background: linear-gradient(120deg, var(--brand-darker), var(--brand) 70%, #12895F);
    position: relative;
}
.profile-cover::after {
    content: ""; position: absolute; inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Cpath d='M30 3l7.5 19.5L57 30l-19.5 7.5L30 57l-7.5-19.5L3 30l19.5-7.5z' fill='none' stroke='%23C9A227' stroke-opacity='.2'/%3E%3C/svg%3E");
}
.profile-photo { margin-top: -50px; position: relative; z-index: 1; }
.profile-photo .avatar { width: 110px; height: 110px; border-radius: 24px; border: 5px solid var(--card-bg); font-size: 2.2rem; box-shadow: var(--shadow-md); }
.nav-tabs-soft { border-bottom: 1px solid var(--card-border); gap: .25rem; }
.nav-tabs-soft .nav-link {
    border: 0; border-bottom: 3px solid transparent; color: var(--bs-secondary-color);
    font-weight: 500; padding: .75rem 1rem; background: none;
}
.nav-tabs-soft .nav-link.active { color: var(--brand); border-bottom-color: var(--brand); background: none; }
[data-bs-theme="dark"] .nav-tabs-soft .nav-link.active { color: #7FD3B3; border-bottom-color: #34B88A; }
.section-title {
    font-size: .75rem; text-transform: uppercase; letter-spacing: 1px;
    color: var(--bs-secondary-color); font-weight: 600;
    padding-bottom: .6rem; margin-bottom: 1rem; border-bottom: 1px solid var(--card-border);
}
.detail-list dt { font-weight: 400; color: var(--bs-secondary-color); margin-bottom: .7rem; }
.detail-list dd { font-weight: 500; margin-bottom: .7rem; }

/* Attendance calendar */
.att-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.att-head { text-align: center; font-size: .72rem; color: var(--bs-secondary-color); font-weight: 600; }
.att-day {
    aspect-ratio: 1.6; display: flex; align-items: center; justify-content: center;
    border-radius: 8px; font-size: .8rem; font-weight: 500;
    background: var(--app-bg); color: var(--bs-secondary-color);
}
.att-present { background: #D1F2E4 !important; color: #0B6E4F !important; }
.att-late    { background: #FFF1C7 !important; color: #8A6A00 !important; }
.att-leave   { background: #D6ECFA !important; color: #0B5C8A !important; }
.att-absent  { background: #FBD9DC !important; color: #B4232F !important; }
.att-future  { opacity: .35; }
[data-bs-theme="dark"] .att-present { background: rgba(52,184,138,.2) !important; color: #7FD3B3 !important; }
[data-bs-theme="dark"] .att-late    { background: rgba(242,201,76,.18) !important; color: #F2C94C !important; }
[data-bs-theme="dark"] .att-leave   { background: rgba(80,170,230,.18) !important; color: #8CCBF2 !important; }
[data-bs-theme="dark"] .att-absent  { background: rgba(220,53,69,.2) !important; color: #F28B95 !important; }
.legend { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 6px; vertical-align: -1px; }

/* Attendance toggles */
.att-toggle { display: inline-flex; gap: 6px; }
.att-btn {
    width: 40px; height: 34px; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 9px !important; font-size: .8rem; font-weight: 600;
    border: 1px solid var(--card-border); background: var(--card-bg); color: var(--bs-secondary-color);
}
.btn-check:checked + .att-btn-present { background: #0B6E4F; border-color: #0B6E4F; color: #fff; }
.btn-check:checked + .att-btn-absent  { background: #DC3545; border-color: #DC3545; color: #fff; }
.btn-check:checked + .att-btn-late    { background: #E9B500; border-color: #E9B500; color: #2B2105; }
.btn-check:checked + .att-btn-leave   { background: #0EA5E9; border-color: #0EA5E9; color: #fff; }
.att-counter { padding: .35rem .75rem; border-radius: 8px; background: var(--app-bg); font-weight: 600; }

@media print {
    .nav-tabs-soft, .filter-bar { display: none !important; }
    .tab-pane { display: block !important; opacity: 1 !important; margin-bottom: 1.5rem; }
}

/* =====================================================================
   Module 3 — Fees
   ===================================================================== */
.min-w-0 { min-width: 0; }
.avatar-lg { width: 56px; height: 56px; border-radius: 14px; font-size: 1.1rem !important; }
.view-switch { display: inline-flex; padding: 4px; border-radius: 12px; background: var(--card-bg); border: 1px solid var(--card-border); }
.view-switch a { padding: .45rem 1rem; border-radius: 9px; text-decoration: none; color: var(--bs-secondary-color); font-weight: 500; font-size: .875rem; }
.view-switch a.active { background: var(--brand); color: #fff; }

/* Generate */
.scope-pills { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.scope-pill {
    display: flex; flex-direction: column; align-items: center; gap: .15rem; text-align: center;
    padding: .9rem .5rem; border-radius: 12px; cursor: pointer;
    border: 1.5px solid var(--card-border); background: var(--card-bg); transition: all .15s;
}
.scope-pill i { font-size: 1.3rem; color: var(--bs-secondary-color); }
.scope-pill strong { font-size: .85rem; }
.scope-pill small { font-size: .72rem; color: var(--bs-secondary-color); }
.btn-check:checked + .scope-pill { border-color: var(--brand); background: var(--brand-light); }
.btn-check:checked + .scope-pill i { color: var(--brand); }
.result-card { border-top: 3px solid var(--brand); }
.result-icon { width: 46px; height: 46px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.4rem; background: var(--brand-light); color: var(--brand); }

/* Collect */
.search-box { position: relative; }
.search-box i { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--bs-secondary-color); }
.search-box .form-control { padding-left: 2.4rem; height: 44px; }
.student-results { max-height: 470px; overflow-y: auto; margin: 0 -.5rem; padding: 0 .5rem; scrollbar-width: thin; }
.student-result {
    display: flex; align-items: center; gap: .7rem; padding: .55rem .6rem; border-radius: 10px;
    text-decoration: none; color: inherit; border: 1px solid transparent;
}
.student-result:hover { background: var(--app-bg); color: inherit; }
.student-result.active { background: var(--brand-light); border-color: color-mix(in srgb, var(--brand) 40%, transparent); }
.today-box {
    display: flex; justify-content: space-between; padding: 1.1rem 1.25rem; border-radius: var(--radius);
    background: linear-gradient(120deg, var(--brand-darker), var(--brand)); color: #fff;
}
.today-box small { display: block; color: rgba(255,255,255,.65); font-size: .75rem; }
.today-box strong { font-size: 1.25rem; }
.empty-state { text-align: center; padding: 3.5rem 1rem; }
.empty-state > i { font-size: 3rem; color: var(--brand); opacity: .6; display: block; margin-bottom: .75rem; }
.row-off td { opacity: .45; }
.pay-panel { padding: 1.35rem; border-top: 1px solid var(--card-border); background: color-mix(in srgb, var(--app-bg) 55%, transparent); }
.pay-total { padding: .55rem 1rem; border-radius: 12px; background: var(--card-bg); border: 1px solid var(--card-border); }
.pay-total small { display: block; font-size: .75rem; color: var(--bs-secondary-color); }
.pay-total strong { font-size: 1.45rem; color: var(--brand); }
[data-bs-theme="dark"] .pay-total strong { color: #7FD3B3; }
.pay-remaining strong { color: var(--bs-secondary-color); }
.pay-remaining.is-partial { border-color: #F2C94C; background: var(--gold-light); }
.pay-remaining.is-partial strong { color: #A8861C; }
.method-pills { display: flex; flex-wrap: wrap; gap: .35rem; }
.method-pills .btn { border: 1px solid var(--card-border); background: var(--card-bg); border-radius: 9px; font-weight: 500; }
.method-pills .btn-check:checked + .btn { background: var(--brand); border-color: var(--brand); color: #fff; }

/* =====================================================================
   Module 4 — Teachers & Salaries
   ===================================================================== */
.bg-gold-soft { background: var(--gold-light); color: #8A6A00; font-weight: 500; }
[data-bs-theme="dark"] .bg-gold-soft { color: #F2C94C; }
.class-checks { display: flex; flex-wrap: wrap; gap: .4rem; }
.class-checks .btn { border: 1px solid var(--card-border); background: var(--card-bg); border-radius: 9px; }
.class-checks .btn-check:checked + .btn { background: var(--brand); border-color: var(--brand); color: #fff; }
.class-chip {
    display: inline-flex; align-items: center; gap: .35rem; margin: 0 .35rem .45rem 0;
    padding: .35rem .7rem; border-radius: 9px; font-size: .85rem; font-weight: 500;
    background: var(--brand-light); color: var(--brand); text-decoration: none;
}
.class-chip small { background: var(--card-bg); border-radius: 6px; padding: 0 .35rem; color: var(--bs-secondary-color); }
.class-chip.is-ct { background: var(--gold-light); color: #8A6A00; }
[data-bs-theme="dark"] .class-chip { color: #7FD3B3; }
[data-bs-theme="dark"] .class-chip.is-ct { color: #F2C94C; }
.adv-item {
    display: flex; align-items: center; gap: .7rem; padding: .6rem .8rem; margin-bottom: .4rem;
    border-radius: 10px; border: 1px solid var(--card-border); background: var(--gold-light); cursor: pointer;
}
.adv-item .form-check-input { margin: 0; }
.salary-calc { padding: 1.1rem 1.25rem; border-radius: 14px; background: var(--app-bg); border: 1px solid var(--card-border); }
.salary-calc > div:not(.small) { display: flex; justify-content: space-between; padding: .45rem 0; border-bottom: 1px dashed var(--card-border); }
.salary-calc span { color: var(--bs-secondary-color); }
.salary-calc .calc-net { border-bottom: 0 !important; padding-top: .8rem !important; }
.salary-calc .calc-net span { color: var(--bs-body-color); font-weight: 600; }
.salary-calc .calc-net b { font-size: 1.6rem; color: var(--brand); }
[data-bs-theme="dark"] .salary-calc .calc-net b { color: #7FD3B3; }

/* =====================================================================
   Module 5 — Expenses
   ===================================================================== */
.cat-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .5rem; }
.cat-option {
    display: flex; align-items: center; gap: .55rem; padding: .65rem .8rem; border-radius: 10px; cursor: pointer;
    border: 1.5px solid var(--card-border); background: var(--card-bg); font-weight: 500; font-size: .875rem; transition: all .15s;
}
.cat-option:hover { border-color: var(--c); }
.btn-check:checked + .cat-option { border-color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); }
.cat-swatch { width: 12px; height: 12px; border-radius: 4px; background: var(--c); flex-shrink: 0; }
.cat-badge {
    display: inline-flex; align-items: center; gap: .4rem; padding: .25rem .65rem; border-radius: 20px;
    font-size: .78rem; font-weight: 500; white-space: nowrap;
    color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent);
}
.cat-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
[data-bs-theme="dark"] .cat-badge { color: color-mix(in srgb, var(--c) 60%, #fff); }
.cat-row {
    display: flex; align-items: center; gap: .7rem; padding: .6rem .5rem; border-radius: 8px;
    text-decoration: none; color: inherit; border-bottom: 1px dashed var(--card-border);
}
.cat-row:last-child { border-bottom: 0; }
.cat-row:hover { background: var(--app-bg); color: inherit; }
.cat-pct { width: 36px; text-align: right; }
.drop-zone {
    display: flex; align-items: center; justify-content: center; min-height: 190px; padding: 1rem;
    border: 2px dashed var(--card-border); border-radius: 14px; cursor: pointer; overflow: hidden;
    background: var(--app-bg); transition: border-color .15s;
}
.drop-zone:hover { border-color: var(--brand); }
.drop-zone img { max-width: 100%; max-height: 260px; border-radius: 8px; }
.dz-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .2rem; }
.dz-empty i { font-size: 2.4rem; color: var(--brand); }
.dz-empty small { color: var(--bs-secondary-color); }
.color-dot { width: 30px; height: 30px; border-radius: 9px; border: 3px solid var(--card-bg); background: var(--c); box-shadow: 0 0 0 1px var(--card-border); }
.color-dot.active { box-shadow: 0 0 0 2px var(--c); }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); column-gap: 2rem; }
.cat-grid .cat-row:last-child { border-bottom: 1px dashed var(--card-border); }

/* =====================================================================
   Module 6 — Reports
   ===================================================================== */
.report-tabs { gap: .4rem; flex-wrap: wrap; }
.report-tabs .nav-link {
    border-radius: 10px; color: var(--bs-secondary-color); font-weight: 500; padding: .55rem 1rem;
    background: var(--card-bg); border: 1px solid var(--card-border);
}
.report-tabs .nav-link:hover { color: var(--brand); }
.report-tabs .nav-link.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.report-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 1rem; }
.report-head h4 { font-weight: 700; font-size: 1.15rem; }
.print-only { display: none; }
.pl-table td { padding: .65rem 1.35rem; border-color: var(--card-border); background: transparent; }
.pl-table .pl-section td { font-size: .72rem; text-transform: uppercase; letter-spacing: 1px; font-weight: 700; color: var(--bs-secondary-color); background: var(--app-bg); }
.pl-table .pl-total td { font-weight: 700; border-top: 2px solid var(--card-border); }
.pl-table .pl-net td { font-size: 1.15rem; font-weight: 700; color: #fff; }
.pl-table .pl-net.is-profit td { background: var(--brand); }
.pl-table .pl-net.is-loss td { background: #B4232F; }
.pl-table .pl-pct { width: 60px; text-align: right; color: var(--bs-secondary-color); font-size: .8rem; }
.pl-table .pl-net .pl-pct { color: rgba(255,255,255,.8); }

@media print {
    .no-print, .dt-layout-row:first-child, .dt-paging, .dt-info { display: none !important; }
    .print-only { display: block; }
    .app-content { padding: 0 !important; }
    .stat-card { padding: .6rem .8rem !important; }
    .stat-card::after, .stat-icon { display: none !important; }
    .chart-box { height: 220px !important; }
    .card-soft { margin-bottom: .8rem !important; }
    .pl-net td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.table-soft.table-sm td, .table-soft.table-sm th { padding: .5rem .55rem; font-size: .8rem; white-space: nowrap; }

/* =====================================================================
   Module 7 — Settings
   ===================================================================== */
.settings-nav { padding: .5rem; }
.settings-nav a {
    display: flex; align-items: center; gap: .85rem; padding: .75rem .85rem; border-radius: 10px;
    text-decoration: none; color: var(--bs-body-color);
}
.settings-nav a i { font-size: 1.2rem; width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--app-bg); color: var(--bs-secondary-color); flex-shrink: 0; }
.settings-nav a span { display: flex; flex-direction: column; font-weight: 500; line-height: 1.25; }
.settings-nav a small { font-weight: 400; color: var(--bs-secondary-color); font-size: .75rem; }
.settings-nav a:hover { background: var(--app-bg); }
.settings-nav a.active { background: var(--brand-light); }
.settings-nav a.active i { background: var(--brand); color: #fff; }
.logo-box { width: 150px; height: 150px; margin: 0 auto; border-radius: 24px; padding: 10px; border: 2px dashed var(--card-border); background: var(--app-bg); }
.logo-box img { width: 100%; height: 100%; object-fit: contain; border-radius: 16px; }
.role-card { display: flex; gap: .9rem; padding: 1rem 1.1rem; border-radius: var(--radius); background: var(--card-bg); border: 1px solid var(--card-border); height: 100%; }
.role-card > i { font-size: 1.4rem; width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.role-super_admin > i, .role-pill.role-super_admin { color: #0B6E4F; background: var(--brand-light); }
.role-accountant > i, .role-pill.role-accountant { color: #8A6A00; background: var(--gold-light); }
.role-staff > i, .role-pill.role-staff { color: #2563EB; background: rgba(37, 99, 235, .1); }
.role-pill { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .65rem; border-radius: 20px; font-size: .78rem; font-weight: 500; }
.role-options { display: grid; gap: .5rem; }
.role-option { display: grid; grid-template-columns: 34px 1fr; column-gap: .6rem; padding: .65rem .8rem; border-radius: 10px; border: 1.5px solid var(--card-border); cursor: pointer; }
.role-option i { grid-row: span 2; font-size: 1.2rem; color: var(--bs-secondary-color); align-self: center; }
.role-option small { color: var(--bs-secondary-color); font-size: .75rem; }
.btn-check:checked + .role-option { border-color: var(--brand); background: var(--brand-light); }
.btn-check:checked + .role-option i { color: var(--brand); }
.btn-check:disabled + .role-option { opacity: .4; cursor: not-allowed; }
.backup-card { border-top: 3px solid var(--brand); }
.backup-icon { width: 76px; height: 76px; margin: 0 auto; border-radius: 22px; display: flex; align-items: center; justify-content: center; font-size: 2.2rem; color: var(--brand); background: var(--brand-light); }
.backup-tips li { margin-bottom: .5rem; }
