/* ============================================================
   GHDI NGO Management Information System — Design System
   Garkuwa Humanitarian and Development Initiative
   ============================================================ */
:root {
  /* GHDI 2026 brand palette */
  /* primary = navy #011F5B · azure #0081D2 · magenta accent #EB0160 · amber #FD9A01 */
  --ghdi-primary: #011F5B;
  --ghdi-primary-dark: #011949;
  --ghdi-primary-darker: #011338;
  --ghdi-primary-soft: #EEF4FB;
  --ghdi-accent: #EB0160;
  --ghdi-accent-soft: #FDE7F0;
  --ghdi-azure: #0081D2;
  --ghdi-azure-soft: #E0F1FD;
  --ghdi-emerald: #0E9F6E;
  --ghdi-emerald-soft: #DEF7EC;
  --ghdi-blue: #0081D2;
  --ghdi-blue-soft: #E0F1FD;
  --ghdi-amber: #FD9A01;
  --ghdi-amber-soft: #FFF3DE;
  --ghdi-red: #EB0160;
  --ghdi-red-soft: #FDE7F0;
  --ghdi-gray-soft: #F1F5F9;
  --ghdi-violet: #6D28D9;
  --ghdi-violet-soft: #EDE9FE;
  --bg: #f6f8f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-full: 9999px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.05);
  --shadow: 0 1px 3px rgba(15,23,42,.06), 0 4px 14px rgba(15,23,42,.05);
  --shadow-lg: 0 10px 30px rgba(15,23,42,.10);
  --font-sans: "DM Sans","Segoe UI",system-ui,-apple-system,"Helvetica Neue",Arial,sans-serif;
  --font-display: "Manrope","Segoe UI",system-ui,sans-serif;
  --font-accent: "Playfair Display",Georgia,serif;
}
/* Reset & base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font-sans); font-size: 15px; line-height: 1.55;
  color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased;
}
h1,h2,h3,h4,h5,h6 { margin: 0 0 .5em; font-family:var(--font-display); font-weight: 700; letter-spacing: -.015em; color: var(--text); }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
a { color: var(--ghdi-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
:focus-visible { outline: 3px solid rgba(15,118,110,.45); outline-offset: 2px; border-radius: 4px; }
::selection { background: rgba(15,118,110,.18); }

/* Layout shell */
.app-shell { display: flex; min-height: 100vh; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-content { flex: 1; padding: 24px 28px 96px; max-width: 1480px; width: 100%; margin: 0 auto; }
@media (max-width: 640px) { .app-content { padding: 16px 14px 110px; } }

/* Sidebar */
.sidebar {
  width: 264px; flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 40;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 18px 20px 14px; }
.sidebar-brand .logo-mark {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--ghdi-primary), var(--ghdi-emerald));
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 15px;
  box-shadow: var(--shadow-sm);
}
.sidebar-brand .brand-name { font-weight: 750; font-size: 15px; line-height: 1.2; }
.sidebar-brand .brand-sub { font-size: 11px; color: var(--text-muted); }
.sidebar-nav { padding: 8px 12px 20px; flex: 1; }
.sidebar-section { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); font-weight: 700; padding: 16px 10px 6px; }
.sidebar-link {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; margin: 1px 0;
  border-radius: var(--r-sm); color: var(--text-secondary); font-weight: 500;
  font-size: 14px; transition: background .12s, color .12s;
}
.sidebar-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.sidebar-link.active { background: var(--ghdi-primary-soft); color: var(--ghdi-primary-dark); font-weight: 600; }
.sidebar-link .icon { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }
.sidebar-footer { padding: 14px 20px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-muted); }

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px;
  padding: 12px 28px; background: rgba(255,255,255,.85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
@media (max-width: 640px) { .topbar { padding: 10px 14px; } }
.topbar-search { flex: 1; max-width: 460px; position: relative; }
.topbar-search-form { width: 100%; margin: 0; }
.search-input {
  width: 100%; padding: 9px 14px 9px 38px; border-radius: var(--r-full);
  border: 1px solid var(--border); background: var(--surface-2);
  font-size: 14px; color: var(--text); transition: border .15s, box-shadow .15s, background .15s;
}
.search-input:focus { outline: none; background: #fff; border-color: var(--ghdi-primary); box-shadow: 0 0 0 3px rgba(15,118,110,.12); }
.search-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--text-muted); pointer-events: none; }
.search-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff;
  border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  overflow: hidden; z-index: 60;
}
.search-group { padding: 8px 12px; border-bottom: 1px solid var(--border); }
.search-group-title { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); font-weight: 700; margin-bottom: 4px; }
.search-item { display: block; padding: 7px 10px; border-radius: 8px; color: var(--text); font-size: 14px; }
.search-item:hover { background: var(--surface-2); text-decoration: none; }

