/* ── GHS Design System ─────────────────────────────────────────────────────── */
/* Palette rebased on the GHS crest — Ghana flag green/gold/red — in place of
   the previous blue/navy scheme. --navy/--accent kept as names (rather than
   renamed) so every existing var(--navy)/var(--accent) call site repaints
   automatically; only the underlying values changed. */
@import url('https://fonts.googleapis.com/css2?family=Libre+Franklin:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,400&display=swap');

:root {
  --navy:         #0b3d24;
  --navy-mid:     #124a2e;
  --navy-pale:    #e8f5ee;
  --accent:       #046a38;
  --accent-dark:  #03502a;
  --accent-pale:  #e3f2ea;
  --green:        #1b5e20;
  --green-mid:    #2e7d32;
  --green-light:  #4caf50;
  --green-pale:   #e8f5e9;
  --gold:         #fcd116;
  --gold-dark:    #a67c00;
  --red:          #ce1126;
  --red-light:    #fbe7e9;
  --blue:         #1565c0;
  --blue-light:   #e3f2fd;
  --grey-50:      #fafafa;
  --grey-100:     #f5f5f5;
  --grey-200:     #eeeeee;
  --grey-300:     #e0e0e0;
  --grey-400:     #bdbdbd;
  --grey-600:     #757575;
  --grey-800:     #424242;
  --grey-900:     #212121;
  --white:        #ffffff;
  --shadow-sm:    0 1px 2px rgba(11,61,36,.06), 0 1px 3px rgba(11,61,36,.05);
  --shadow:       0 2px 4px rgba(11,61,36,.05), 0 4px 12px rgba(11,61,36,.06);
  --shadow-md:    0 4px 8px rgba(11,61,36,.05), 0 12px 24px rgba(11,61,36,.08);
  --shadow-lg:    0 8px 16px rgba(11,61,36,.06), 0 24px 48px rgba(11,61,36,.12);
  --ring:         0 0 0 3px rgba(4,106,56,.16);
  --radius:       10px;
  --radius-lg:    14px;
  --radius-xl:    18px;
  --grad-accent:  linear-gradient(135deg, #0d8a4c 0%, #046a38 55%, #03502a 100%);
  --grad-sidebar: linear-gradient(180deg, #0f4a2c 0%, #0b3d24 55%, #071f13 100%);
  --font:         'Libre Franklin', sans-serif;
  --font-display: 'Libre Franklin', sans-serif;
  --transition:   all .18s cubic-bezier(.4,0,.2,1);
}

/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16.5px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: #eef1f6;
  background-image:
    radial-gradient(1200px 600px at 100% -10%, rgba(4,106,56,.06), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(11,61,36,.05), transparent 55%);
  background-attachment: fixed;
  color: var(--grey-900);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 700; }

a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-dark); }

