﻿/* ==========================================================
   ADMIN PANEL - same green identity as the public template
========================================================== */

:root {
    /* Radzen theme -> template green */
    --rz-primary: #075943;
    --rz-primary-light: #0a7658;
    --rz-primary-lighter: rgba(7, 89, 67, .14);
    --rz-primary-dark: #064a39;
    --rz-primary-darker: #034d3a;
    --rz-text-font-family: Arial, "Segoe UI", sans-serif;
    --sidebar-w: 256px;
}

body { background: var(--page-bg); }

.admin-shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; direction: ltr; }
.admin-backdrop { display: none; }

/* ── sidebar ── */
.admin-sidebar {
    background: linear-gradient(180deg, var(--green-dark), var(--green)); color: #fff; padding: 0 0 20px;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.admin-brand { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid rgba(255, 255, 255, .15); }
.admin-brand img { width: 44px; height: 44px; object-fit: contain; background: #fff; border-radius: 50%; padding: 2px; }
.admin-brand strong { display: block; font-size: 16px; }
.admin-brand small { display: block; opacity: .75; font-size: 11.5px; }
.admin-nav { padding: 10px 10px 0; display: flex; flex-direction: column; gap: 2px; }
.admin-nav a {
    display: flex; align-items: center; gap: 11px; color: #e4f2ee; text-decoration: none; padding: 10px 12px; border-radius: 8px; font-size: 14px;
}
.admin-nav a:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.admin-nav a.active { background: rgba(255, 255, 255, .2); color: #fff; font-weight: 700; }
.admin-nav .ico { width: 22px; text-align: center; font-size: 16px; }
.nav-group { margin: 14px 12px 4px; font-size: 11px; letter-spacing: .7px; text-transform: uppercase; opacity: .6; }

/* ── main ── */
.admin-main { min-width: 0; display: flex; flex-direction: column; }
.admin-topbar {
    position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 10px 22px;
    background: #fff; border-bottom: 1px solid #e0e9e6; box-shadow: 0 2px 10px rgba(21, 62, 51, .04);
}
.admin-burger { display: none; background: none; border: 1px solid #cbd9d6; border-radius: 8px; width: 40px; height: 40px; font-size: 20px; cursor: pointer; }
.admin-title { flex: 1; font-size: 13px; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-user { display: flex; align-items: center; gap: 12px; }
.admin-user .who { text-align: right; line-height: 1.3; }
.admin-user .who strong { display: block; font-size: 14px; }
.admin-user .who small { color: var(--muted); font-size: 12px; }
.admin-user form { margin: 0; }
.admin-content { padding: 22px; flex: 1; min-width: 0; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; font-size: 24px; color: var(--green-dark); }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ── boxes ── */
.box { background: #fff; border: 1px solid #dbe8e3; border-radius: var(--radius); box-shadow: 0 4px 16px rgba(21, 62, 51, .05); margin-bottom: 18px; min-width: 0; }
.box-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 13px 18px; border-bottom: 1px solid #e6eeeb; background: #f7fbf9; border-radius: var(--radius) var(--radius) 0 0; }
.box-head h3 { margin: 0; font-size: 16px; color: var(--green); }
.box-body { padding: 16px 18px; }
.box-body.flush { padding: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid-2-1 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; }

/* ── KPI cards ── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: #fff; border: 1px solid #dbe8e3; border-radius: var(--radius); padding: 16px 18px; display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; transition: transform .12s, box-shadow .12s; }
a.kpi:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(21, 62, 51, .1); }
.kpi .k-ico { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 21px; flex: none; }
.kpi.g .k-ico { background: var(--green-light); }
.kpi.b .k-ico { background: var(--blue-light); }
.kpi.o .k-ico { background: var(--orange-light); }
.kpi.r .k-ico { background: var(--red-light); }
.kpi .k-num { font-size: 26px; font-weight: 800; color: var(--green-dark); line-height: 1.1; }
.kpi .k-label { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ── bars ── */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 150px 1fr 56px; gap: 10px; align-items: center; font-size: 13px; }
.bar-row .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 12px; background: #e8f0ed; border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, #0a6b50, #1aa274); border-radius: 99px; }
.bar-fill.blue { background: linear-gradient(90deg, #1976c9, #4d9be0); }
.bar-fill.orange { background: linear-gradient(90deg, #e58a0b, #f3b04c); }
.bar-row .val { text-align: right; font-weight: 700; color: var(--green-dark); }

/* ── filters ── */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 14px 18px; border-bottom: 1px solid #e6eeeb; }
.filters .field { flex: 1 1 150px; min-width: 130px; }
.filters .field.wide { flex: 2 1 240px; }
.filters .field label { font-size: 12px; margin-bottom: 4px; }
.filters .field input, .filters .field select { min-height: 40px; font-size: 14px; padding: 7px 10px; }
.filters .field-actions { display: flex; gap: 8px; align-items: flex-end; }

/* ── data table ── */
.dt-wrap { overflow-x: auto; }
.dt { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.dt th { background: #eef6f2; color: var(--green); text-align: left; padding: 10px 12px; font-size: 12.5px; white-space: nowrap; position: sticky; top: 0; }
.dt td { padding: 10px 12px; border-bottom: 1px solid #e6eeeb; vertical-align: middle; }
.dt tbody tr:hover td { background: #f7fbf9; }
.dt tbody tr.sel td { background: #e8f5ef; }
.dt .num { text-align: right; white-space: nowrap; }
.dt .nowrap { white-space: nowrap; }
.dt .sub { display: block; color: var(--muted); font-size: 12px; }
.dt a.row-link { color: var(--green-dark); font-weight: 700; text-decoration: none; }
.dt a.row-link:hover { text-decoration: underline; }
.dt input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--green); }
.empty-row { text-align: center; color: var(--muted); padding: 30px 10px !important; }

.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 18px; border-top: 1px solid #e6eeeb; font-size: 13px; color: var(--muted); }
.pager .pages { display: flex; gap: 4px; flex-wrap: wrap; }
.pager button { min-width: 36px; height: 36px; border: 1px solid #cbd9d6; background: #fff; border-radius: 8px; cursor: pointer; font: inherit; }
.pager button.cur { background: var(--green); color: #fff; border-color: var(--green); font-weight: 700; }
.pager button:disabled { opacity: .45; cursor: default; }

.bulk-bar {
    display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 18px; background: #eef6ff; border-bottom: 1px solid #c9def8;
}
.bulk-bar .field { margin: 0; min-width: 160px; }
.bulk-bar select, .bulk-bar input { min-height: 38px; font-size: 14px; padding: 6px 10px; }

/* ── status badges ── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.s-Submitted { background: #e7f1fb; color: #155f99; }
.s-UnderReview { background: #efe9fb; color: #5b3aa6; }
.s-Approved { background: #dff2e9; color: #087052; }
.s-Rejected { background: #fde3e0; color: #b93e33; }

/* ── tabs ── */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 2px solid #dbe8e3; margin-bottom: 16px; }
.tabs button { background: none; border: 0; padding: 10px 16px; font: inherit; font-weight: 700; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; border-radius: 8px 8px 0 0; }
.tabs button:hover { background: #eef6f2; }
.tabs button.on { color: var(--green); border-bottom-color: var(--green); }
.tabs .count { background: #e4efe9; color: var(--green); border-radius: 99px; padding: 1px 8px; font-size: 11.5px; margin-inline-start: 5px; }

/* ── detail page ── */
.detail-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.detail-head h1 { margin: 0 0 6px; font-size: 24px; color: var(--green-dark); }
.detail-meta { display: flex; gap: 8px 18px; flex-wrap: wrap; color: var(--muted); font-size: 13.5px; }
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 22px; }
.detail-grid .d span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.detail-grid .d strong { font-size: 14px; word-break: break-word; }
.detail-grid .d.wide { grid-column: 1 / -1; }
.section-label { margin: 18px 0 10px; padding: 7px 12px; background: #eef6f2; border-inline-start: 4px solid var(--green); font-weight: 800; color: var(--green); font-size: 13.5px; border-radius: 4px; }
.section-label:first-child { margin-top: 0; }

.action-panel { background: #f4faf7; border: 1px solid #cfe5dc; border-radius: var(--radius); padding: 16px 18px; }
.action-panel h3 { margin: 0 0 10px; font-size: 15px; color: var(--green); }
.action-panel .field { margin-bottom: 10px; }
.action-panel textarea { min-height: 70px; }
.check-line { display: flex; align-items: center; gap: 8px; font-size: 13.5px; margin: 6px 0; cursor: pointer; }
.check-line input { width: 18px; height: 18px; accent-color: var(--green); }
.next-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.checklist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.check-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid #dbe8e3; border-radius: 8px; background: #fff; }
.tri { display: inline-flex; border: 1px solid #cbd9d6; border-radius: 8px; overflow: hidden; }
.tri button { border: 0; background: #fff; padding: 6px 12px; cursor: pointer; font: inherit; font-size: 13px; }
.tri button + button { border-inline-start: 1px solid #cbd9d6; }
.tri button.yes.on { background: #dff2e9; color: #087052; font-weight: 700; }
.tri button.no.on { background: #fde3e0; color: #b93e33; font-weight: 700; }
.tri button.na.on { background: #eceeed; font-weight: 700; }

.doc-admin-row { display: grid; grid-template-columns: minmax(0, 1.4fr) auto minmax(0, 1.4fr); gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px dashed #dce6e2; }
.doc-admin-row:last-child { border-bottom: 0; }
.doc-admin-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.timeline-admin { list-style: none; margin: 0; padding: 0; }
.timeline-admin li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px dashed #e0e9e5; }
.timeline-admin li:last-child { border-bottom: 0; }
.timeline-admin .h-dot { margin-top: 6px; }
.timeline-admin small { color: var(--muted); }

.msg-body { max-height: 180px; overflow: auto; background: #f7faf9; border: 1px solid #dfe9e5; border-radius: 8px; padding: 10px 12px; white-space: pre-wrap; font-size: 13px; }

/* ── login ── */
.login-shell { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--page-bg); }
.login-hero {
    background: linear-gradient(rgba(3, 77, 58, .92), rgba(7, 89, 67, .88)), url('../img/mosque.jpg') center / cover;
    color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px;
}
.login-hero img { width: 110px; height: 110px; object-fit: contain; background: #fff; border-radius: 50%; padding: 6px; margin-bottom: 20px; }
.login-hero h1 { margin: 0 0 8px; font-family: var(--font-serif); font-size: 30px; }
.login-hero p { margin: 0; opacity: .9; line-height: 1.7; }
.login-panel { display: flex; flex-direction: column; justify-content: center; padding: 40px min(8vw, 90px); max-width: 560px; width: 100%; margin: auto; }
.login-panel h2 { margin: 0 0 4px; font-size: 28px; color: var(--green-dark); }
.login-panel .btn.block { width: 100%; margin-top: 18px; min-height: 48px; font-size: 16px; }
.remember { display: flex; gap: 8px; align-items: center; margin-top: 14px; font-size: 14px; }
.login-foot { margin-top: 24px; font-size: 14px; }

/* ── misc ── */
.copy-block { background: #f7faf9; border: 1px dashed #b9cec7; border-radius: 8px; padding: 10px 12px; font-family: Consolas, monospace; font-size: 12.5px; word-break: break-all; }
.token-help { display: flex; flex-wrap: wrap; gap: 6px; }
.token-help code { background: #eef6f2; border: 1px solid #d3e4dc; border-radius: 6px; padding: 2px 8px; font-size: 12.5px; }
.status-strip { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.tone-ok { color: #087052; font-weight: 700; }
.tone-bad { color: #b93e33; font-weight: 700; }
.mt { margin-top: 14px; }
.right { text-align: right; }
.spacer { flex: 1; }

/* ==========================================================
   RESPONSIVE
========================================================== */
@media (max-width: 1100px) {
    .grid-3 { grid-template-columns: 1fr 1fr; }
    .grid-2-1 { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .admin-shell { display: block; }
    .admin-sidebar {
        position: fixed; z-index: 60; inset: 0 auto 0 0; width: min(84vw, 300px); transform: translateX(-102%); transition: transform .22s ease; box-shadow: 6px 0 24px rgba(0, 0, 0, .25);
    }
    .admin-shell.nav-open .admin-sidebar { transform: none; }
    .admin-shell.nav-open .admin-backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, .4); }
    .admin-burger { display: block; }
    .admin-topbar { padding: 8px 12px; }
    .admin-title { display: none; }
    .admin-user { margin-inline-start: auto; }
    .admin-user .who small { display: none; }
    .admin-content { padding: 14px 12px; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .login-shell { grid-template-columns: 1fr; }
    .login-hero { padding: 26px 20px; }
    .login-hero img { width: 80px; height: 80px; margin-bottom: 10px; }
    .login-hero h1 { font-size: 22px; }
    .login-panel { padding: 28px 20px 40px; }
}

@media (max-width: 720px) {
    .page-head h1 { font-size: 20px; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .kpi { padding: 12px; gap: 10px; }
    .kpi .k-ico { width: 38px; height: 38px; font-size: 17px; }
    .kpi .k-num { font-size: 21px; }
    .bar-row { grid-template-columns: 96px 1fr 44px; }
    .detail-grid, .checklist { grid-template-columns: 1fr; }
    .doc-admin-row { grid-template-columns: 1fr; }
    .filters { padding: 12px; }
    .filters .field, .filters .field.wide { flex: 1 1 100%; }
    .filters .field-actions { width: 100%; }
    .filters .field-actions .btn { flex: 1; }

    /* tables become stacked cards */
    .dt.stack thead { display: none; }
    .dt.stack, .dt.stack tbody, .dt.stack tr, .dt.stack td { display: block; width: 100%; }
    .dt.stack tr { border: 1px solid #dfe9e5; border-radius: 10px; margin: 10px 12px; padding: 8px 12px; width: auto; background: #fff; }
    .dt.stack td { border: 0; padding: 5px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
    .dt.stack td::before { content: attr(data-label); font-weight: 700; color: var(--muted); text-align: left; font-size: 12px; flex: none; }
    .dt.stack td.nolabel::before { display: none; }
    .dt.stack td:empty { display: none; }
    .dt.stack td .sub { text-align: right; }
    .tabs button { padding: 9px 11px; font-size: 13px; }
    .pager { justify-content: center; }
}

/* inline table inputs (Programs & Quotas) */
.cell-input { width: 100%; min-height: 38px; padding: 6px 8px; border: 1px solid #cbd9d6; border-radius: 6px; font: 14px Arial, sans-serif; background: #fff; }
.cell-input:focus { outline: none; border-color: #0b8b67; box-shadow: 0 0 0 3px rgba(11, 139, 103, .12); }
select.btn { appearance: auto; padding-inline: 10px; font-weight: 600; }
.filters .field-actions .btn { min-height: 40px; }

/* selects in toolbars must never be wider than their container (long program names) */
.page-actions { min-width: 0; max-width: 100%; }
.page-actions select, .box-head select { max-width: 100%; min-width: 0 !important; text-overflow: ellipsis; }
@media (max-width: 720px) {
    .page-head .page-actions { width: 100%; }
    .page-head .page-actions select { flex: 1 1 100%; }
    .page-head .page-actions .btn { flex: 1 1 auto; }
}