.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.icon-btn {
  position: relative; display: grid; place-items: center; width: 38px; height: 38px;
  border-radius: var(--r-full); border: 1px solid var(--border); background: var(--surface);
  color: var(--text-secondary); cursor: pointer; transition: all .12s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.notif-dot {
  position: absolute; top: 6px; right: 7px; min-width: 16px; height: 16px; border-radius: var(--r-full);
  background: var(--ghdi-red); color: #fff; font-size: 10px; font-weight: 700; display: grid;
  place-items: center; padding: 0 4px; border: 2px solid #fff;
}
.user-chip { display: flex; align-items: center; gap: 9px; padding: 5px 10px 5px 5px; border-radius: var(--r-full); border: 1px solid var(--border); background: var(--surface); cursor: pointer; }
.user-chip:hover { background: var(--surface-2); }
.avatar {
  width: 30px; height: 30px; border-radius: var(--r-full); object-fit: cover;
  background: linear-gradient(135deg, var(--ghdi-primary), var(--ghdi-emerald));
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px;
}
.avatar-sm { width: 26px; height: 26px; font-size: 11px; }
.avatar-lg { width: 64px; height: 64px; font-size: 22px; }
.user-chip .meta { line-height: 1.15; text-align: left; }
.user-chip .meta .name { font-size: 13px; font-weight: 600; }
.user-chip .meta .role { font-size: 11px; color: var(--text-muted); }

/* Dropdowns */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 280px; background: #fff;
  border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  z-index: 70; overflow: hidden;
}
/* Bootstrap's .dropdown-menu defaults to display:none. The workspace menus use
   hidden/data-open so they do not need Bootstrap's .show class. */
.dropdown-menu[data-open] { display: block; }
.dropdown-head { padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 14px; }
.dropdown-item { display: flex; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); color: var(--text); }
.dropdown-item:hover { background: var(--surface-2); text-decoration: none; }
.dropdown-item .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.dropdown-item .t { font-weight: 600; font-size: 13.5px; }
.dropdown-item .b { font-size: 12.5px; color: var(--text-secondary); }
.dropdown-item .time { font-size: 11px; color: var(--text-muted); }
.dropdown-footer { padding: 10px 16px; text-align: center; font-size: 13px; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h3 { margin: 0; font-size: 15px; }
.card-body { padding: 20px; }
.card-body.flush { padding: 0; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--border); }

/* KPI cards */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 18px 20px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
  transition: box-shadow .15s, transform .15s;
}
.kpi:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.kpi .kpi-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; margin-bottom: 12px; }
.kpi .kpi-icon svg { width: 20px; height: 20px; }
.kpi .kpi-label { font-size: 12.5px; color: var(--text-secondary); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi .kpi-value { font-size: 1.65rem; font-weight: 750; letter-spacing: -.03em; margin-top: 2px; }
.kpi .kpi-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.kpi .kpi-trend { font-size: 12px; font-weight: 600; margin-top: 6px; display: inline-flex; align-items: center; gap: 4px; }
.trend-up { color: var(--ghdi-emerald); }
.trend-down { color: var(--ghdi-red); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--r-sm); border: 1px solid transparent;
  font-size: 14px; font-weight: 600; font-family: inherit; cursor: pointer;
  transition: background .12s, border-color .12s, box-shadow .12s, transform .05s;
  text-decoration: none; line-height: 1.2; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--ghdi-primary); color: #fff; }
