@font-face { font-family: "Dubai"; font-weight: 300; font-display: swap; src: local("Dubai Light"), url("../fonts/DUBAI-LIGHT.TTF") format("truetype"); }
@font-face { font-family: "Dubai"; font-weight: 400; font-display: swap; src: local("Dubai"), local("Dubai Regular"), url("../fonts/DUBAI-REGULAR.TTF") format("truetype"); }
@font-face { font-family: "Dubai"; font-weight: 500; font-display: swap; src: local("Dubai Medium"), url("../fonts/DUBAI-MEDIUM.TTF") format("truetype"); }
@font-face { font-family: "Dubai"; font-weight: 600 700; font-display: swap; src: local("Dubai Bold"), url("../fonts/DUBAI-BOLD.TTF") format("truetype"); }

:root {
    --brand: #2b2f33;
    --brand-dark: #1a1c1f;
    --brand-soft: #e4e7ea;
    --accent: #6390ce;
    --good: #2e9e6b;
    --mid: #e0a030;
    --bad: #d6483f;
    --idle: #9aa1a9;
    --ink: #1f2226;
    --muted: #6b7280;
    --surface: #ffffff;
    --page: #f2f3f5;
    --line: #e5e7eb;
    --radius: .75rem;
    --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
    --bs-primary: var(--brand);
    --bs-primary-rgb: 43, 47, 51;
    --bs-link-color: #3f6fb0;
    --bs-link-hover-color: #2c5088;
    --bs-body-font-family: "Dubai", "Segoe UI", system-ui, sans-serif;
}