/* ── Layout ───────────────────────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 252px;
  min-height: 100vh;
  background: var(--grad-sidebar);
  color: var(--white);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  box-shadow: 1px 0 0 rgba(255,255,255,.04), 4px 0 24px rgba(12,30,55,.28);
  transition: var(--transition);
}

.sidebar-brand {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.12);
  display: flex; align-items: center; gap: .75rem;
}

.sidebar-brand img { width: 40px; height: 40px; object-fit: contain; }

.sidebar-brand-text { line-height: 1.2; }
.sidebar-brand-text strong { font-size: .85rem; font-weight: 700; display: block; }
.sidebar-brand-text small { font-size: .7rem; opacity: .75; }

.sidebar-role {
  margin: .75rem 1.25rem;
  padding: .35rem .75rem;
  background: rgba(252,209,22,.18);
  border: 1px solid rgba(252,209,22,.35);
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 600;
  color: #ffe789;
  text-transform: uppercase;
  letter-spacing: .05em;
  text-align: center;
}

.sidebar-nav { flex: 1; padding: .5rem 0; overflow-y: auto; }

.nav-section-label {
  padding: .75rem 1.25rem .25rem;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.4);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin: 2px .6rem;
  padding: .6rem .85rem;
  color: rgba(255,255,255,.78);
  font-size: .875rem;
  font-weight: 400;
  border-radius: var(--radius);
  transition: var(--transition);
}

.nav-link:hover {
  background: rgba(255,255,255,.08);
  color: var(--white);
}

.nav-link.active {
  background: var(--grad-accent);
  color: var(--white);
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(4,106,56,.45), inset 0 1px 0 rgba(255,255,255,.15);
}
.nav-link.active .icon { filter: drop-shadow(0 1px 1px rgba(0,0,0,.2)); }

.nav-link .icon { font-size: 1rem; width: 18px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.12);
}

.sidebar-user {
  display: flex; align-items: center; gap: .65rem;
  margin-bottom: .75rem;
}

.sidebar-user-avatar {
  width: 36px; height: 36px;
  background: var(--gold);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem; color: var(--green);
  flex-shrink: 0;
}

.sidebar-user-info { line-height: 1.3; min-width: 0; }
.sidebar-user-name { font-size: .8rem; font-weight: 600; color: var(--white); truncate: ellipsis; white-space: nowrap; overflow: hidden; max-width: 140px; }
.sidebar-user-id   { font-size: .7rem; color: rgba(255,255,255,.55); }

.btn-logout {
  display: flex; align-items: center; gap: .5rem;
  width: 100%; padding: .55rem .75rem;
  background: rgba(198,40,40,.15);
  border: 1px solid rgba(198,40,40,.3);
  border-radius: var(--radius);
  color: #ef9a9a;
  font-size: .8rem; font-weight: 500;
  cursor: pointer; transition: var(--transition);
}
.btn-logout:hover { background: rgba(198,40,40,.3); color: #ffcdd2; }

/* ── Main content ────────────────────────────────────────────────────────── */
.main-content {
  margin-left: 250px;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--grey-200);
  padding: .85rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.topbar-title { font-family: var(--font-display); font-size: 1.15rem; color: var(--grey-900); }
.topbar-breadcrumb { font-size: .8rem; color: var(--grey-600); margin-top: .1rem; }
.topbar-breadcrumb a { color: var(--accent); }

.page-body { padding: 1.75rem; flex: 1; min-width: 0; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--grey-200);
  overflow: hidden;
  transition: box-shadow .2s ease, border-color .2s ease;
}
.card:hover { box-shadow: var(--shadow); border-color: #e4e9f1; }

.card-header {
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--grey-200);
  background: linear-gradient(180deg, #fcfdfe 0%, #ffffff 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--grey-900);
  display: flex;
  align-items: center;
  gap: .5rem;
}

.card-title .icon { color: var(--accent); }
.card-body { padding: 1.5rem; }
.card-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--grey-200); background: var(--grey-50); }

/* ── Responsive 2-column layouts (detail pages, dashboard charts) ─────────── */
/* Replaces one-off inline grid-template-columns styles across templates so
   the mobile/tablet collapse only needs to live in one place. The custom
   properties let each page keep its own desktop sidebar/lead width. */
.responsive-grid-sidebar { display: grid; grid-template-columns: 1fr var(--sidebar-w, 340px); gap: 1.25rem; }
.responsive-grid-lead    { display: grid; grid-template-columns: var(--lead-w, 320px) 1fr; gap: 1.25rem; margin-bottom: 1.25rem; }
.responsive-grid-2       { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }

@media (max-width: 900px) {
  .responsive-grid-sidebar,
  .responsive-grid-lead,
  .responsive-grid-2 { grid-template-columns: 1fr; }
}

