/* OCSSRD Beneficiary Dashboard - admin console styling (DROP-OFF style match). */

:root {
    --ink: #1f2733;
    --ink-soft: #384252;
    --muted: #6b7688;
    --faint: #97a1b0;
    --line: #e4e8ee;
    --line-soft: #eef1f5;
    --paper: #ffffff;
    --canvas: #eef1f5;
    --sidebar: #ffffff;

    /* Teal action theme, matching the reference buttons. */
    --brand: #1a8f9e;
    --brand-dark: #157988;
    --brand-soft: #e3f2f4;
    --search-btn: #0e6470;
    --search-btn-dark: #0a505b;

    /* Logo accent stays blue. */
    --logo-blue: #1b74c4;

    /* Topbar icon buttons. */
    --chip: #ecebfb;
    --chip-ink: #5f5fd0;

    --green: #1e9e6a;
    --green-soft: #e5f6ee;
    --amber: #c9861f;
    --amber-soft: #fbf1df;
    --teal: #12889a;
    --teal-soft: #e3f4f4;
    --violet: #6b5bd2;
    --violet-soft: #ece9fb;
    --rose: #d4514e;
    --rose-soft: #fbe9e8;
    --slate: #5b6a82;
    --slate-soft: #eceff4;
    --blue: #1b74c4;
    --blue-soft: #e8f2fb;

    --danger: #d4514e;
    --danger-bg: #fbe9e8;
    --ok: #1e9e6a;
    --ok-bg: #e5f6ee;
    --info: #1b74c4;
    --info-bg: #e8f2fb;
    --warn: #b07c1f;
    --warn-bg: #fbf1df;

    /* Sharp corners. */
    --radius: 4px;
    --radius-sm: 3px;
    --radius-btn: 3px;
    --shadow: 0 1px 2px rgba(20, 40, 70, .05), 0 6px 20px rgba(20, 40, 70, .05);
    --shadow-sm: 0 1px 2px rgba(20, 40, 70, .05);
    --sidebar-w: 258px;
    --sidebar-collapsed-w: 76px;
    --topbar-h: 70px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
    margin: 0;
    font-family: "Ubuntu", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink);
    background: var(--canvas);
    font-size: 14.5px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: none; }

.ic { width: 20px; height: 20px; flex: 0 0 auto; }
.ic.sm { width: 16px; height: 16px; }
.ic.xs { width: 13px; height: 13px; }

/* ---------------------------------------------------------------- Shell */
.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--sidebar);
    border-right: 1px solid var(--line);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    transition: width .18s ease, transform .18s ease;
    overflow: hidden;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 16px 16px;
    border-bottom: 1px solid var(--line-soft);
}
.brand {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    min-width: 0; text-align: center; width: 100%;
}
.brand .brand-logo { max-height: 56px; max-width: 82%; width: auto; display: block; }
.brand .brand-mark {
    height: 52px; width: 52px; flex: 0 0 52px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--logo-blue); color: #fff; border-radius: 6px;
    font-weight: 700; font-size: 24px;
}
.brand-name {
    font-weight: 700; font-size: 16px; color: var(--ink);
    line-height: 1.25; letter-spacing: .01em;
    overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

.sidebar-nav { padding: 14px 12px; overflow-y: auto; flex: 1; }
.nav-group { margin-bottom: 16px; }
.nav-label {
    font-size: 13px; font-weight: 700; color: var(--ink);
    padding: 6px 12px 10px; white-space: nowrap;
}
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 12px; margin-bottom: 2px;
    border-radius: var(--radius-sm);
    color: var(--ink-soft); font-weight: 500; font-size: 14.5px;
    white-space: nowrap; position: relative;
}
.nav-item .ic { color: var(--faint); }
.nav-item:hover { background: var(--line-soft); color: var(--ink); }
.nav-item:hover .ic { color: var(--ink-soft); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.nav-item.active .ic { color: var(--brand); }

/* Main column */
.main {
    flex: 1; min-width: 0;
    margin-left: var(--sidebar-w);
    display: flex; flex-direction: column;
    transition: margin-left .18s ease;
}

/* Topbar */
.topbar {
    height: var(--topbar-h);
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: 12px;
    padding: 0 22px;
}
.topbar-spacer { flex: 1; }
.icon-btn {
    height: 42px; width: 42px; flex: 0 0 42px;
    display: inline-flex; align-items: center; justify-content: center;
    border: none; border-radius: 8px;
    background: var(--chip); color: var(--chip-ink); cursor: pointer;
}
.icon-btn:hover { filter: brightness(.97); }
.icon-btn.accent { background: var(--chip); color: var(--chip-ink); }
.icon-btn.ghost { background: var(--chip); color: var(--chip-ink); cursor: default; }

.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; background: var(--brand-soft); border-radius: 22px; }
.avatar {
    height: 36px; width: 36px; flex: 0 0 36px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--brand); color: #fff; font-weight: 700; font-size: 15px;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.2; padding-right: 4px; }
