/* Welfare Management System - plain CSS on top of Bootstrap 5 (no build step).
   --brand and --brand-2 come from System Settings (see partials/head). */

:root {
    --brand-dark: color-mix(in srgb, var(--brand) 82%, #000);
    --brand-soft: color-mix(in srgb, var(--brand) 10%, #fff);
    --sidebar-w: 250px;
    --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --bs-link-color: var(--brand);
    --bs-link-hover-color: var(--brand-dark);
    --bs-link-color-rgb: 31, 111, 92;
}

body { background: #f5f7f6; color: #1f2a27; font-size: .95rem; }

.btn-primary {
    --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand-dark); --bs-btn-hover-border-color: var(--brand-dark);
    --bs-btn-active-bg: var(--brand-dark); --bs-btn-active-border-color: var(--brand-dark);
    --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand);
}
.btn-outline-primary {
    --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand);
    --bs-btn-active-bg: var(--brand); --bs-btn-active-border-color: var(--brand);
}
.text-brand { color: var(--brand) !important; }
.bg-brand { background: var(--brand) !important; color: #fff; }
.bg-brand-soft { background: var(--brand-soft) !important; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--brand) 20%, transparent); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.nav-pills .nav-link.active { background: var(--brand); }
.nav-tabs .nav-link.active { color: var(--brand); font-weight: 600; }
.page-link { color: var(--brand); }
.active > .page-link, .page-link.active { background: var(--brand); border-color: var(--brand); }

/* ---------- Admin layout ---------- */
.app-sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: #fff;
    border-right: 1px solid #e3e8e6; overflow-y: auto; z-index: 1040; transition: transform .2s;
}
.app-sidebar .brand { display: flex; align-items: center; gap: .6rem; padding: 1rem 1.1rem; border-bottom: 1px solid #eef1f0; text-decoration: none; color: inherit; }
.app-sidebar .brand img { height: 36px; width: 36px; object-fit: contain; }
.app-sidebar .brand-name { font-weight: 700; font-size: .95rem; line-height: 1.15; }
.sidebar-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: #8a9692; padding: 1rem 1.1rem .3rem; font-weight: 600; }
.sidebar-link { display: flex; align-items: center; gap: .6rem; padding: .45rem 1.1rem; color: #33413d; text-decoration: none; border-left: 3px solid transparent; }
.sidebar-link:hover { background: #f3f6f5; color: var(--brand); }
.sidebar-link.active { background: var(--brand-soft); color: var(--brand); border-left-color: var(--brand); font-weight: 600; }
.sidebar-link i { width: 1.1rem; text-align: center; opacity: .8; }
.sidebar-link .badge { margin-left: auto; }

.app-main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.app-topbar { background: #fff; border-bottom: 1px solid #e3e8e6; padding: .6rem 1.25rem; position: sticky; top: 0; z-index: 1030; }
.app-content { padding: 1.5rem 1.25rem; flex: 1; }
.page-title { font-size: 1.35rem; font-weight: 700; margin: 0; }
.sidebar-backdrop { display: none; }

@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); }
    .app-sidebar.show { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.15); }
    .sidebar-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 1035; }
    .app-main { margin-left: 0; }
    .app-content { padding: 1rem .75rem; }
}

/* ---------- Components ---------- */
.card { border: 1px solid #e3e8e6; border-radius: .6rem; box-shadow: none; }
.card-header { background: #fff; border-bottom: 1px solid #eef1f0; font-weight: 600; padding: .8rem 1rem; }
.stat-card .label { font-size: .78rem; color: #6b7874; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.stat-card .value { font-size: 1.45rem; font-weight: 700; margin-top: .15rem; }
.stat-card .hint { font-size: .8rem; color: #8a9692; }
.table > :not(caption) > * > * { padding: .55rem .65rem; }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: #5f6c68; font-weight: 600; background: #f8faf9; white-space: nowrap; }
.table td { vertical-align: middle; }
.dl-grid { display: grid; grid-template-columns: 170px 1fr; gap: .45rem 1rem; margin: 0; }
.dl-grid dt { color: #6b7874; font-weight: 500; }
.dl-grid dd { margin: 0; }
@media (max-width: 575.98px) { .dl-grid { grid-template-columns: 1fr; gap: .1rem; } .dl-grid dd { margin-bottom: .5rem; } }
.amount { font-variant-numeric: tabular-nums; white-space: nowrap; }
.credit { color: #198754; }
.debit { color: #b02a37; }
.empty-state { text-align: center; color: #8a9692; padding: 2rem 1rem; }
.img-preview { max-height: 90px; max-width: 200px; object-fit: contain; border: 1px solid #e3e8e6; border-radius: .4rem; padding: .25rem; background: #fff; }
.notification-unread { background: var(--brand-soft); }
div.dataTables_wrapper div.dataTables_filter input { margin-left: .4rem; }
div.dataTables_wrapper .row { --bs-gutter-x: .5rem; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem 1rem; }
.auth-card { width: 100%; max-width: 410px; }
.auth-logo { height: 64px; width: auto; }

/* ---------- Printing ---------- */
@media print {
    .app-sidebar, .app-topbar, .no-print, .dataTables_filter, .dataTables_length, .dataTables_paginate, .dataTables_info, .btn { display: none !important; }
    .app-main { margin: 0; }
    .app-content { padding: 0; }
    body { background: #fff; font-size: 11px; }
    .card { border: 0; }
    .print-only { display: block !important; }
}
.print-only { display: none; }