/* ── Stat cards ──────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }

.stat-card {
  position: relative;
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.5rem;
  border: 1px solid var(--grey-200);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  overflow: hidden;
  transition: var(--transition);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 4px;
  background: var(--grad-accent);
  opacity: 0;
  transition: var(--transition);
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: #dfe6f2;
}
.stat-card:hover::before { opacity: 1; }

.stat-icon {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.03);
}

.stat-icon.green  { background: var(--green-pale);  color: var(--green-mid); }
.stat-icon.gold   { background: #fffde7;             color: var(--gold-dark); }
.stat-icon.red    { background: var(--red-light);    color: var(--red); }
.stat-icon.blue   { background: var(--blue-light);   color: var(--blue); }

.stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1; color: var(--grey-900); }
.stat-label { font-size: .78rem; color: var(--grey-600); margin-top: .2rem; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .58rem 1.2rem;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: .875rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: .01em;
}
.btn:focus-visible { outline: none; box-shadow: var(--ring); }

.btn-primary   { background: var(--grad-accent); color: var(--white); border-color: transparent; box-shadow: 0 2px 6px rgba(4,106,56,.28); }
.btn-primary:hover { filter: brightness(1.05); box-shadow: 0 4px 12px rgba(4,106,56,.38); color: var(--white); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); box-shadow: 0 1px 3px rgba(4,106,56,.3); }

.btn-gold      { background: var(--gold); color: var(--grey-900); border-color: var(--gold); }
.btn-gold:hover{ background: var(--gold-dark); border-color: var(--gold-dark); }

.btn-danger    { background: var(--red); color: var(--white); border-color: var(--red); }
.btn-danger:hover { background: #b71c1c; }

.btn-warning   { background: #f57f17; color: var(--white); border-color: #f57f17; }
.btn-warning:hover { background: #e65100; }

.btn-outline   { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn-outline:hover { background: var(--accent-pale); }

.btn-ghost     { background: transparent; color: var(--grey-600); border-color: var(--grey-300); }
.btn-ghost:hover { background: var(--grey-100); }

.btn-sm { padding: .35rem .85rem; font-size: .8rem; }
.btn-lg { padding: .75rem 1.75rem; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .65rem;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  white-space: nowrap;
}

.badge-success { background: var(--green-pale);  color: var(--green); }
.badge-danger  { background: var(--red-light);   color: var(--red); }
.badge-warning { background: #fff8e1;             color: #e65100; }
.badge-info    { background: var(--blue-light);   color: var(--blue); }
.badge-grey    { background: var(--grey-200);     color: var(--grey-600); }
.badge-gold    { background: #fffde7;             color: var(--gold-dark); }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }

.form-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--grey-800);
  margin-bottom: .35rem;
}

.form-label .required { color: var(--red); margin-left: .2rem; }

.form-control {
  display: block;
  width: 100%;
  padding: .6rem .85rem;
  border: 1.5px solid var(--grey-300);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: .875rem;
  color: var(--grey-900);
  background: var(--white);
  transition: var(--transition);
  outline: none;
}

.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(4,106,56,.15); }
.form-control:disabled { background: var(--grey-100); color: var(--grey-600); }

select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23757575' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .75rem center; padding-right: 2.5rem; }

textarea.form-control { resize: vertical; min-height: 90px; }

.form-hint { font-size: .75rem; color: var(--grey-600); margin-top: .3rem; }
.form-error { font-size: .75rem; color: var(--red); margin-top: .3rem; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row.three { grid-template-columns: 1fr 1fr 1fr; }

.form-section-title {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent-dark);
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--accent-pale);
  margin-bottom: 1rem;
}

/* ── Tables ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}

thead th {
  background: var(--grey-50);
  padding: .75rem 1rem;
  text-align: left;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--grey-600);
  border-bottom: 2px solid var(--grey-200);
  white-space: nowrap;
}

tbody td {
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--grey-100);
  color: var(--grey-800);
  vertical-align: middle;
}

tbody tr:hover td { background: var(--grey-50); }
tbody tr:last-child td { border-bottom: none; }

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert {
  padding: .85rem 1.1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  margin-bottom: 1rem;
}

.alert-success { background: var(--green-pale);  border-left: 4px solid var(--green-mid);  color: var(--green); }
.alert-danger  { background: var(--red-light);   border-left: 4px solid var(--red);        color: #b71c1c; }
.alert-warning { background: #fff8e1;             border-left: 4px solid #f9a825;           color: #e65100; }
.alert-info    { background: var(--blue-light);   border-left: 4px solid var(--blue);       color: var(--blue); }

/* ── Pipeline tracker ────────────────────────────────────────────────────── */
.pipeline {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  padding: 1rem 0;
}

.pipeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 90px;
  position: relative;
}

.pipeline-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 14px;
  left: calc(50% + 14px);
  width: calc(100% - 28px);
  height: 2px;
  background: var(--grey-300);
  z-index: 0;
}

.pipeline-step.done::after   { background: var(--green-light); }
.pipeline-step.active::after { background: var(--grey-300); }

.pipeline-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem;
  font-weight: 700;
  z-index: 1;
  position: relative;
  transition: var(--transition);
}

.pipeline-dot.done   { background: var(--green-mid);  color: var(--white); }
.pipeline-dot.active { background: var(--gold);        color: var(--grey-900); box-shadow: 0 0 0 4px rgba(245,196,0,.25); }
.pipeline-dot.pending{ background: var(--grey-300);    color: var(--grey-600); }
.pipeline-dot.rejected{ background: var(--red);        color: var(--white); }

.pipeline-label {
  font-size: .62rem;
  text-align: center;
  margin-top: .35rem;
  color: var(--grey-600);
  line-height: 1.3;
  max-width: 80px;
}
.pipeline-step.active .pipeline-label { color: var(--green-mid); font-weight: 600; }
.pipeline-step.done   .pipeline-label { color: var(--green-mid); }

/* ── Multi-step application wizard (apply_form_a.html / apply_form_b.html) ── */
.wizard-track {
  display: flex;
  align-items: flex-start;
  margin-bottom: 1.4rem;
}

.w-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
  flex: 1;
  position: relative;
}

.w-step:not(:first-child)::before {
  content: '';
  position: absolute;
  top: 17px;
  left: -50%;
  width: 100%;
  height: 2px;
  background: var(--grey-200);
  z-index: 0;
}

.w-step.done:not(:first-child)::before,
.w-step.active:not(:first-child)::before { background: var(--green-mid); }

.w-num {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--grey-200); color: var(--grey-600);
  font-weight: 700; font-size: .85rem;
  border: 2px solid var(--grey-200);
  transition: var(--transition);
  z-index: 1;
  position: relative;
}

.w-step.active .w-num { background: var(--green-mid); border-color: var(--green-mid); color: var(--white); }
.w-step.done   .w-num { background: var(--green-pale); border-color: var(--green-mid); color: var(--green-mid); }

.w-label {
  font-size: .72rem;
  color: var(--grey-600);
  font-weight: 600;
  text-align: center;
}
.w-step.active .w-label { color: var(--green-mid); }
.w-step.done   .w-label { color: var(--green-mid); }

.wizard-panel { display: none; }
.wizard-panel.active {
  display: block;
  animation: wizardFadeIn .25s ease;
}
@keyframes wizardFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.wizard-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.1rem;
}

/* ── File upload area ────────────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--grey-300);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  transition: var(--transition);
  cursor: pointer;
  background: var(--grey-50);
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--green-mid);
  background: var(--green-pale);
}

.upload-zone .icon { font-size: 2rem; color: var(--grey-400); }
.upload-zone p { font-size: .875rem; color: var(--grey-600); margin: .5rem 0; }
.upload-zone input[type="file"] { display: none; }

.file-list { list-style: none; margin-top: .75rem; }
.file-item {
  display: flex; align-items: center; gap: .5rem;
  padding: .5rem .75rem;
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  margin-top: .4rem;
  font-size: .8rem;
}

.file-item .icon { color: var(--green-mid); }
.file-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item-remove { color: var(--red); cursor: pointer; background: none; border: none; font-size: .85rem; }

/* ── Review action panel ─────────────────────────────────────────────────── */
.action-panel {
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.action-panel-title {
  font-size: .85rem;
  font-weight: 700;
  color: var(--grey-800);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.action-buttons { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1rem; }

/* ── Audit trail ────────────────────────────────────────────────────────── */
.audit-list { list-style: none; }
.audit-item {
  display: flex;
  gap: 1rem;
  padding: .85rem 0;
  border-bottom: 1px solid var(--grey-100);
  font-size: .82rem;
}
.audit-item:last-child { border-bottom: none; }
.audit-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--green-mid);
  margin-top: .35rem;
  flex-shrink: 0;
}
.audit-time { color: var(--grey-400); font-size: .72rem; margin-top: .15rem; }