.user-name { font-weight: 700; font-size: 13.5px; color: var(--ink); }
.user-role { font-size: 12px; color: var(--muted); }

/* Content */
.content { padding: 22px 26px 30px; flex: 1; display: flex; flex-direction: column; }

.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb .sep { display: inline-flex; color: var(--faint); }
.breadcrumb .here { color: var(--ink); font-weight: 700; }

/* Page head */
.page-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.page-head h1 { font-size: 22px; font-weight: 700; margin: 0; }
.page-head .sub { color: var(--muted); font-size: 13.5px; margin-top: 3px; }

/* Cards */
.card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 22px;
}
.card + .card { margin-top: 18px; }
.card-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px; flex-wrap: wrap; margin-bottom: 16px;
}
.card-head h2 { font-size: 16px; font-weight: 700; margin: 0; }
.card-title { font-size: 16px; font-weight: 700; margin: 0 0 4px; }
.card-sub { color: var(--muted); font-size: 13px; margin: 0 0 16px; }

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 20px; }
.stat {
    position: relative; background: var(--paper);
    border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); padding: 18px 18px 26px; overflow: hidden;
}
.stat-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.stat-icon { height: 46px; width: 46px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; }
.stat-icon .ic { width: 23px; height: 23px; }
.stat-tag { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 3px; background: var(--slate-soft); color: var(--slate); white-space: nowrap; }
.stat .label { color: var(--muted); font-size: 13px; font-weight: 500; }
.stat .value { font-size: 28px; font-weight: 700; margin-top: 2px; }
.stat-line { position: absolute; left: 0; right: 0; bottom: 0; height: 30px; width: 100%; display: block; }

.tile-blue { background: var(--blue-soft); color: var(--blue); }
.tile-green { background: var(--green-soft); color: var(--green); }
.tile-amber { background: var(--amber-soft); color: var(--amber); }
.tile-teal { background: var(--teal-soft); color: var(--teal); }
.tile-violet { background: var(--violet-soft); color: var(--violet); }
.tile-rose { background: var(--rose-soft); color: var(--rose); }
.tile-slate { background: var(--slate-soft); color: var(--slate); }

.tag-green { background: var(--green-soft); color: var(--green); }
.tag-amber { background: var(--amber-soft); color: var(--amber); }
.tag-rose { background: var(--rose-soft); color: var(--rose); }
.tag-blue { background: var(--blue-soft); color: var(--blue); }

/* Two column row */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }

/* Distribution list */
.dist { list-style: none; margin: 0; padding: 0; }
.dist li { margin-bottom: 14px; }
.dist li:last-child { margin-bottom: 0; }
.dist .row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; font-size: 13.5px; }
.dist .name { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); }
.dist .dot { height: 9px; width: 9px; border-radius: 50%; flex: 0 0 9px; }
.dist .count { font-weight: 700; color: var(--ink); }
.bar { height: 8px; border-radius: 2px; background: var(--line-soft); overflow: hidden; }
.bar > span { display: block; height: 100%; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    background: var(--brand); color: #fff;
    border: 1px solid var(--brand);
    padding: 9px 15px; border-radius: var(--radius-btn);
    font-size: 14px; font-weight: 500; cursor: pointer;
    text-decoration: none; line-height: 1.2; font-family: inherit;
}
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn .ic { color: currentColor; }
.btn.secondary { background: var(--paper); color: var(--ink-soft); border-color: var(--line); }
.btn.secondary:hover { background: var(--line-soft); }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: #bb403d; }
.btn.dark { background: var(--search-btn); border-color: var(--search-btn); }
.btn.dark:hover { background: var(--search-btn-dark); border-color: var(--search-btn-dark); }
.btn.small { padding: 7px 11px; font-size: 13px; }
.btn.icon-only { padding: 9px; }

