/* =====================================================================================
   Gold App — admin portal theme (Arabic RTL, Bootstrap 5.3 RTL underneath)
   Colours are placeholders until the authority's visual identity guide is available:
   change the tokens below and the whole portal follows.
   ===================================================================================== */

@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 400; font-display: swap; src: url("../lib/fonts/ibm-plex-sans-arabic/plex-arabic-400.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 500; font-display: swap; src: url("../lib/fonts/ibm-plex-sans-arabic/plex-arabic-500.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 600; font-display: swap; src: url("../lib/fonts/ibm-plex-sans-arabic/plex-arabic-600.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 700; font-display: swap; src: url("../lib/fonts/ibm-plex-sans-arabic/plex-arabic-700.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 400; font-display: swap; src: url("../lib/fonts/ibm-plex-sans-arabic/plex-latin-400.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 500; font-display: swap; src: url("../lib/fonts/ibm-plex-sans-arabic/plex-latin-500.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 600; font-display: swap; src: url("../lib/fonts/ibm-plex-sans-arabic/plex-latin-600.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 700; font-display: swap; src: url("../lib/fonts/ibm-plex-sans-arabic/plex-latin-700.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC; }

:root {
    --ga-navy: #14213d;
    --ga-navy-2: #1c2c4f;
    --ga-navy-3: #253a66;
    --ga-gold: #b08a2e;
    --ga-gold-dark: #8d6e22;
    --ga-gold-light: #d9b864;
    --ga-gold-soft: #f7f0de;
    --ga-bg: #f3f5f9;
    --ga-surface: #ffffff;
    --ga-border: #e3e7ee;
    --ga-text: #1d2433;
    --ga-muted: #687287;
    --ga-radius: 12px;
    --ga-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
    --ga-sidebar-width: 268px;
    --ga-topbar-height: 64px;

    --bs-body-font-family: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
    --bs-body-color: var(--ga-text);
    --bs-body-bg: var(--ga-bg);
    --bs-border-color: var(--ga-border);
    --bs-link-color: var(--ga-gold-dark);
    --bs-link-color-rgb: 141, 110, 34;
    --bs-link-hover-color: var(--ga-navy-3);
    --bs-link-hover-color-rgb: 37, 58, 102;
}

html { font-size: 15px; }
body { background: var(--ga-bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5, .fw-semibold { font-weight: 600; }
a { text-decoration: none; }
code { color: var(--ga-navy-3); }

/* ---------- Layout ---------- */
.ga-sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    width: var(--ga-sidebar-width);
    background: linear-gradient(180deg, var(--ga-navy) 0%, var(--ga-navy-2) 100%);
    color: #c9d1e3;
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform .25s ease;
}

.ga-main { margin-inline-start: var(--ga-sidebar-width); min-height: 100vh; display: flex; flex-direction: column; }
.ga-content { padding: 28px 32px 40px; flex: 1; }

.ga-brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 18px; color: #fff; border-bottom: 1px solid rgba(255, 255, 255, .07); }
.ga-brand:hover { color: #fff; }
.ga-emblem {
    width: 44px; height: 44px; flex: 0 0 44px; border-radius: 12px;
    display: grid; place-items: center; font-size: 1.35rem; color: var(--ga-navy);
    background: linear-gradient(135deg, var(--ga-gold-light), var(--ga-gold));
    box-shadow: 0 4px 12px rgba(176, 138, 46, .35);
}
.ga-brand-name { font-weight: 600; font-size: .95rem; line-height: 1.35; }
.ga-brand-sub { font-size: .78rem; color: var(--ga-gold-light); }

.ga-nav { padding: 12px 12px 20px; overflow-y: auto; flex: 1; }
.ga-nav-section { font-size: .72rem; color: #8592ad; letter-spacing: .02em; padding: 16px 12px 6px; }
.ga-nav-link {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 2px;
    border-radius: 10px; color: #c9d1e3; font-weight: 500; position: relative;
}
.ga-nav-link .bi { font-size: 1.1rem; width: 22px; text-align: center; color: #8f9cb8; }
.ga-nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.ga-nav-link:hover .bi { color: #fff; }
.ga-nav-link.active { background: rgba(217, 184, 100, .14); color: #fff; }
.ga-nav-link.active .bi { color: var(--ga-gold-light); }
.ga-nav-link.active::before {
    content: ""; position: absolute; inset-block: 8px; inset-inline-start: -12px;
    width: 4px; border-radius: 0 4px 4px 0; background: var(--ga-gold-light);
}
.ga-sidebar-footer { padding: 14px 20px; font-size: .75rem; color: #7f8aa3; border-top: 1px solid rgba(255, 255, 255, .07); }
.ga-env { display: inline-block; padding: 2px 8px; border-radius: 6px; background: rgba(217, 184, 100, .16); color: var(--ga-gold-light); }

.ga-topbar {
    position: sticky; top: 0; z-index: 1030; height: var(--ga-topbar-height);
    display: flex; align-items: center; gap: 16px; padding: 0 32px;
    background: rgba(255, 255, 255, .92); backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--ga-border);
}
.ga-topbar-date { color: var(--ga-muted); font-size: .88rem; }
.ga-menu-toggle { display: none; border: 0; background: transparent; font-size: 1.5rem; color: var(--ga-text); padding: 4px; }

.ga-user { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; padding: 4px 6px; border-radius: 10px; color: var(--ga-text); }
.ga-user:hover, .ga-user[aria-expanded="true"] { background: var(--ga-bg); }
.ga-avatar {
    width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
    background: var(--ga-navy-3); color: #fff; font-weight: 600;
}
.ga-user-name { font-weight: 600; font-size: .9rem; line-height: 1.2; text-align: start; }
.ga-user-role { font-size: .75rem; color: var(--ga-muted); text-align: start; }

.ga-footer { padding: 16px 32px; color: var(--ga-muted); font-size: .8rem; border-top: 1px solid var(--ga-border); background: var(--ga-surface); }
.ga-backdrop { display: none; }

@media (max-width: 991.98px) {
    .ga-sidebar { transform: translateX(100%); box-shadow: none; }
    body.ga-sidebar-open .ga-sidebar { transform: none; box-shadow: -8px 0 32px rgba(0, 0, 0, .25); }
    body.ga-sidebar-open .ga-backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 1035; }
    .ga-main { margin-inline-start: 0; }
    .ga-menu-toggle { display: inline-flex; }
    .ga-content { padding: 20px 16px 32px; }
    .ga-topbar, .ga-footer { padding-inline: 16px; }
    .ga-topbar-date, .ga-user-text { display: none; }
}

/* ---------- Page header ---------- */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.page-title { font-size: 1.55rem; margin: 0; }
.page-subtitle { color: var(--ga-muted); margin: 4px 0 0; }
.page-back { display: inline-flex; align-items: center; gap: 6px; color: var(--ga-muted); font-size: .88rem; margin-bottom: 8px; }
.page-back:hover { color: var(--ga-gold-dark); }

/* ---------- Cards ---------- */
.card { border: 1px solid var(--ga-border); border-radius: var(--ga-radius); box-shadow: var(--ga-shadow); }
.card-header { background: transparent; border-bottom: 1px solid var(--ga-border); padding: 16px 20px; font-weight: 600; }
.card-body { padding: 20px; }
.card-title-sm { font-size: 1rem; font-weight: 600; margin-bottom: 4px; }
.section-title { font-size: 1rem; font-weight: 600; margin: 0 0 12px; }

.stat-card { display: flex; align-items: center; gap: 16px; padding: 20px; height: 100%; color: inherit; transition: transform .15s ease, box-shadow .15s ease; }
a.stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(16, 24, 40, .08); color: inherit; }
.stat-icon { width: 48px; height: 48px; flex: 0 0 48px; border-radius: 12px; display: grid; place-items: center; font-size: 1.35rem; }
.stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1.1; }
.stat-label { color: var(--ga-muted); font-size: .88rem; }
.tone-gold { background: var(--ga-gold-soft); color: var(--ga-gold-dark); }
.tone-green { background: #e7f6ee; color: #1b7f4b; }
.tone-red { background: #fdecec; color: #b42318; }
.tone-blue { background: #e8effc; color: #2952a3; }
.tone-gray { background: #eef1f5; color: #4a5468; }

/* ---------- Tables ---------- */
.table-card { overflow: hidden; }
.table-card .table { margin: 0; }
.table > :not(caption) > * > * { padding: 12px 16px; border-bottom-color: var(--ga-border); }
.table thead th { background: #f8f9fc; color: var(--ga-muted); font-weight: 500; font-size: .82rem; white-space: nowrap; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #fafbfd; }
.table .cell-ltr { direction: ltr; text-align: end; unicode-bidi: plaintext; }
.table-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--ga-border); }
.empty-state { text-align: center; padding: 48px 16px; color: var(--ga-muted); }
.empty-state .bi { font-size: 2.2rem; color: #b7bfcd; display: block; margin-bottom: 8px; }

/* ---------- Badges ---------- */
.badge-soft { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: .78rem; font-weight: 500; }
.badge-soft::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-soft.success { background: #e7f6ee; color: #1b7f4b; }
.badge-soft.danger { background: #fdecec; color: #b42318; }
.badge-soft.warning { background: #fff4e0; color: #a35c00; }
.badge-soft.gray { background: #eef1f5; color: #4a5468; }
.badge-soft.gold { background: var(--ga-gold-soft); color: var(--ga-gold-dark); }
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; background: #eef1f5; color: #3d4659; font-size: .78rem; margin: 2px 0 2px 4px; }

/* ---------- Buttons & forms ---------- */
.btn { border-radius: 10px; font-weight: 500; padding: .5rem 1rem; }
.btn-sm { border-radius: 8px; padding: .3rem .7rem; }
.btn-gold { background: var(--ga-gold); border-color: var(--ga-gold); color: #fff; }
.btn-gold:hover, .btn-gold:focus-visible, .btn-gold:active { background: var(--ga-gold-dark) !important; border-color: var(--ga-gold-dark) !important; color: #fff !important; }
.btn-outline-gold { border-color: var(--ga-gold); color: var(--ga-gold-dark); }
.btn-outline-gold:hover { background: var(--ga-gold-soft); color: var(--ga-gold-dark); border-color: var(--ga-gold); }
.btn-light { background: #fff; border-color: var(--ga-border); }
.form-control, .form-select { border-radius: 10px; border-color: #d6dce6; padding: .55rem .8rem; background-color: #fff; }
.form-control[readonly] { background-color: #f6f7fa; }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: var(--ga-gold); box-shadow: 0 0 0 .2rem rgba(176, 138, 46, .18); }
.form-check-input:checked { background-color: var(--ga-gold); border-color: var(--ga-gold); }
.form-label { font-weight: 500; font-size: .9rem; margin-bottom: 6px; }
.form-text { color: var(--ga-muted); }
.input-icon { position: relative; }
.input-icon .bi { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--ga-muted); }
.input-icon .form-control { padding-inline-start: 38px; }

.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.check-tile { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--ga-border); border-radius: 10px; background: #fff; cursor: pointer; margin: 0; }
.check-tile:hover { border-color: var(--ga-gold-light); }
.check-tile .form-check-input { margin: 0; flex: 0 0 auto; }
.check-tile:has(.form-check-input:checked) { border-color: var(--ga-gold); background: var(--ga-gold-soft); }
fieldset:disabled .check-tile { cursor: default; opacity: .85; }

.alert { border-radius: 10px; border: 0; }
.alert-success { background: #e7f6ee; color: #135c37; }
.alert-danger { background: #fdecec; color: #8d1c14; }
.alert-warning { background: #fff4e0; color: #7a4500; }
.alert-info { background: #e8effc; color: #1f3f80; }

.pagination { --bs-pagination-active-bg: var(--ga-gold); --bs-pagination-active-border-color: var(--ga-gold); --bs-pagination-color: var(--ga-text); --bs-pagination-border-radius: 8px; gap: 4px; }
.pagination .page-link { border-radius: 8px !important; }
.secret-box { background: #fffbef; border: 1px dashed var(--ga-gold); border-radius: 12px; padding: 16px 20px; }
.secret-box code { font-size: 1.25rem; letter-spacing: .04em; color: var(--ga-text); }
.dl-grid { display: grid; grid-template-columns: minmax(130px, 34%) 1fr; margin: 0; }
.dl-grid dt, .dl-grid dd { padding: 12px 0; border-bottom: 1px solid var(--ga-border); margin: 0; }
.dl-grid dt { color: var(--ga-muted); font-weight: 400; }
.dl-grid > :nth-last-child(-n+2) { border-bottom: 0; }
.audit-fields { font-size: .8rem; line-height: 1.6; }
.audit-fields .k { color: var(--ga-muted); }
.audit-fields .old { color: var(--ga-muted); text-decoration: line-through; text-decoration-color: rgba(104, 114, 135, .5); }
.json-diff { font-family: ui-monospace, Consolas, monospace; font-size: .76rem; color: var(--ga-muted); direction: ltr; text-align: left; word-break: break-all; }
.json-diff .new { color: var(--ga-text); }

/* ---------- Sign-in pages ---------- */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.auth-brand {
    background: radial-gradient(circle at 20% 15%, rgba(217, 184, 100, .18), transparent 45%), linear-gradient(160deg, var(--ga-navy) 0%, var(--ga-navy-3) 100%);
    color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between;
}
.auth-brand .ga-emblem { width: 64px; height: 64px; font-size: 2rem; border-radius: 16px; }
.auth-brand h1 { font-size: 1.9rem; margin: 28px 0 12px; line-height: 1.45; }
.auth-brand h1 .auth-sub { display: block; color: var(--ga-gold-light); font-size: 1.15rem; font-weight: 500; margin-top: 6px; }
.auth-brand p { color: #c9d1e3; max-width: 30rem; }
.auth-points { list-style: none; padding: 0; margin: 28px 0 0; }
.auth-points li { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; color: #dfe5f1; }
.auth-points .bi { color: var(--ga-gold-light); }
.auth-form-side { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--ga-surface); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h2 { font-size: 1.5rem; margin-bottom: 6px; }
.auth-card .lead-muted { color: var(--ga-muted); margin-bottom: 28px; }
.auth-footer { color: #8592ad; font-size: .8rem; }
.code-input { text-align: center; font-size: 1.6rem; letter-spacing: .5em; direction: ltr; font-weight: 600; }
.qr-box { display: inline-block; padding: 12px; border: 1px solid var(--ga-border); border-radius: 16px; background: #fff; }
.steps { counter-reset: step; list-style: none; padding: 0; }
.steps li { counter-increment: step; display: flex; gap: 12px; margin-bottom: 14px; }
.steps li::before { content: counter(step); flex: 0 0 28px; height: 28px; border-radius: 50%; background: var(--ga-gold-soft); color: var(--ga-gold-dark); display: grid; place-items: center; font-weight: 600; }

@media (max-width: 991.98px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-brand { padding: 28px 24px; }
    .auth-brand h1 { font-size: 1.3rem; margin: 16px 0 0; }
    .auth-brand p, .auth-points, .auth-footer { display: none; }
}

/* ---- Content (CMS) ---- */
.status-tabs { gap: 4px; flex-wrap: wrap; }
.status-tabs .nav-link { color: var(--ga-muted); border-radius: 999px; padding: 6px 14px; font-size: .88rem; }
.status-tabs .nav-link.active { background: var(--ga-navy); color: #fff; }
.status-tabs .count { display: inline-block; min-width: 22px; padding: 0 6px; margin-inline-start: 4px; border-radius: 999px; background: rgba(104, 114, 135, .12); font-size: .75rem; text-align: center; }
.status-tabs .nav-link.active .count { background: rgba(255, 255, 255, .2); }

.rte { border: 1px solid var(--ga-border); border-radius: 8px; background: var(--ga-surface); }
.rte-toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; border-bottom: 1px solid var(--ga-border); background: #f8f9fb; border-radius: 8px 8px 0 0; }
.rte-sep { width: 1px; background: var(--ga-border); margin: 2px 4px; }
.rte-area { min-height: 260px; padding: 12px 14px; outline: none; line-height: 1.8; }
.rte-area:focus { box-shadow: inset 0 0 0 2px var(--ga-gold-soft); }
.rte-area[contenteditable="false"] { background: #f8f9fb; }
.rte-area h2 { font-size: 1.3rem; } .rte-area h3 { font-size: 1.12rem; }
.rte-area blockquote { border-inline-start: 3px solid var(--ga-gold); padding-inline-start: 12px; color: var(--ga-muted); }
fieldset:disabled .rte-toolbar { display: none; }

/* ---- Complaints ---- */
.row-overdue > td { background: #fff6f5; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--ga-border); }
.timeline > li:last-child { border-bottom: 0; }
.timeline-icon { flex: 0 0 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #eef1f5; color: var(--ga-navy-3); }
.timeline-body { flex: 1; min-width: 0; }
.timeline > li.internal .timeline-icon { background: #f1ecf9; color: #5b3f8c; }
.timeline > li.internal .timeline-body { background: #faf8fd; border-radius: 8px; padding: 6px 10px; }
.timeline > li.official .timeline-icon { background: #e7f6ee; color: #1b7f4b; }

/* ---- Public certificate check page (ACC-03 / INT-09) ---- */
.verify-page { min-height: 100vh; background: linear-gradient(180deg, var(--ga-navy) 0, var(--ga-navy) 220px, var(--ga-bg) 220px); }
.verify-shell { max-width: 560px; margin: 0 auto; padding: 32px 16px; }
.verify-header { display: flex; align-items: center; gap: 12px; color: #fff; margin-bottom: 24px; }
.verify-card { border: 0; border-radius: var(--ga-radius); box-shadow: 0 8px 24px rgba(16, 24, 40, .12); }
.verify-card .card-body { padding: 24px; }
.verify-status { display: flex; align-items: center; gap: 10px; font-size: 1.25rem; font-weight: 700; margin-bottom: 16px; }
.verify-status i { font-size: 1.75rem; }
.verify-status.success { color: #1b7f4b; }
.verify-status.warning { color: #a35c00; }
.verify-status.danger { color: #b42318; }
.verify-status.gray { color: #4a5468; }
.verify-note { color: var(--ga-muted); font-size: .85rem; margin: 16px 4px 0; }
.verify-footer { color: var(--ga-muted); font-size: .8rem; text-align: center; margin-top: 32px; }

/* ---------- Reports (RPT-04) ---------- */
.report-filters { display: flex; flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 16px 20px; margin-bottom: 24px; }
.report-filters > div { min-width: 10rem; flex: 1 1 10rem; max-width: 14rem; }
.report-filters .btn { flex: 0 0 auto; }
.column-chart-plot { position: relative; display: flex; align-items: flex-end; gap: 2px; height: 160px; padding-top: 20px; border-bottom: 1px solid var(--ga-border); }
.column-chart-max { position: absolute; top: 0; inset-inline-end: 0; font-size: .75rem; color: var(--ga-muted); }
.column-chart-col { flex: 1 1 0; height: 100%; display: flex; align-items: flex-end; min-width: 2px; outline: none; }
.column-chart-bar { display: block; width: 100%; min-height: 1px; background: var(--ga-gold); border-radius: 4px 4px 0 0; }
.column-chart-col:hover .column-chart-bar, .column-chart-col:focus-visible .column-chart-bar { background: var(--ga-gold-dark); }
.column-chart-axis { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: .78rem; color: var(--ga-muted); }
.report-bar { height: 8px; border-radius: 4px; background: #eef1f5; min-width: 4rem; }
.report-bar > span { display: block; height: 100%; border-radius: 4px; background: var(--ga-gold); }
.report-figure { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.report-figure small { font-size: .85rem; font-weight: 500; color: var(--ga-muted); }

@media print {
    .ga-sidebar, .ga-topbar, .ga-backdrop, .report-filters { display: none !important; }
    .ga-main { margin: 0 !important; padding: 0 !important; }
    body { background: #fff; }
    .card { box-shadow: none; break-inside: avoid; }
    .column-chart-bar { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