.btn-primary:hover { background: var(--ghdi-primary-dark); text-decoration: none; }
.btn-accent { background: var(--ghdi-accent); color: #fff; border-color: transparent; box-shadow: 0 4px 14px rgba(235,1,96,.25); }
.btn-accent:hover { background: #C4044F; color: #fff; text-decoration: none; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.btn-danger { background: var(--ghdi-red); color: #fff; }
.btn-danger:hover { background: #C4044F; text-decoration: none; }
.btn-success { background: var(--ghdi-emerald); color: #fff; }
.btn-success:hover { background: #059669; text-decoration: none; }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .55; cursor: not-allowed; }
.btn .spinner { width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-secondary .spinner { border-color: var(--border-strong); border-top-color: var(--text-secondary); }
@keyframes spin { to { transform: rotate(360deg); } }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--r-full);
  font-size: 11.5px; font-weight: 650; line-height: 1.4;
  /* Flex/grid items default to min-width:auto, so a badge holding one long
     unbreakable word (e.g. a partner name) cannot shrink below that word and
     overflows its container. Allow shrinking and let long words break. */
  min-width: 0; max-width: 100%; overflow-wrap: anywhere;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-green { background: var(--ghdi-emerald-soft); color: #047857; }
.badge-blue { background: var(--ghdi-blue-soft); color: #1d4ed8; }
.badge-amber { background: var(--ghdi-amber-soft); color: #b45309; }
.badge-red { background: var(--ghdi-red-soft); color: #b91c1c; }
.badge-gray { background: var(--ghdi-gray-soft); color: #475569; }
.badge-violet { background: var(--ghdi-violet-soft); color: #6d28d9; }

/* Status colour mapping */
.status-approved, .status-active, .status-completed, .status-done, .status-published, .status-open, .status-resolved,
.status-delivered, .status-filled, .status-hired, .status-present, .status-in_use, .status-remote { color: #047857; }
.status-pending, .status-submitted, .status-under_review, .status-in_progress, .status-planned, .status-scheduled, .status-upcoming,
.status-new, .status-ongoing, .status-interview, .status-shortlisted, .status-offer, .status-mitigating, .status-in_store,
.status-leave, .status-on_leave, .status-prospect, .status-reviewing { color: #1d4ed8; }
.status-rejected, .status-cancelled, .status-closed, .status-exited, .status-suspended, .status-delayed, .status-at_risk, .status-critical, .status-high,
.status-urgent, .status-lost, .status-escalated, .status-absent, .status-blocked, .status-failed { color: #b91c1c; }
.status-amber, .status-good, .status-medium, .status-late, .status-investigating, .status-outstanding, .status-received, .status-referred,
.status-partially_retired, .status-under_maintenance, .status-on_hold_review { color: #b45309; }
.status-draft, .status-review, .status-archived, .status-on_hold, .status-held,
.status-retired, .status-disposed, .status-ended, .status-todo, .status-low { color: #475569; }

/* Forms */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-label .req { color: var(--ghdi-red); }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 5px; }
.form-input, .form-textarea, .form-select, select.form-input, input.form-input, textarea.form-input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  font-size: 14px; font-family: inherit; color: var(--text); background: #fff;
  transition: border .12s, box-shadow .12s;
}
.form-input:focus { outline: none; border-color: var(--ghdi-primary); box-shadow: 0 0 0 3px rgba(15,118,110,.12); }
.form-input.is-invalid { border-color: var(--ghdi-red); }
.form-input.is-invalid:focus { box-shadow: 0 0 0 3px rgba(239,68,68,.12); }
.field-errors { list-style: none; margin: 5px 0 0; padding: 0; font-size: 12.5px; color: var(--ghdi-red); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 18px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.form-actions { display: flex; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.form-section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); font-weight: 700; margin: 22px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; padding: 11px 16px; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-muted); font-weight: 700;
  border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap;
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: none; }
.table .row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.table .cell-main { font-weight: 600; color: var(--text); }
.table .cell-sub { font-size: 12.5px; color: var(--text-muted); }
@media (max-width: 760px) {
  .mobile-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px 16px; margin-bottom: 12px; }
  .mobile-card .mc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
  .mobile-card .mc-title { font-weight: 650; font-size: 14.5px; }
  .mobile-card .mc-rows { margin-top: 10px; display: grid; gap: 6px; }
  .mobile-card .mc-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-secondary); }
  .mobile-card .mc-row b { color: var(--text); font-weight: 600; text-align: right; }
  .mobile-hide { display: none !important; }
}

/* Pagination */
.pagination { display: flex; align-items: center; gap: 6px; padding: 14px 20px; flex-wrap: wrap; }
.page-link {
  min-width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  padding: 0 10px; border-radius: var(--r-sm); border: 1px solid var(--border);
  font-size: 13.5px; font-weight: 600; color: var(--text-secondary); background: var(--surface);
}
.page-link:hover { background: var(--surface-2); text-decoration: none; }
.page-link.current { background: var(--ghdi-primary); border-color: var(--ghdi-primary); color: #fff; }
.page-link.disabled { opacity: .5; pointer-events: none; }

/* Empty states */
.empty-state { text-align: center; padding: 56px 24px; }
.empty-state .empty-icon {
  width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 18px;
  background: var(--ghdi-primary-soft); display: grid; place-items: center; color: var(--ghdi-primary);
}
.empty-state .empty-icon svg { width: 30px; height: 30px; }
.empty-state h3 { margin-bottom: 6px; }
.empty-state p { color: var(--text-secondary); max-width: 380px; margin: 0 auto 18px; font-size: 14px; }

/* Skeletons / loading */
.skeleton { position: relative; overflow: hidden; background: var(--surface-2); border-radius: var(--r-sm); }
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.65), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
/* (`.htmx-indicator` rules removed — the HTMX layer is gone.) */

/* Alerts */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: var(--r-sm); font-size: 14px; margin-bottom: 14px; }
.alert-success { background: var(--ghdi-emerald-soft); color: #065f46; }
.alert-error { background: var(--ghdi-red-soft); color: #991b1b; }
.alert-warning { background: var(--ghdi-amber-soft); color: #92400e; }
.alert-info { background: var(--ghdi-blue-soft); color: #1e40af; }
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

/* Flash / toast stack: Django messages rendered as floating toasts so they are
   visible without pushing page content down (requirement: consistent toast
   system). Fixed top-right on desktop, full-width under the topbar on mobile. */
.toast-stack {
  position: fixed; z-index: 95; top: 76px; right: 20px; left: auto;
  width: min(380px, calc(100vw - 40px)); display: flex; flex-direction: column;
  gap: 10px; pointer-events: none;
}
.toast-stack .alert {
  margin-bottom: 0; pointer-events: auto; box-shadow: var(--shadow-lg);
  border: 1px solid rgba(15,23,42,.06); animation: toast-in .22s ease-out;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (max-width: 760px) {
  .toast-stack { top: auto; bottom: 74px; right: 12px; left: 12px; width: auto; }
}

/* Notification read/unread states. Previously these relied on Tailwind colour
   utilities (bg-teal-500, bg-slate-300, …) that are not part of this
   hand-written design system, so the indicators rendered colourless. */
.dropdown-item .dot.is-unread, .dot.is-unread { background: var(--ghdi-primary); }
.dropdown-item .dot.is-read, .dot.is-read { background: var(--border-strong); }
.feed-item .feed-icon.is-unread { background: var(--ghdi-primary-soft); color: var(--ghdi-primary); }
.feed-item .feed-icon.is-read { background: var(--surface-2); color: var(--text-muted); }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 90;
  display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto;
}
.modal { background: #fff; border-radius: var(--r-lg); width: 100%; max-width: 560px; box-shadow: var(--shadow-lg); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 22px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* Progress bars */
.progress { height: 8px; border-radius: var(--r-full); background: var(--surface-2); overflow: hidden; }
.progress-bar { height: 100%; border-radius: var(--r-full); background: var(--ghdi-primary); transition: width .5s ease; }
.progress-bar.green { background: var(--ghdi-emerald); }
.progress-bar.amber { background: var(--ghdi-amber); }
.progress-bar.red { background: var(--ghdi-red); }

/* Charts */
.chart-bars { display: flex; align-items: flex-end; gap: 8px; height: 180px; padding-top: 8px; }
.chart-bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; min-width: 0; }
.chart-bar .bar { width: 100%; max-width: 42px; border-radius: 6px 6px 2px 2px; background: var(--ghdi-primary); min-height: 3px; transition: height .5s ease; }
.chart-bar .bar.alt { background: var(--ghdi-emerald); }
.chart-bar .bar.amber { background: var(--ghdi-amber); }
.chart-bar .bar.red { background: var(--ghdi-red); }
.chart-bar .bar-label { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.chart-bar .bar-value { font-size: 11px; font-weight: 700; color: var(--text-secondary); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; font-size: 12.5px; color: var(--text-secondary); }
.chart-legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .swatch { width: 10px; height: 10px; border-radius: 3px; }
.donut { position: relative; width: 160px; height: 160px; margin: 0 auto; }
.donut .donut-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.donut .donut-center b { font-size: 22px; display: block; letter-spacing: -.02em; }
.donut .donut-center span { font-size: 11px; color: var(--text-muted); }
.metric-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.metric-row:last-child { border-bottom: none; }
.metric-row .m-label { flex: 1; font-size: 13.5px; color: var(--text-secondary); }
.metric-row .m-value { font-weight: 700; font-size: 14px; }

/* Activity feed */
.feed-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.feed-item:last-child { border-bottom: none; }
.feed-item .feed-icon { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.feed-item .feed-icon svg { width: 16px; height: 16px; }
.feed-item .feed-body { flex: 1; min-width: 0; }
.feed-item .feed-title { font-size: 13.5px; font-weight: 600; }
.feed-item .feed-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab { padding: 10px 16px; font-size: 14px; font-weight: 600; color: var(--text-secondary); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--ghdi-primary); border-bottom-color: var(--ghdi-primary); }

/* Offline banner */
.offline-banner {
  display: none; align-items: center; gap: 10px;
  background: #fef3c7; color: #92400e; font-size: 13.5px; font-weight: 600;
  padding: 9px 28px; border-bottom: 1px solid #fde68a;
}
.offline-banner.show { display: flex; }
.offline-banner svg { width: 17px; height: 17px; flex-shrink: 0; }

/* Bottom nav (mobile) */
.bottom-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  background: rgba(255,255,255,.96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--border); padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
@media (max-width: 760px) { .bottom-nav { display: flex; } }
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 7px 4px; border-radius: var(--r-sm); color: var(--text-muted); font-size: 10.5px; font-weight: 600;
}
.bottom-nav a.active { color: var(--ghdi-primary); }
.bottom-nav a svg { width: 21px; height: 21px; }

/* Mobile drawer
   The public site reveals its burger button until 1200px, so the drawer must
   stay reachable across that whole range. Previously the drawer was force-hidden
   above 760px while the burger kept rendering up to 1200px, leaving a dead
   menu button on tablet widths. Hidden/visible is now driven purely by the
   [hidden] attribute that app.js toggles (see `[hidden]` in this file). */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 80; }
.drawer {
  position: fixed; top: 0; bottom: 0; left: 0; width: min(320px, 86vw);
  display: flex; flex-direction: column;
  background: #fff; z-index: 85; overflow-y: auto; overscroll-behavior: contain;
  box-shadow: var(--shadow-lg);
  animation: drawerIn 240ms cubic-bezier(.22, 1, .36, 1);
}
@keyframes drawerIn { from { transform: translateX(-100%); } to { transform: translateX(0); } }
.drawer-backdrop { animation: drawerFade 200ms ease; }
@keyframes drawerFade { from { opacity: 0; } to { opacity: 1; } }
.menu-btn { display: none; }
@media (max-width: 760px) { .menu-btn { display: grid; } }
@media (prefers-reduced-motion: reduce) {
  .drawer, .drawer-backdrop { animation: none; }
}

/* Detail page */
.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.detail-item { padding: 12px 14px; background: var(--surface-2); border-radius: var(--r-sm); border: 1px solid var(--border); }
.detail-item .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-weight: 700; }
.detail-item .v { font-size: 14px; font-weight: 600; margin-top: 3px; word-break: break-word; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { margin: 0 0 4px; }
.page-head .sub { color: var(--text-secondary); font-size: 14px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Public website */
.site-header { position: sticky; top: 0; z-index: 40; background: rgba(255,255,255,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.site-nav { display: flex; align-items: center; gap: 24px; padding: 14px 28px; max-width: 1200px; margin: 0 auto; }
.site-nav .nav-links { display: flex; gap: 4px; margin-left: auto; }
.site-nav .nav-links a { padding: 8px 12px; border-radius: var(--r-sm); color: var(--text-secondary); font-weight: 550; font-size: 14px; }
.site-nav .nav-links a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.site-nav .nav-links a.active { color: var(--ghdi-azure); background: var(--ghdi-azure-soft); }
.site-nav .nav-links a.active:hover { background: var(--ghdi-azure-soft); color: var(--ghdi-azure); }
.site-nav .nav-cta { margin-left: 8px; }
@media (max-width: 860px) { .site-nav .nav-links { display: none; } }
.nav-toggle { display: none; margin-left: auto; }
.nav-toggle svg { width: 22px; height: 22px; }
@media (max-width: 860px) { .nav-toggle { display: grid; } .site-nav { gap: 12px; padding: 12px 16px; } }
/* Public site drawer: available at every width below 1200px, where its burger
   button is visible. Visibility is driven by the [hidden] attribute. */
.drawer .sidebar-brand { position: sticky; top: 0; z-index: 1; background: #fff; }
.drawer .sidebar-brand .icon-btn { margin-left: auto; flex-shrink: 0; }
/* Public drawer reuses the shared drawer chrome; links get site spacing */
.drawer .sidebar-nav a.sidebar-link { padding: 12px 20px; color: var(--text); font-weight: 550; border-radius: 0; }
.drawer .sidebar-nav a.sidebar-link:hover { background: var(--surface-2); text-decoration: none; }
/* The public drawer marks the current page with `is-active` (the BEM-ish name
   used across the site), while the shared MIS sidebar rule targets `.active`.
   Without this the open page is not highlighted in the mobile menu. */
.drawer .sidebar-nav a.sidebar-link.is-active {
  background: var(--ghdi-primary-soft);
  color: var(--ghdi-primary-dark);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--ghdi-primary);
}
.drawer .sidebar-nav a.sidebar-link:focus-visible {
  outline: 3px solid var(--ghdi-primary);
  outline-offset: -3px;
}
.hero { background: linear-gradient(135deg, #011F5B 0%, #013A8A 55%, #0081D2 100%); color: #fff; padding: 72px 28px; position: relative; overflow: hidden; }
.hero h1 { color: #fff; font-size: clamp(1.9rem, 4.5vw, 3.1rem); letter-spacing: -.03em; max-width: 640px; }
.hero p { color: rgba(255,255,255,.88); font-size: 1.08rem; max-width: 560px; }
.hero .hero-cta { display: flex; gap: 12px; margin-top: 26px; flex-wrap: wrap; }
.hero .btn-light { background: #fff; color: var(--ghdi-primary-dark); }
.hero .btn-light:hover { background: #f0fdfa; }
.hero .btn-outline-light { border-color: rgba(255,255,255,.5); color: #fff; background: transparent; }
.hero .btn-outline-light:hover { background: rgba(255,255,255,.12); }
.section { padding: 64px 28px; max-width: 1200px; margin: 0 auto; }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 40px; }
.section-head .eyebrow { color: var(--ghdi-primary); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
.section-head h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 20px; }
.stat { text-align: center; padding: 26px 16px; }
.stat .num { font-size: 2.2rem; font-weight: 800; letter-spacing: -.03em; color: var(--ghdi-primary); }
.stat .lbl { color: var(--text-secondary); font-size: 13.5px; font-weight: 600; margin-top: 4px; }
.theme-card { border-radius: var(--r-lg); overflow: hidden; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); transition: box-shadow .15s, transform .15s; }
.theme-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.theme-card .tc-body { padding: 22px; }
.theme-card .tc-icon { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; margin-bottom: 14px; }
.theme-card .tc-icon svg { width: 22px; height: 22px; }

/* Public website (cont.) */
.news-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow-sm); }
.news-card .nc-body { padding: 16px 18px; }
.news-card .nc-title { font-weight: 650; font-size: 15px; line-height: 1.35; }
.news-card .nc-meta { font-size: 12px; color: var(--text-muted); margin-top: 8px; }
.site-footer { background: var(--ghdi-primary-darker); color: #C9D6EE; padding: 48px 28px 28px; }
.site-footer a { color: #8FA6CE; }
.site-footer a:hover { color: #fff; }
.site-footer .foot-grid { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; }
@media (max-width: 860px) { .site-footer .foot-grid { grid-template-columns: 1fr 1fr; } }
.site-footer .foot-bottom { max-width: 1200px; margin: 32px auto 0; padding-top: 20px; border-top: 1px solid #1e293b; font-size: 13px; color: #64748b; }

/* Login page */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, var(--ghdi-primary-soft), var(--ghdi-azure-soft)); }
.auth-card { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 36px 32px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.auth-brand .logo-mark { width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg, var(--ghdi-primary), var(--ghdi-emerald)); display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 17px; }

/* Misc utilities */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.ml-3 { margin-left: 12px; }
.mx-2 { margin-inline: 8px; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary { color: var(--ghdi-primary); }
.text-danger { color: var(--ghdi-red); }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.h-full { height: 100%; }
.d-inline-block { display: inline-block; }
/* Hide on the mobile breakpoint where the compressed header runs out of room
   for secondary labels (matches the 860px public nav breakpoint). */
@media (max-width: 860px) { .d-none-mobile { display: none; } }
/* Vertical list of action links used by dashboard "configuration hub" cards. */
.list-links { display: flex; flex-direction: column; }
.list-links .link { display: block; padding: 11px 18px; border-bottom: 1px solid var(--border); font-size: 14px; color: var(--ghdi-primary); font-weight: 550; }
.list-links .link:last-child { border-bottom: 0; }
.list-links .link:hover { background: var(--ghdi-primary-soft); }

/* ============================================================
   Carousel + Marquee utilities (used by the public website)
   ============================================================ */
/* snap-album: keeps a single full-width carousel card visible */
.snap-album { scroll-snap-align: start; }

/* Infinite partners marquee animation */
@keyframes ghdi-marquee {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.marquee-track {
  display: inline-flex;
  animation: ghdi-marquee 20s linear infinite;
}
.marquee-track:hover { animation-play-state: paused; }

/* Scrollbar hide (WebKit) */
.carousel-track::-webkit-scrollbar,
.marquee-track::-webkit-scrollbar { display: none; }

/* Carousel button disabled state */
.carousel-btn--prev:disabled,
.carousel-btn--next:disabled {
  opacity: .35;
  cursor: not-allowed;
}

/* Ensure the hero carousel images fill their card on all viewports */
[data-carousel] .carousel-card img { min-height: 320px; }
@media (min-width: 640px) [data-carousel] .carousel-card img { min-height: 420px; }
@media (min-width: 1024px) [data-carousel] .carousel-card img { min-height: 520px; }
@media (max-width: 639px) [data-carousel] .carousel-card img { min-height: 260px; }
/* Inline record link (tables, feeds). Slightly heavier than body links so the
   clickable column reads as the row's primary affordance. */
.link { font-weight: 600; }
/* Inline GET filter form placed in a page-head actions slot. The input is
   allowed to shrink so the form never forces horizontal overflow on mobile. */
.inline-form { display: flex; align-items: center; gap: 8px; min-width: 0; }
.inline-form .form-input { width: auto; min-width: 0; }
@media (max-width: 640px) {
  .inline-form { width: 100%; }
  .inline-form .form-input { flex: 1 1 auto; }
}
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }
/* Span a field across both form-grid columns (used by includes/form.html for
   long-text fields). Reset to a single column on mobile so a spanning item can
   never create an implicit second column and cause horizontal overflow. */
.colspan-2 { grid-column: span 2; }
@media (max-width: 640px) { .colspan-2 { grid-column: auto; } }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { border: 2px solid #fff; margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }
/* Hidden elements stay hidden even when display is set by other rules
   (the mobile drawer toggles via the [hidden] attribute at <=860px). */
[hidden] { display: none !important; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: -9999px; top: 0; background: var(--ghdi-primary); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0; z-index: 200; }
.skip-link:focus { left: 0; }
.pre-wrap { white-space: pre-wrap; }