body {
    background: var(--page);
    color: var(--ink);
    font-family: "Dubai", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Navbar ---------- */
.navbar.bg-primary {
    background: linear-gradient(135deg, #15171a, #2b2f33) !important;
    border-bottom: 3px solid var(--accent);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
}
.navbar-brand { padding: 0; }
.brand-logo { height: 26px; width: auto; display: block; }
.login-logo { display: block; height: 30px; width: auto; margin: 0 auto 1.25rem; }
.navbar .nav-link { border-radius: .5rem; padding: .45rem .8rem !important; margin: 0 .1rem; color: rgba(255, 255, 255, .85); }
.navbar .nav-link:hover, .navbar .nav-link.show { background: rgba(255, 255, 255, .15); color: #fff; }
.navbar .dropdown-menu { border: 0; border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0, 0, 0, .15); padding: .4rem; }
.navbar .dropdown-item { border-radius: .4rem; }
.navbar-text { color: rgba(255, 255, 255, .9) !important; font-size: .9rem; }

/* ---------- Typography ---------- */
main h2 { font-weight: 700; font-size: 1.6rem; color: var(--brand-dark); }
main h4, main h5, main h6 { font-weight: 600; }
.text-muted { color: var(--muted) !important; }

/* ---------- Buttons ---------- */
.btn { border-radius: .55rem; font-weight: 500; padding: .45rem 1rem; }
.btn-sm { padding: .25rem .65rem; }
.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover, .btn-primary:focus { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-outline-primary { color: var(--brand); border-color: var(--brand); }
.btn-outline-primary:hover { color: #fff; background: var(--brand); border-color: var(--brand); }
.btn-success { background: #16a34a; border-color: #16a34a; }

/* ---------- Tables ---------- */
main table.table {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    border-collapse: separate;
    border-spacing: 0;
    --bs-table-bg: var(--surface);
}
main table.table thead th {
    background: #eceef0;
    color: var(--brand-dark);
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 2px solid var(--brand-soft);
    padding: .8rem .85rem;
    white-space: nowrap;
}
main table.table td { padding: .75rem .85rem; border-color: var(--line); }
main table.table tbody tr:hover > * { background: #f7f8f9; }
main table.table tbody tr:last-child > * { border-bottom: 0; }

/* ---------- Forms ---------- */
.form-control, .form-select { border-radius: .55rem; border-color: #d1d5db; }
.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 .2rem rgba(99, 144, 206, .30);
}
.form-label { font-weight: 500; font-size: .9rem; margin-bottom: .25rem; }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-panel {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem 1.5rem 1.5rem 1rem;
    margin: 0 !important;
    max-width: 760px;
}
form.form-panel { padding: 1.5rem; }

/* ---------- Cards / dashboard ---------- */
.card { border: 0; border-radius: var(--radius); box-shadow: var(--shadow); }
.stat-card { border-left: 5px solid var(--brand); transition: transform .15s, box-shadow .15s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(16, 24, 40, .1); }
.stat-card .stat-value { font-size: 2.2rem; font-weight: 700; line-height: 1.1; color: var(--brand-dark); }
.stat-card .stat-label { color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }
.stat-card.warn { border-left-color: #f59e0b; }
.stat-card.warn .stat-value { color: #b45309; }
.stat-card.ok { border-left-color: #16a34a; }
.stat-card.ok .stat-value { color: #15803d; }
.stat-card.idle { border-left-color: #94a3b8; }
.stat-card.idle .stat-value { color: #475569; }

/* ---------- Login ---------- */
.login-wrap { min-height: 60vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 100%; max-width: 400px; padding: 2rem; border-top: 5px solid var(--brand); }
.login-card h2 { text-align: center; margin-bottom: .25rem; }
.login-card .sub { text-align: center; color: var(--muted); margin-bottom: 1.5rem; }

/* ---------- NIC checklist ---------- */
.question-card { border-left: 5px solid #dc2626; transition: border-color .2s; }
.question-card.incomplete { border-left-color: #dc2626; }
.question-card.complete { border-left-color: #16a34a; }
.question-card .card-title { color: var(--ink); line-height: 1.4; }
.question-card .form-check-inline { margin-right: 1.25rem; }
.question-card .form-check-input[type=radio]:checked[value="No"] { background-color: #dc2626; border-color: #dc2626; }
.question-card .form-check-input[type=radio]:checked[value="N/A"] { background-color: #6b7280; border-color: #6b7280; }
.question-card .badge.category { background: var(--brand-soft); color: var(--brand-dark); border: 0; font-weight: 600; }
.question-card textarea { resize: vertical; }

/* ---------- Alerts / badges ---------- */
.alert { border: 0; border-radius: var(--radius); box-shadow: var(--shadow); }
.badge { font-weight: 600; padding: .4em .7em; border-radius: 2rem; }
.score-big { font-size: 2.6rem; font-weight: 700; color: var(--brand); line-height: 1; }

footer.site-footer { color: var(--muted); font-size: .8rem; text-align: center; padding: 1.5rem 0; }

img, video { max-width: 100%; height: auto; }
.table-responsive { border-radius: var(--radius); box-shadow: var(--shadow); background: var(--surface); margin-bottom: 1rem; }
.table-responsive > table.table { box-shadow: none; margin-bottom: 0; }
.navbar-toggler { border-color: rgba(255, 255, 255, .5); }
td, th { overflow-wrap: anywhere; }
main table.table td, main table.table th { overflow-wrap: normal; }

@media (max-width: 991px) {
    .navbar-collapse { padding: .5rem 0; }
    .navbar .nav-link { margin: .1rem 0; }
}

@media (max-width: 767px) {
    body { font-size: .95rem; }
    main.container { padding-left: 12px; padding-right: 12px; }
    main h2 { font-size: 1.3rem; }
    .score-big { font-size: 2rem; }
    .stat-card .stat-value { font-size: 1.7rem; }
    .form-panel, form.form-panel { padding: 1rem; max-width: 100%; }
    .login-card { padding: 1.25rem; }
    .login-wrap { min-height: 50vh; align-items: flex-start; padding-top: 1rem; }
    .btn { padding: .5rem .9rem; }                 /* larger touch targets */
    .question-card .form-check-inline { margin-right: .9rem; }
    .question-card .card-body { padding: .9rem; }
    .question-card .d-flex.justify-content-between { flex-direction: column; gap: .35rem; }
    main table.table td, main table.table th { padding: .6rem .6rem; font-size: .88rem; }
    main table.table td { white-space: nowrap; }
    main table.table td:nth-child(n+2):not(.wrap) { white-space: normal; min-width: 8rem; }
    main > .d-flex.justify-content-between { flex-wrap: wrap; gap: .5rem; }
    main > .d-flex.gap-2 { flex-wrap: wrap; }
    footer.site-footer { padding: 1rem .75rem; }
}


/* =====================================================================
   Inner portal theme (charcoal) - shared across all admin / NIC pages
   ===================================================================== */
.progress { --bs-progress-bar-bg: var(--brand); --bs-progress-bg: #e4e7ea; }
.card-header {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    font-weight: 600;
    color: var(--brand);
    padding: .85rem 1.1rem;
    border-radius: var(--radius) var(--radius) 0 0 !important;
}
.navbar .nav-link.active { background: rgba(255, 255, 255, .14); color: #fff; box-shadow: inset 0 -2px 0 var(--accent); }
.btn-outline-light:hover { color: var(--brand-dark); }
.btn-link { color: var(--bs-link-color); }
.dropdown-item:active, .dropdown-item.active { background: var(--brand); }
.page-link { color: var(--brand); }
.page-item.active .page-link { background: var(--brand); border-color: var(--brand); }
.badge.bg-secondary { background-color: var(--idle) !important; }
.badge.bg-success { background-color: var(--good) !important; }
.badge.bg-danger { background-color: var(--bad) !important; }
.badge.bg-warning { background-color: var(--mid) !important; color: #2a1f05 !important; }
::selection { background: rgba(99, 144, 206, .35); }
.form-control:disabled, .form-select:disabled { background: #eef0f2; }
h2 { letter-spacing: -.2px; }

/* =====================================================================
   Admin dashboard
   ===================================================================== */
.dash-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.dash-head h2 { margin: 0; }

.filter-card { border-top: 3px solid var(--brand); }
.range-chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip {
    border: 1px solid #d3d7dc; background: var(--surface); color: var(--ink);
    border-radius: 2rem; padding: .25rem .9rem; font-size: .85rem; font-family: inherit; cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}
.chip:hover { border-color: var(--brand); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.filter-pill {
    background: #e9edf4; color: #2c4a78; border-radius: 2rem; padding: .15rem .7rem; font-size: .8rem;
    text-decoration: none; border: 1px solid #cdd8ea;
}
.filter-pill:hover { background: #dbe4f3; color: #1d3558; }

/* KPI tiles */
.kpi {
    display: block; height: 100%; text-decoration: none; color: var(--ink);
    background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: .9rem 1rem; border-top: 4px solid var(--brand);
    transition: transform .15s, box-shadow .15s;
}
a.kpi:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(16, 24, 40, .12); color: var(--ink); }
.kpi.good { border-top-color: var(--good); }
.kpi.mid { border-top-color: var(--mid); }
.kpi.bad { border-top-color: var(--bad); }
.kpi.idle { border-top-color: var(--idle); }
.kpi-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.kpi-value { font-size: 2rem; font-weight: 700; line-height: 1.15; color: var(--brand-dark); }
.kpi.good .kpi-value { color: var(--good); }
.kpi.mid .kpi-value { color: #b57a0e; }
.kpi.bad .kpi-value { color: var(--bad); }
.kpi-sub { font-size: .78rem; color: var(--muted); }

/* Donut */
.donut { width: 168px; height: 168px; border-radius: 50%; position: relative; }
.donut::after { content: ""; position: absolute; inset: 24px; border-radius: 50%; background: var(--surface); }
.donut-center { position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut-num { font-size: 1.9rem; font-weight: 700; color: var(--brand-dark); line-height: 1; }
.donut-cap { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.legend { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; }
.legend.inline { flex-direction: row; gap: 1rem; font-size: .8rem; font-weight: 400; color: var(--muted); }
.legend b { margin-left: .35rem; }
.dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; margin-right: .4rem; background: var(--idle); }
.dot.good { background: var(--good); }
.dot.mid { background: var(--mid); }
.dot.idle { background: var(--idle); }
.dot.started { background: var(--accent); }

/* Trend chart */
.trend { display: flex; align-items: stretch; gap: 6px; height: 200px; }
.trend-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.trend-bars { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 2px; border-bottom: 1px solid var(--line); }
.trend .bar { flex: 1; max-width: 22px; min-height: 2px; border-radius: 4px 4px 0 0; position: relative; transition: opacity .15s; }
.trend .bar span { position: absolute; top: -1.1rem; left: 50%; transform: translateX(-50%); font-size: .68rem; color: var(--muted); }
.trend .bar.started { background: var(--accent); }
.trend .bar.submitted { background: var(--good); }
.trend-col:hover .bar { opacity: .8; }
.trend-label { height: 1.4rem; font-size: .68rem; color: var(--muted); text-align: center; white-space: nowrap; overflow: visible; padding-top: .25rem; }
.trend { padding-top: 1.2rem; }

/* Meters */
.meter { height: 10px; background: #e4e7ea; border-radius: 1rem; overflow: hidden; }
.meter.sm { height: 7px; margin-bottom: .2rem; }
.meter-fill { height: 100%; border-radius: 1rem; background: var(--brand); }
.meter-fill.good { background: var(--good); }
.meter-fill.mid { background: var(--mid); }
.meter-fill.bad { background: var(--bad); }
.cat-row { margin-bottom: 1rem; }
.cat-row:last-child { margin-bottom: 0; }

.pill { display: inline-block; font-weight: 600; font-size: .8rem; padding: .15rem .6rem; border-radius: 2rem; background: #e4e7ea; color: var(--ink); }
.pill.good { background: #dff3ea; color: #1b7a50; }
.pill.mid { background: #fbefd2; color: #8a5d08; }
.pill.bad { background: #fbe1df; color: #a8302a; }

.weak-list { padding-left: 1.2rem; margin: 0; }
.weak-list li { margin-bottom: .9rem; padding-bottom: .9rem; border-bottom: 1px dashed var(--line); }
.weak-list li:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
.weak-text { font-size: .9rem; line-height: 1.35; }
.badge.category { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }

.table-search { max-width: 280px; }
.empty { color: var(--muted); text-align: center; padding: 2rem 1rem; font-size: .9rem; }

@media (max-width: 767px) {
    .kpi-value { font-size: 1.6rem; }
    .donut { width: 140px; height: 140px; }
    .donut::after { inset: 20px; }
    .trend { height: 170px; }
    .table-search { max-width: 100%; width: 100%; }
}

/* Checklist item code, e.g. NUT-03 */
.q-code {
    display: inline-block; font-weight: 600; font-size: .78rem; letter-spacing: .03em; line-height: 1.5;
    background: var(--brand); color: #fff; border-radius: .4rem; padding: .05rem .45rem;
    margin-right: .4rem; white-space: nowrap; vertical-align: baseline;
}

a.chip { text-decoration: none; display: inline-block; }
a.chip:hover { color: var(--ink); }
a.chip.active:hover { color: #fff; }