/* Filter bar (matches the reference top filter row) */
.filterbar {
    display: grid;
    grid-template-columns: repeat(3, 1fr) auto auto;
    gap: 16px;
    align-items: end;
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--line-soft);
}
.filterbar .field { margin: 0; }
.filterbar .field label { font-weight: 700; color: var(--ink); font-size: 14px; margin-bottom: 8px; }
.filterbar .fb-btn {
    height: 46px; width: 52px; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius-btn); border: 1px solid transparent; cursor: pointer;
}
.filterbar .fb-search { background: var(--search-btn); color: #fff; }
.filterbar .fb-search:hover { background: var(--search-btn-dark); }
.filterbar .fb-reset { background: var(--brand); color: #fff; }
.filterbar .fb-reset:hover { background: var(--brand-dark); }
.filterbar .fb-btn .ic { width: 20px; height: 20px; }

/* DataTables toolbar */
.dt-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.dt-buttons { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.dt-btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--brand); color: #fff; border: 1px solid var(--brand);
    padding: 8px 13px; border-radius: var(--radius-btn);
    font-size: 13.5px; font-weight: 500; cursor: pointer; font-family: inherit;
}
.dt-btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.dt-btn .ic { width: 16px; height: 16px; }
.dt-colvis { position: relative; }
.dt-colvis-menu {
    position: absolute; top: calc(100% + 4px); left: 0; z-index: 20;
    background: var(--paper); border: 1px solid var(--line);
    border-radius: var(--radius-sm); box-shadow: var(--shadow);
    padding: 6px; min-width: 200px; display: none;
}
.dt-colvis-menu.open { display: block; }
.dt-colvis-menu label {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 9px; border-radius: var(--radius-sm);
    font-size: 13.5px; color: var(--ink-soft); cursor: pointer;
}
.dt-colvis-menu label:hover { background: var(--line-soft); }
.dt-colvis-menu input { width: 16px; height: 16px; accent-color: var(--brand); }
.dt-search { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-soft); }
.dt-search input {
    padding: 8px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm);
    font: inherit; color: var(--ink); min-width: 220px;
}
.dt-search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(26, 143, 158, .14); }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { text-align: left; padding: 13px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.data thead th {
    color: var(--ink); font-weight: 700; font-size: 12px;
    text-transform: uppercase; letter-spacing: .03em;
    background: var(--paper); border-bottom: 2px solid var(--line);
}
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--canvas); }
.dt-hide { display: none !important; }
.row-actions { display: flex; gap: 8px; white-space: nowrap; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-top: 16px; }
.foot-left { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.entries-note { color: var(--muted); font-size: 13px; }
.page-size-form label { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-soft); font-size: 13.5px; }
.page-size-form select { padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); font: inherit; color: var(--ink); background: var(--paper); }
.page-size-form select:focus { outline: none; border-color: var(--brand); }

/* Photo thumbnail in tables */
.thumb {
    width: 40px; height: 40px; border-radius: var(--radius-sm);
    object-fit: cover; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--line); background: var(--canvas); vertical-align: middle;
}
.thumb-ph { color: var(--brand); background: var(--brand-soft); border-color: var(--brand-soft); font-weight: 700; font-size: 13px; }

/* Company / small tag */
.tag {
    display: inline-block; padding: 2px 8px; border-radius: var(--radius-sm);
    background: var(--blue-soft); color: var(--blue); font-size: 12px; font-weight: 500;
}

/* Badges */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px; border-radius: var(--radius-sm);
    font-size: 12px; font-weight: 700; border: 1px solid transparent;
}
.badge::before { content: ""; height: 7px; width: 7px; border-radius: 50%; background: currentColor; }
.badge.active { background: var(--ok-bg); color: var(--ok); }
.badge.inactive { background: var(--slate-soft); color: var(--slate); }
.badge.graduated { background: var(--info-bg); color: var(--info); }
.badge.suspended { background: var(--danger-bg); color: var(--danger); }
.badge.on { background: var(--ok-bg); color: var(--ok); }
.badge.off { background: var(--slate-soft); color: var(--slate); }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 13.5px; color: var(--ink-soft); }
.field .req { color: var(--danger); }
.field input[type=text],
.field input[type=email],
.field input[type=password],
.field input[type=date],
.field input[type=number],
.field input[type=file],
.field select,
.field textarea {
    width: 100%; padding: 10px 12px;
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    font: inherit; color: var(--ink); background: var(--paper);
}
.field input[type=file] { padding: 8px 12px; }
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(26, 143, 158, .14);
}
.field .hint { color: var(--muted); font-size: 12.5px; margin-top: 5px; }
.field .error { color: var(--danger); font-size: 12.5px; margin-top: 5px; }
.field input.invalid, .field select.invalid, .field textarea.invalid { border-color: var(--danger); }
.checkbox-row { display: flex; align-items: center; gap: 9px; }
.checkbox-row input { width: 17px; height: 17px; accent-color: var(--brand); }
.form-actions { display: flex; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line-soft); }