/* ── Document list ───────────────────────────────────────────────────────── */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .75rem; }
.doc-card {
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  display: flex; align-items: flex-start; gap: .65rem;
  background: var(--grey-50);
  transition: var(--transition);
}
.doc-card:hover { border-color: var(--green-mid); background: var(--green-pale); }
.doc-icon { font-size: 1.5rem; color: var(--green-mid); flex-shrink: 0; }
.doc-name { font-size: .8rem; font-weight: 500; line-height: 1.3; word-break: break-word; }
.doc-meta { font-size: .7rem; color: var(--grey-600); margin-top: .2rem; }
.doc-actions { display: flex; gap: .4rem; margin-top: .5rem; }

/* ── Application detail sections ─────────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; }
.detail-item {}
.detail-label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--grey-600); }
.detail-value { font-size: .875rem; color: var(--grey-900); margin-top: .1rem; }

/* ── Search bar ──────────────────────────────────────────────────────────── */
.search-bar {
  display: flex;
  gap: .75rem;
  align-items: center;
  background: var(--white);
  border: 1.5px solid var(--grey-300);
  border-radius: var(--radius);
  padding: .45rem .75rem;
  transition: var(--transition);
}
.search-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(4,106,56,.12); }
.search-bar .icon { color: var(--grey-400); }
.search-bar input { border: none; outline: none; font-family: var(--font); font-size: .875rem; flex: 1; background: none; }

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--grey-600);
}
.empty-state .icon { font-size: 2.5rem; color: var(--grey-300); margin-bottom: .75rem; }
.empty-state h3 { font-size: 1rem; color: var(--grey-800); margin-bottom: .4rem; }
.empty-state p { font-size: .85rem; }

/* ── Login page ──────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 50%, #05170e 100%);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.login-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
}

.login-logo {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-logo img { width: 64px; height: 64px; object-fit: contain; }
.login-logo h1 { font-family: var(--font-display); font-size: 1.3rem; color: var(--navy); margin-top: .5rem; }
.login-logo p  { font-size: .78rem; color: var(--grey-600); margin-top: .2rem; }

/* ── Reference box (read-only "on file" fields, kept visually separate from
   fields the applicant actually needs to fill in — apply_form_a/b.html) ──── */
.ref-box {
  background: var(--grey-50);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}
.ref-box-title {
  display: flex; align-items: center; gap: .4rem;
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--grey-600); margin-bottom: .85rem;
}
.ref-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .85rem 1.5rem; }
.ref-item label {
  display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--grey-600); margin-bottom: .15rem;
}
.ref-item .ref-value { font-size: .85rem; color: var(--grey-900); font-weight: 600; }
@media (max-width: 480px) { .ref-grid { grid-template-columns: 1fr; } }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  #sidebarToggle { display: inline-flex !important; }
  .form-row, .form-row.three { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

  .topbar { flex-wrap: wrap; row-gap: .6rem; padding: .75rem 1rem; }
  .topbar > div { flex-wrap: wrap; }
  .page-body { padding: 1rem; }
  .signin-banner { font-size: .8rem; }

  .card-header { flex-wrap: wrap; gap: .75rem; }
  .card-header .search-bar { width: 100% !important; }
  .d-flex.justify-between { flex-wrap: wrap; row-gap: .5rem; }
}

@media (max-width: 480px) {
  .user-meta { display: none; }
  .topbar-title { font-size: 1rem; }
  .w-num { width: 26px; height: 26px; font-size: .72rem; }
  .w-step:not(:first-child)::before { top: 13px; }
  .w-label { font-size: 0; }
  .w-step.active .w-label { font-size: .62rem; }
}

