/* ==========================================================================
   WAEC Financial Management System – UI theme (matches the supplied designs)
   ========================================================================== */
:root {
    --fms-navy: #0f2a55;
    --fms-navy-2: #0b2147;
    --fms-blue: #1a6cf0;
    --fms-blue-dark: #1558c7;
    --fms-blue-soft: #eaf2ff;
    --fms-border: #dfe7f3;
    --fms-text: #0b1d3f;
    --fms-muted: #5b6b86;
    --fms-bg: #f5f8fd;
    --fms-green: #16a34a;
    --fms-orange: #f59e0b;
    --fms-red: #dc2626;
    --sidebar-w: 256px;
    --bs-body-font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    --bs-body-color: var(--fms-text);
    --bs-primary: #1a6cf0;
    --bs-primary-rgb: 26, 108, 240;
    --bs-link-color: #1a62d4;
}

body { background: var(--fms-bg); color: var(--fms-text); font-size: .95rem; }
a { text-decoration: none; }
.text-muted, .text-secondary { color: var(--fms-muted) !important; }

/* ---------- layout ---------- */
.app-shell { min-height: 100vh; }
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 1040;
    background: linear-gradient(180deg, #112c58 0%, #0b2147 100%);
    color: #d9e5f8; display: flex; flex-direction: column; overflow-y: auto; transition: transform .2s ease;
}
.sidebar .brand { display: flex; align-items: center; gap: .75rem; padding: 1.1rem 1.25rem 1rem; color: #fff; font-weight: 700; line-height: 1.15; font-size: 1.12rem; }
.sidebar .brand img { width: 42px; height: 42px; border-radius: 10px; background: #fff; padding: 2px; object-fit: contain; }
.sidebar nav { padding: .75rem .65rem 1rem; display: flex; flex-direction: column; gap: .2rem; }
.sidebar nav a {
    display: flex; align-items: center; gap: .85rem; padding: .62rem .85rem; border-radius: 10px;
    color: #d9e5f8; font-size: .95rem; transition: background .15s;
}
.sidebar nav a i { font-size: 1.15rem; width: 1.4rem; text-align: center; opacity: .95; }
.sidebar nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.sidebar nav a.active { background: var(--fms-blue); color: #fff; font-weight: 600; box-shadow: 0 4px 12px rgba(26, 108, 240, .35); }
.sidebar-backdrop { display: none; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
    height: 68px; background: #fff; border-bottom: 1px solid var(--fms-border); display: flex; align-items: center;
    padding: 0 1.5rem; gap: 1rem; position: sticky; top: 0; z-index: 1030;
}
.topbar h2 { font-size: 1.25rem; font-weight: 600; margin: 0; flex: 1; }
.topbar .btn-icon { border: 0; background: transparent; font-size: 1.6rem; color: var(--fms-text); line-height: 1; padding: 0; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--fms-blue); color: #fff; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.user-menu .btn { display: flex; align-items: center; gap: .7rem; text-align: left; border: 0; background: none; padding: .2rem .4rem; }
.user-menu .u-name { font-weight: 600; line-height: 1.1; }
.user-menu .u-role { color: var(--fms-muted); font-size: .85rem; }
.content { padding: 1.35rem 1.5rem 1rem; flex: 1; }
.app-footer { display: flex; justify-content: space-between; padding: 1rem 1.5rem 1.25rem; color: var(--fms-muted); font-size: .85rem; border-top: 1px solid var(--fms-border); margin: 0 1.5rem; }

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    body.sidebar-open .sidebar { transform: none; }
    body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(8, 20, 45, .5); z-index: 1035; }
    .main { margin-left: 0; }
    .content { padding: 1rem; }
    .topbar { padding: 0 1rem; }
    .user-menu .u-meta { display: none; }
}

/* ---------- page header ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { font-size: 2.1rem; font-weight: 800; letter-spacing: -.02em; margin: 0; line-height: 1.15; }
.page-head .sub { color: var(--fms-muted); font-size: 1.1rem; margin-top: .15rem; }
.breadcrumb-lite { color: var(--fms-muted); font-size: .9rem; margin-bottom: .2rem; }
.breadcrumb-lite a { color: var(--fms-muted); }
.pill-demo { background: #dcebff; color: #1a62d4; border-radius: 8px; padding: .5rem .9rem; font-weight: 600; font-size: .9rem; }
@media (max-width: 575.98px) { .page-head h1 { font-size: 1.6rem; } .page-head .sub { font-size: 1rem; } }

/* ---------- buttons ---------- */
.btn { border-radius: 8px; font-weight: 600; }
.btn-primary { --bs-btn-bg: var(--fms-blue); --bs-btn-border-color: var(--fms-blue); --bs-btn-hover-bg: var(--fms-blue-dark); --bs-btn-hover-border-color: var(--fms-blue-dark); --bs-btn-active-bg: var(--fms-blue-dark); }
.btn-outline-primary { --bs-btn-color: var(--fms-blue); --bs-btn-border-color: #b9d1fb; --bs-btn-hover-bg: var(--fms-blue-soft); --bs-btn-hover-color: var(--fms-blue-dark); --bs-btn-hover-border-color: #8fb4f8; background: #fff; }
.btn-soft { background: #eef5ff; border: 1px solid #cfe0fb; color: #1a62d4; font-weight: 600; padding: .3rem .75rem; font-size: .88rem; white-space: nowrap; }
.btn-soft:hover { background: #dfeaff; color: #1450b0; border-color: #b7d0fa; }
.btn-kebab { border: 0; background: none; color: var(--fms-text); padding: .15rem .5rem; }
.btn-kebab:hover { background: #eef2f9; }
.btn-spinner { width: 1rem; height: 1rem; border-width: .15em; }

/* ---------- cards / tables ---------- */
.card-panel { background: #fff; border: 1px solid var(--fms-border); border-radius: 12px; box-shadow: 0 1px 2px rgba(16, 42, 90, .04);padding: 1.1rem 1.25rem 1.25rem; }
.card-panel .card-body-pad { padding: 1rem 1.25rem; }
.tabs-bar { display: flex; gap: 1.6rem; padding: 0 1.4rem; border-bottom: 1px solid var(--fms-border); overflow-x: auto; }
.tabs-bar a { padding: 1.05rem .1rem; color: var(--fms-muted); font-weight: 500; border-bottom: 3px solid transparent; white-space: nowrap; margin-bottom: -1px; }
.tabs-bar a:hover { color: var(--fms-text); }
.tabs-bar a.active { color: var(--fms-blue); font-weight: 600; border-bottom-color: var(--fms-blue); }
.tabs-bar .badge-count { background: #e8eefa; color: #3c557f; border-radius: 10px; font-size: .72rem; padding: .1rem .45rem; margin-left: .3rem; }
.filter-bar { display: flex; flex-wrap: wrap; gap: .75rem; padding: 1rem 1.25rem; align-items: center; }
.filter-bar .form-control, .filter-bar .form-select { border-color: var(--fms-border); min-height: 46px; }
.filter-bar .search { position: relative; flex: 1 1 260px; }
.filter-bar .search i { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--fms-muted); }
.filter-bar .search input { padding-left: 2.5rem; }
.table-fms { margin: 0; }
.table-fms thead th { background: #f6f9ff; color: var(--fms-text); font-weight: 600; font-size: .85rem; white-space: nowrap; border-bottom: 1px solid var(--fms-border); padding: .85rem 1rem; }
.table-fms td { padding: .8rem 1rem; vertical-align: middle; border-color: var(--fms-border); font-size: .92rem; }
.table-fms .sub { color: var(--fms-muted); font-size: .86rem; }
.table-fms .txn { font-weight: 700; }
.table-fms .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.table-fms tbody tr:hover { background: #fafcff; }
.table-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .75rem; padding: .9rem 1.25rem; border-top: 1px solid var(--fms-border); color: var(--fms-muted); }
.pagination { margin: 0; gap: .35rem; }
.pagination .page-link { border: 1px solid var(--fms-border); border-radius: 8px !important; color: var(--fms-text); min-width: 38px; text-align: center; }
.pagination .active .page-link { background: var(--fms-blue); border-color: var(--fms-blue); color: #fff; }
.info-banner { background: #e8f1fe; border: 1px solid #cfe0fb; color: #174ea6; border-radius: 10px; padding: .85rem 1.1rem; display: flex; gap: .75rem; align-items: center; }
.info-banner i { font-size: 1.4rem; }

/* ---------- status pills ---------- */
.status { display: inline-flex; align-items: center; gap: .45rem; padding: .22rem .7rem; border-radius: 999px; font-size: .84rem; font-weight: 600; white-space: nowrap; }
.status::before { content: ""; width: .55rem; height: .55rem; border-radius: 50%; background: currentColor; }
.status-posted, .status-issued { background: #dff5e7; color: #137a3a; }
.status-pending { background: #fff1d6; color: #b36a00; }
.status-draft { background: #e8ecf3; color: #4a5a76; }
.status-approved { background: #dbe9ff; color: #1a5fd0; }
.status-rejected { background: #fde3e3; color: #b42323; }
.status-void { background: #ececf0; color: #555; text-decoration: line-through; }
.status-active { background: #dff5e7; color: #137a3a; }
.status-inactive { background: #ececf0; color: #555; }

/* ---------- forms ---------- */
.form-card { background: #fff; border: 1px solid var(--fms-border); border-radius: 12px; padding: 1rem; }
.form-section { border-radius: 10px; margin-bottom: 1rem; }
.form-section .sec-head { background: #f3f7fe; border-radius: 10px; padding: .6rem .9rem; display: flex; align-items: center; gap: .75rem; font-weight: 700; font-size: 1.05rem; margin-bottom: .9rem; }
.sec-no { width: 30px; height: 30px; border-radius: 50%; background: #d7e6ff; color: #1a62d4; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.form-label { font-weight: 600; font-size: .88rem; margin-bottom: .3rem; }
.form-label .req, .req { color: var(--fms-red); }
.form-control, .form-select { border-color: #cfd9ea; border-radius: 8px; min-height: 42px; }
.form-control:focus, .form-select:focus { border-color: #7aa7f5; box-shadow: 0 0 0 .2rem rgba(26, 108, 240, .15); }
.form-control[readonly], .form-control:disabled, .form-select:disabled { background: #eef2f8; }
.form-hint { color: var(--fms-muted); font-size: .8rem; margin-top: .2rem; }
.is-invalid ~ .invalid-feedback, .invalid-feedback.d-block { display: block; }
.invalid-feedback { font-size: .84rem; }
.ts-wrapper.is-invalid .ts-control { border-color: var(--bs-form-invalid-border-color); }
.ts-wrapper .ts-control { min-height: 42px; border-color: #cfd9ea; border-radius: 8px; }
.ts-dropdown { z-index: 2000; }
.form-alert { border-radius: 10px; }
.file-drop { border: 1.5px dashed #9db9e8; border-radius: 10px; background: #f6faff; padding: .9rem 1rem; }
.pm-section { background: #f7faff; border: 1px solid #e0eafb; border-radius: 10px; padding: .9rem 1rem; }
.sticky-actions { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .75rem; padding-top: .5rem; }

/* ---------- dashboard ---------- */
.stat-card { background: #fff; border: 1px solid var(--fms-border); border-radius: 14px; padding: 1.4rem; display: flex; gap: 1.1rem; align-items: center; height: 100%; }
.stat-icon { width: 68px; height: 68px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 1.9rem; flex: none; }
.stat-icon.primary { background: #e6f0ff; color: #1a6cf0; }
.stat-icon.warning { background: #fff0d9; color: #f59e0b; }
.stat-icon.good { background: #dff5e7; color: #16a34a; }
.stat-icon.bad { background: #fde3e3; color: #dc2626; }
.stat-label { color: var(--fms-muted); font-size: 1rem; }
.stat-value { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.stat-value.bad { color: var(--fms-red); }
.stat-period { color: var(--fms-muted); font-size: .92rem; }
.loading-shimmer { position: relative; overflow: hidden; }
.loading-shimmer::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .75), transparent); animation: shimmer 1.1s infinite; }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ---------- reports ---------- */
.report-wrap { background: #fff; border: 1px solid var(--fms-border); border-radius: 12px; padding: 1.1rem 1.25rem 1.25rem; }
.report-title { font-size: 1.5rem; font-weight: 800; margin: 0; }
.report-sub { color: var(--fms-muted); }
.report-table { width: 100%; border-collapse: collapse; margin-bottom: .6rem; font-size: .9rem; }
.report-table th { background: #f0f5fd; border-bottom: 1px solid var(--fms-border); padding: .5rem .7rem; text-align: left; font-weight: 600; font-size: .83rem; }
.report-table td { padding: .42rem .7rem; border-bottom: 1px solid #eef2f8; vertical-align: top; }
.report-table .r, .report-table th.r { text-align: right; font-variant-numeric: tabular-nums; }
.report-table .c, .report-table th.c { text-align: center; }
.report-table tr.section td { background: #dcebfd; color: #0d3b87; font-weight: 700; }
.report-table tr.subtotal td { background: #f3f7fd; font-weight: 600; }
.report-table tr.total td { background: #e3eefc; font-weight: 700; border-top: 1px solid #b9d0f3; }
.report-table tr.grand-good td { background: #dff5e7; color: #137a3a; font-weight: 800; font-size: 1.02rem; }
.report-table tr.grand-bad td { background: #fde3e3; color: #b42323; font-weight: 800; font-size: 1.02rem; }
.report-table tr.empty td { color: var(--fms-muted); font-style: italic; text-align: center; padding: 1rem; }
.report-table .ind-1 { padding-left: 1.8rem; }
.report-table a { color: #1a4fa8; }
.report-block-title { font-weight: 700; font-size: 1.05rem; margin: 1.1rem 0 .4rem; }
.mini-card { border: 1px solid var(--fms-border); border-radius: 12px; padding: .85rem 1rem; background: #fff; height: 100%; }
.mini-card .l { color: var(--fms-muted); font-size: .9rem; }
.mini-card .v { font-size: 1.55rem; font-weight: 800; line-height: 1.2; }
.mini-card .s { color: var(--fms-muted); font-size: .84rem; }
.mini-card.primary .v { color: #1a4fa8; } .mini-card.good .v { color: #137a3a; } .mini-card.bad .v { color: #b42323; } .mini-card.warning .v { color: #b36a00; }
.report-skeleton { padding: 2rem 1rem; text-align: center; color: var(--fms-muted); }

/* ---------- receipt / voucher ---------- */
.doc-paper { background: #fff; border: 1px solid #ccd6e8; border-radius: 6px; padding: 1.4rem 1.6rem; position: relative; }
.doc-head { display: flex; gap: 1rem; align-items: center; border-bottom: 3px double #1f3b73; padding-bottom: .8rem; margin-bottom: .9rem; }
.doc-head img { width: 74px; height: 70px; object-fit: contain; }
.doc-head .org { font-weight: 800; font-size: 1.1rem; text-transform: uppercase; line-height: 1.2; }
.doc-head .meta { color: #445; font-size: .82rem; }
.doc-title { text-align: center; font-weight: 800; letter-spacing: .12em; font-size: 1.15rem; margin: .4rem 0 .9rem; }
.doc-grid { display: grid; grid-template-columns: 170px 1fr; gap: .35rem .75rem; font-size: .93rem; }
.doc-grid .k { color: #556; font-weight: 600; }
.doc-amount { border: 2px solid #1f3b73; border-radius: 6px; padding: .4rem .9rem; display: inline-block; font-weight: 800; font-size: 1.35rem; }
.doc-sign { display: flex; justify-content: space-between; gap: 1.5rem; margin-top: 2.2rem; font-size: .82rem; text-align: center; }
.doc-sign div { flex: 1; border-top: 1px solid #556; padding-top: .3rem; }
.doc-watermark { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 6rem; font-weight: 900; color: rgba(200, 30, 30, .16); transform: rotate(-22deg); pointer-events: none; letter-spacing: .2em; }

/* ---------- modals: confirm / loader ---------- */
.state-icon { width: 76px; height: 76px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 2.2rem; margin-bottom: .6rem; }
.state-icon.confirm { background: #e6f0ff; color: #1a6cf0; }
.state-icon.danger { background: #fde3e3; color: #dc2626; }
.state-icon.success { background: #dff5e7; color: #16a34a; }
.state-icon.error { background: #fde3e3; color: #dc2626; }
.progress.fms-progress { height: 10px; border-radius: 999px; background: #e3ebf8; }
.progress.fms-progress .progress-bar { background: var(--fms-blue); transition: width .2s ease; }
.confirm-summary { text-align: left; background: #f5f8fe; border: 1px solid var(--fms-border); border-radius: 10px; padding: .7rem .9rem; font-size: .9rem; }
.confirm-summary div { display: flex; justify-content: space-between; gap: 1rem; padding: .12rem 0; }
.confirm-summary span:first-child { color: var(--fms-muted); }
.confirm-summary span:last-child { font-weight: 600; text-align: right; }
.modal-content { border-radius: 14px; border: 0; }
.modal-header { border-bottom-color: var(--fms-border); }
.modal-footer { border-top-color: var(--fms-border); }
.detail-grid { display: grid; grid-template-columns: 170px 1fr; gap: .5rem 1rem; }
.detail-grid .k { color: var(--fms-muted); font-weight: 600; }
@media (max-width: 575.98px) { .detail-grid, .doc-grid { grid-template-columns: 1fr; gap: 0; } .detail-grid .k, .doc-grid .k { margin-top: .5rem; } }

/* ---------- login ---------- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0f2a55 0%, #1a4fa8 100%); padding: 1rem; }
.login-card { width: 100%; max-width: 430px; background: #fff; border-radius: 16px; padding: 2rem; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.login-card img { width: 84px; height: 78px; object-fit: contain; }

/* ---------- toast ---------- */
.toast-stack { position: fixed; top: 1rem; right: 1rem; z-index: 3000; display: flex; flex-direction: column; gap: .5rem; }

/* ---------- print ---------- */
@media print {
    body * { visibility: hidden !important; }
    .print-area, .print-area * { visibility: visible !important; }
    .print-area { position: absolute !important; left: 0; top: 0; width: 100% !important; border: 0 !important; box-shadow: none !important; }
    .modal, .modal-dialog { position: static !important; transform: none !important; margin: 0 !important; max-width: 100% !important; }
    .modal-backdrop { display: none !important; }
    .no-print { display: none !important; }
    body { background: #fff; }
    .report-table th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .report-table tr.section td, .report-table tr.total td, .report-table tr.subtotal td, .report-table tr[class^="grand"] td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