/* Old filter form fallback */
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 18px; }
.filters .field { margin: 0; }
.search-box { position: relative; display: inline-flex; align-items: center; }
.search-box .ic { position: absolute; left: 11px; color: var(--faint); pointer-events: none; }
.search-box input { padding-left: 34px !important; min-width: 240px; }

/* Flash */
.flash { display: flex; align-items: center; gap: 9px; padding: 12px 15px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; font-weight: 500; border: 1px solid transparent; }
.flash.success { background: var(--ok-bg); color: #157a51; border-color: #c3ead6; }
.flash.error { background: var(--danger-bg); color: #b23c39; border-color: #f2cecc; }
.flash.info { background: var(--info-bg); color: #145f9f; border-color: #cbe3f7; }
.flash.warning { background: var(--warn-bg); color: #93671f; border-color: #eeddba; }

/* Pagination */
.pagination { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.pagination a, .pagination span {
    min-width: 36px; height: 36px; padding: 0 10px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    color: var(--ink-soft); font-size: 13.5px; font-weight: 500;
}
.pagination a:hover { background: var(--line-soft); }
.pagination .current { background: var(--brand); color: #fff; border-color: var(--brand); }
.pagination .disabled { color: var(--faint); opacity: .6; }

/* Profile */
.profile-head { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; }
.photo, .photo-placeholder {
    width: 128px; height: 128px; border-radius: var(--radius-sm);
    object-fit: cover; border: 1px solid var(--line); background: var(--canvas);
}
.photo-placeholder { display: flex; align-items: center; justify-content: center; color: var(--faint); font-size: 13px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 28px; }
.detail-grid .item .k { color: var(--muted); font-size: 12.5px; }
.detail-grid .item .v { font-size: 14.5px; margin-top: 2px; color: var(--ink); }

.muted { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 40px 12px; }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }

/* Footer */
.app-footer { margin-top: auto; padding-top: 26px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; }
.app-footer .powered { color: var(--ink-soft); font-weight: 500; }
.login-foot { margin-top: 18px; text-align: center; color: var(--faint); font-size: 12px; }

/* Sidebar collapsed */
.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed-w); }
.sidebar-collapsed .main { margin-left: var(--sidebar-collapsed-w); }
.sidebar-collapsed .brand-name,
.sidebar-collapsed .nav-label,
.sidebar-collapsed .nav-item span { display: none; }
.sidebar-collapsed .brand .brand-logo { max-height: 40px; }
.sidebar-collapsed .brand .brand-mark { height: 40px; width: 40px; flex-basis: 40px; font-size: 18px; }
.sidebar-collapsed .nav-item { justify-content: center; padding: 11px; }

.sidebar-backdrop { position: fixed; inset: 0; background: rgba(20, 30, 50, .38); z-index: 35; opacity: 0; visibility: hidden; transition: opacity .18s ease; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--canvas); }
.login-card { width: 100%; max-width: 400px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 32px; }
.login-card .login-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 24px; text-align: center; }
.login-card .login-brand img { max-height: 60px; }
.login-card .login-brand .name { font-size: 19px; font-weight: 700; }
.login-card .login-brand .tag { font-size: 13px; color: var(--muted); background: none; padding: 0; }
.login-card .field { margin-bottom: 16px; }
.login-card .btn { width: 100%; justify-content: center; padding: 11px; }

/* Responsive */
@media (max-width: 1100px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 980px) { .filterbar { grid-template-columns: 1fr 1fr; } }
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow); }
    .main { margin-left: 0; }
    .sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-open .sidebar-backdrop { opacity: 1; visibility: visible; }
    .content { padding: 18px 16px 26px; }
    .topbar { padding: 0 16px; }
    .user-meta { display: none; }
}
@media (max-width: 620px) {
    .stat-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .grid-2 { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .filterbar { grid-template-columns: 1fr; }
    .page-head h1 { font-size: 19px; }
}

/* Print (used by the PDF button) */
@media print {
    .sidebar, .topbar, .breadcrumb, .app-footer, .dt-toolbar, .filterbar,
    .page-head .btn, .row-actions, .table-foot, .sidebar-backdrop { display: none !important; }
    body, .content, .card { background: #fff; }
    .main { margin-left: 0; }
    .card { border: none; box-shadow: none; padding: 0; }
    .table-wrap { border: 1px solid #ccc; }
    table.data th, table.data td { border-bottom: 1px solid #ddd; }
    .dt-hide { display: table-cell !important; }
}