/* ── Utilities ───────────────────────────────────────────────────────────── */
.text-muted   { color: var(--grey-600); }
.text-success { color: var(--green-mid); }
.text-danger  { color: var(--red); }
.text-warning { color: #e65100; }
.text-small   { font-size: .8rem; }
.text-center  { text-align: center; }
.fw-600       { font-weight: 600; }
.mt-1  { margin-top: .5rem; }
.mt-2  { margin-top: 1rem; }
.mt-3  { margin-top: 1.5rem; }
.mb-1  { margin-bottom: .5rem; }
.mb-2  { margin-bottom: 1rem; }
.mb-3  { margin-bottom: 1.5rem; }
.gap-1 { gap: .5rem; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.w-100 { width: 100%; }

/* ── Sidebar logo white box ──────────────────────────────────────────────── */
.sidebar-logo-box {
  background: #fff;
  border-radius: 10px;
  padding: 4px;
  width: 50px; height: 50px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
  flex-shrink: 0;
}
.sidebar-logo-box img { width: 42px; height: 42px; object-fit: contain; }

/* Topbar logo */
.topbar-logo {
  background: var(--navy);
  border-radius: 8px;
  padding: 3px;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  margin-right: .65rem; flex-shrink: 0;
}
.topbar-logo img { width: 30px; height: 30px; object-fit: contain; }

/* ── Sidebar agency chip (footer) ─────────────────────────────────────────── */
.sidebar-agency {
  display: flex; align-items: center; gap: .65rem;
  padding: .6rem .7rem;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: var(--radius);
}
.sidebar-agency-logo {
  width: 34px; height: 34px;
  background: #fff; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-agency-logo img { width: 28px; height: 28px; object-fit: contain; }
.sidebar-agency-text { line-height: 1.25; min-width: 0; }
.sidebar-agency-label {
  font-size: .6rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: rgba(255,255,255,.45);
}
.sidebar-agency-name {
  font-size: .8rem; font-weight: 600; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px;
}

/* ── Topbar user menu (top-right identity chip) ───────────────────────────── */
.user-menu { position: relative; }
.user-menu > summary {
  display: flex; align-items: center; gap: .6rem;
  padding: .3rem .5rem .3rem .35rem;
  border-radius: 999px;
  cursor: pointer; list-style: none;
  transition: var(--transition);
}
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary:hover { background: var(--grey-100); }
.user-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .82rem; flex-shrink: 0;
}
.user-meta { line-height: 1.2; text-align: right; }
.user-meta-name { font-size: .82rem; font-weight: 600; color: var(--grey-900); }
.user-meta-role { font-size: .7rem; color: var(--grey-600); }
.user-caret { color: var(--grey-400); font-size: .7rem; }
.user-menu[open] > summary { background: var(--grey-100); }
.user-dropdown {
  position: absolute; right: 0; top: calc(100% + .5rem);
  min-width: 200px;
  background: #fff; border: 1px solid var(--grey-200);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  padding: .5rem; z-index: 200;
}
.user-dropdown .dd-head {
  padding: .5rem .65rem .65rem; border-bottom: 1px solid var(--grey-100); margin-bottom: .35rem;
}
.user-dropdown .dd-name { font-size: .85rem; font-weight: 600; color: var(--grey-900); }
.user-dropdown .dd-id   { font-size: .72rem; color: var(--grey-600); }
.user-dropdown a.dd-item {
  display: flex; align-items: center; gap: .55rem;
  padding: .55rem .65rem; border-radius: var(--radius);
  font-size: .82rem; color: var(--grey-800);
}
.user-dropdown a.dd-item:hover { background: var(--grey-100); }
.user-dropdown a.dd-item.danger { color: var(--red); }
.user-dropdown a.dd-item.danger:hover { background: var(--red-light); }

/* ── Grade combobox (Requested Grade autocomplete) ────────────────────────── */
/* .combo-list is portaled to <body> at runtime (position:fixed, positioned via
   JS) so it isn't clipped by .card's overflow:hidden. */
.combo-wrap { position: relative; }
.combo-wrap.combo-locked .form-control { padding-right: 4.75rem; }
.combo-list {
  position: fixed;
  background: var(--white); border: 1px solid var(--grey-200);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  max-height: 260px; overflow-y: auto;
  list-style: none; padding: .35rem; margin: 0;
  z-index: 500;
}
.combo-option {
  padding: .55rem .75rem; border-radius: var(--radius);
  font-size: .85rem; color: var(--grey-800); cursor: pointer;
  transition: background .12s;
}
.combo-option:hover, .combo-option.active { background: var(--accent-pale); color: var(--accent-dark); }
.combo-empty { padding: .6rem .75rem; font-size: .8rem; color: var(--grey-600); }
.combo-change-btn {
  position: absolute; right: .5rem; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--accent); font-size: .78rem; font-weight: 700;
  cursor: pointer; padding: .3rem .55rem; border-radius: var(--radius);
}
.combo-change-btn:hover { background: var(--accent-pale); }

/* ── Signed-in banner ─────────────────────────────────────────────────────── */
.signin-banner {
  position: relative;
  background: linear-gradient(135deg, #eef7f1 0%, #f5faf6 100%);
  border: 1px solid rgba(4,106,56,.18);
  color: #163f28;
  border-radius: var(--radius-lg);
  padding: .8rem 1.1rem .8rem 2.6rem;
  font-size: .85rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.signin-banner::before {
  content: '👋';
  position: absolute;
  left: 1rem; top: 50%; transform: translateY(-50%);
  font-size: 1rem;
}
.signin-banner strong { color: var(--navy); font-weight: 600; }


/* ═══════════════════════════════════════════════════════════════════════════
   MODERN POLISH — global refinements layered on top of the base system
   ═══════════════════════════════════════════════════════════════════════════ */

/* Topbar — frosted, subtle */
.topbar {
  background: rgba(255,255,255,.82);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid rgba(16,36,64,.08);
  box-shadow: 0 1px 0 rgba(16,36,64,.02);
}
.topbar-title { letter-spacing: -.01em; }

/* Sidebar brand + logo box refinement */
.sidebar-brand { padding-top: 1.35rem; }
.sidebar-logo-box { box-shadow: 0 4px 14px rgba(0,0,0,.28); }
.nav-section-label { margin-top: .35rem; }

/* Cards — header title icon chip look */
.card-title .icon { font-size: 1.05rem; }

/* Tables — modern, roomy, with a soft container */
.table-wrap {
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
  background: var(--white);
}
.card .table-wrap { border: none; border-radius: 0; box-shadow: none; }
thead th {
  background: #f7f9fc;
  border-bottom: 1px solid var(--grey-200);
  color: #5b6b82;
}
tbody td { padding: .9rem 1rem; }
tbody tr { transition: background .12s ease; }
tbody tr:hover td { background: #f6f9ff; }

/* Badges — softer, pill, subtle ring */
.badge { box-shadow: inset 0 0 0 1px rgba(0,0,0,.03); padding: .25rem .7rem; }

/* Form controls — slightly larger hit area, smooth focus */
.form-control { padding: .65rem .9rem; border-radius: 10px; }
.form-control:hover:not(:focus):not(:disabled) { border-color: var(--grey-400); }

/* Section title accent bar */
.form-section-title { position: relative; }

/* Buttons — outline/ghost refinement */
.btn-ghost { background: var(--white); }
.btn-outline { font-weight: 600; }

/* Empty state polish */
.empty-state .icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 72px; height: 72px; border-radius: 50%;
  background: linear-gradient(135deg, #f2f5fa, #e9eef7);
  margin: 0 auto .75rem;
}

/* Page load fade-in */
@keyframes pageFade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.page-body { animation: pageFade .28s cubic-bezier(.4,0,.2,1); }

/* Custom scrollbars */
* { scrollbar-width: thin; scrollbar-color: #c3ccda transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: #c3ccda; border-radius: 8px;
  border: 2px solid transparent; background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: #a7b3c6; background-clip: content-box; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); background-clip: content-box; }

/* Respect reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .page-body { animation: none; }
  * { transition: none !important; }
}
