@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/icon?family=Material+Icons');

/* ═══════════════════════════════════════════════════════════════════════════
   TRA Admin Portal — Kenya Tourism Design System
   Premium safari-lodge meets government efficiency.
   Palette: Aberdare Forest Green · Warm Cream · Amber Gold · Stone Sand
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Variables ──────────────────────────────────────────────────────────── */
:root {
  /* Core brand */
  --forest:        #064E3B;   /* sidebar background — Aberdare deep green  */
  --forest-mid:    #065F46;   /* sidebar active state                       */
  --forest-dark:   #022C22;   /* header bar                                 */
  --forest-light:  #047857;   /* hover / accent tint                        */
  --amber:         #D97706;   /* primary action colour                      */
  --amber-bright:  #FEF3C7;   /* amber tinted background                    */
  --amber-hover:   #B45309;   /* darker amber on hover                      */

  /* Semantic colours */
  --success:   #059669;
  --danger:    #DC2626;
  --warning:   #D97706;
  --info:      #0284C7;

  /* Tinted backgrounds */
  --success-bright:  rgba(5, 150, 105,  .12);
  --danger-bright:   rgba(220, 38, 38,  .12);
  --warning-bright:  rgba(217, 119, 6,  .15);
  --info-bright:     rgba(2, 132, 199,  .12);
  --amber-bright-bg: rgba(217, 119, 6,  .10);

  /* Neutrals — warm, never cold */
  --body-bg:   #FEFCE8;       /* warm cream page background                 */
  --card-bg:   #FFFFFF;       /* pure white cards                           */
  --border:    #D6D3D1;       /* stone/sand border                          */
  --border-light: #E7E5E4;    /* lighter inner border                       */
  --sand-th:   #F5F0E8;       /* table header warm sand                     */
  --sand-row:  #FDFAF5;       /* alternating table row                      */

  /* Text */
  --dark:    #1C1917;         /* warm near-black                            */
  --text:    #44403C;         /* body text — warm dark brown                */
  --muted:   #78716C;         /* warm grey-brown muted                      */
  --placeholder: #A8A29E;

  /* Layout */
  --header-h: 70px;
  --nav-w:    265px;
  --radius:   12px;           /* rounded cards                              */
  --radius-sm: 8px;           /* buttons, inputs                            */
}

/* ── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--body-bg);
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--amber); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, h5, h6 { color: var(--dark); font-weight: 600; margin: 0 0 .5rem; }
h3 { font-size: 22px; font-weight: 700; }
h4 { font-size: 19px; }
h5 { font-size: 16px; }
h6 { font-size: 14px; }
ul { list-style: none; padding: 0; margin: 0; }
img { max-width: 100%; }
p { margin: 0 0 .75rem; }

/* ═══════════════════════════════════════════════════════════════════════════
   HEADER — dark forest green with diagonal texture
   ═══════════════════════════════════════════════════════════════════════════ */
.header {
  height: var(--header-h);
  background: var(--forest-dark);
  /* subtle diagonal hatch texture */
  background-image:
    repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 8px,
      rgba(255,255,255,.018) 8px,
      rgba(255,255,255,.018) 9px
    );
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 999;
  box-shadow: 0 2px 16px rgba(0, 0, 0, .28);
}

.header-container {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 24px;
  gap: 12px;
}

/* Hamburger toggle */
.nav-toggle {
  background: none;
  border: none;
  color: rgba(255,255,255,.75);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  border-radius: 6px;
  transition: background .15s, color .15s;
}
.nav-toggle:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-toggle i { font-size: 22px; }

/* Logo */
.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -.1px;
}
.header-logo img { height: 30px; }
.header-logo span { opacity: .92; }

/* Date chip */
.header-date {
  color: rgba(255,255,255,.6);
  font-size: 12px;
  padding: 0 14px;
  border-right: 1px solid rgba(255,255,255,.15);
}

/* Right-side nav links */
.header-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}
.header-nav-link {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 12px;
  color: rgba(255,255,255,.75);
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: color .15s, background .15s;
  text-decoration: none;
  position: relative;
}
.header-nav-link:hover { color: #fff; background: rgba(255,255,255,.1); text-decoration: none; }
.header-nav-link i { font-size: 20px; }

/* Notification badge on header icons */
.header-nav-link .nav-badge {
  position: absolute;
  top: 4px;
  right: 4px;
}

/* User dropdown pill — amber avatar */
.user-dropdown { position: relative; }
.user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 50px;
  padding: 5px 14px 5px 5px;
  cursor: pointer;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  transition: background .15s;
}
.user-btn:hover { background: rgba(255,255,255,.2); }
.user-btn .avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--amber);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

/* Dropdown menu */
.user-dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: var(--card-bg);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,.14);
  min-width: 200px;
  z-index: 1000;
  display: none;
  padding: 6px 0;
  border: 1px solid var(--border);
}
.user-dropdown:hover .user-dropdown-menu { display: block; }
.user-dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  color: var(--text);
  font-size: 13px;
  text-decoration: none;
  transition: background .12s;
}
.user-dropdown-menu a:hover { background: var(--body-bg); color: var(--forest); text-decoration: none; }
.user-dropdown-menu a i { font-size: 17px; color: var(--muted); }
.dropdown-divider { height: 1px; background: var(--border-light); margin: 4px 0; }

/* ═══════════════════════════════════════════════════════════════════════════
   LAYOUT SHELL
   ═══════════════════════════════════════════════════════════════════════════ */
.layout-wrapper { min-height: 100vh; }
.content-wrapper {
  display: flex;
  padding-top: var(--header-h);
  min-height: 100vh;
}

/* ═══════════════════════════════════════════════════════════════════════════
   NAVIGATION SIDEBAR — Aberdare forest green
   ═══════════════════════════════════════════════════════════════════════════ */
.navigation {
  width: var(--nav-w);
  background: var(--forest);
  position: fixed;
  top: var(--header-h);
  bottom: 0;
  left: 0;
  overflow-y: auto;
  z-index: 998;
  transition: transform .25s;
  display: flex;
  flex-direction: column;
  /* right border with subtle amber hint on active links via pseudo-element */
  border-right: 1px solid rgba(0,0,0,.15);
}
.navigation::-webkit-scrollbar { width: 3px; }
.navigation::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 3px; }

/* Logo area at top of sidebar */
.nav-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav-logo-text {
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.1px;
}
.nav-logo-sub {
  color: rgba(255,255,255,.5);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 1px;
}

/* Section heading */
.nav-section {
  padding: 20px 20px 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,.35);
}

/* Section title (alias) */
.nav-section-title {
  padding: 20px 20px 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,.35);
  margin: 0;
}

/* Nav links */
.nav-link {
  display: flex;
  align-items: center;
  padding: 11px 20px;
  color: rgba(255,255,255,.65);
  font-size: 13.5px;
  font-weight: 500;
  transition: background .15s, color .15s;
  text-decoration: none;
  gap: 12px;
  position: relative;
  border-left: 3px solid transparent;
}
.nav-link i {
  font-size: 20px;
  flex-shrink: 0;
  transition: color .15s;
}
.nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,.09);
  text-decoration: none;
  border-left-color: rgba(255,255,255,.15);
}

/* Active state — amber left border + amber icon + bold white text */
.nav-link.active {
  color: #fff;
  font-weight: 600;
  background: var(--forest-mid);
  border-left-color: var(--amber);
}
.nav-link.active i { color: var(--amber); }

/* Badge (notification count) */
.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 50px;
  min-width: 20px;
  text-align: center;
  line-height: 1.4;
}
.nav-badge.warn {
  background: var(--amber);
  color: #fff;
}

/* Divider */
.nav-divider {
  height: 1px;
  background: rgba(255,255,255,.08);
  margin: 6px 20px;
}

/* User info block at bottom of sidebar */
.nav-user {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
  margin-top: auto;
}
.nav-user-name { color: rgba(255,255,255,.9); font-size: 13px; font-weight: 600; margin: 0; }
.nav-user-role { color: rgba(255,255,255,.45); font-size: 11px; text-transform: capitalize; margin: 2px 0 0; }

/* Collapsed sidebar (mobile toggle) */
.navigation.collapsed { transform: translateX(calc(-1 * var(--nav-w))); }

/* ═══════════════════════════════════════════════════════════════════════════
   CONTENT BODY
   ═══════════════════════════════════════════════════════════════════════════ */
.content-body {
  flex: 1;
  margin-left: var(--nav-w);
  min-width: 0;
  background: var(--body-bg);
}
.content { padding: 28px; }

/* ── TRA Purple Gradient (mirrors tra.go.ke quality assurance pages) ─────── */
.page-hero {
  background: linear-gradient(135deg,
    #C4A4B4 0%, #9B82C0 30%, #6B52A8 65%, #3B3E90 100%);
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}
.page-hero::after {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 85% 40%, rgba(255,255,255,.09) 0%, transparent 55%),
    radial-gradient(circle at 15% 70%, rgba(255,255,255,.05) 0%, transparent 45%);
  pointer-events: none;
}
.page-hero h3, .page-hero .hero-title {
  color: #fff; font-size: 21px; font-weight: 800;
  margin: 0 0 3px; letter-spacing: -.3px;
}
.page-hero .hero-sub {
  color: rgba(255,255,255,.75); font-size: 13px;
}
.page-hero .hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.15); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 20px; padding: 4px 12px;
  font-size: 11px; font-weight: 700;
  color: rgba(255,255,255,.9); letter-spacing: .5px;
  text-transform: uppercase; margin-bottom: 10px;
}
.page-hero .hero-kpis {
  display: flex; gap: 12px; flex-wrap: wrap;
}
.page-hero .hero-kpi {
  background: rgba(255,255,255,.15); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 10px; padding: 12px 18px;
  color: #fff; text-align: center; min-width: 90px;
}
.page-hero .hero-kpi-num {
  font-size: 22px; font-weight: 800; line-height: 1; display: block;
}
.page-hero .hero-kpi-label {
  font-size: 10px; color: rgba(255,255,255,.72);
  letter-spacing: .4px; text-transform: uppercase; margin-top: 3px; display: block;
}
/* Quality mark badges */
.badge-gold   { background: linear-gradient(135deg,#B8860B,#DAA520); color:#fff; border-radius:20px; padding:3px 10px; font-size:11px; font-weight:700; }
.badge-silver { background: linear-gradient(135deg,#708090,#A8A9AD); color:#fff; border-radius:20px; padding:3px 10px; font-size:11px; font-weight:700; }
.badge-bronze { background: linear-gradient(135deg,#8B4513,#CD853F); color:#fff; border-radius:20px; padding:3px 10px; font-size:11px; font-weight:700; }

/* Page header — flex, space-between, title + buttons */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h3 { margin: 0; }
.page-header-actions { display: flex; gap: 8px; align-items: center; }

/* ═══════════════════════════════════════════════════════════════════════════
   GRID
   ═══════════════════════════════════════════════════════════════════════════ */
.row { display: flex; flex-wrap: wrap; margin: 0 -10px; }
[class*="col-"] { padding: 0 10px; box-sizing: border-box; width: 100%; margin-bottom: 20px; }
@media (min-width: 768px) {
  .col-md-3 { width: 25%; }
  .col-md-4 { width: 33.333%; }
  .col-md-6 { width: 50%; }
}
@media (min-width: 992px) {
  .col-lg-3  { width: 25%; }
  .col-lg-4  { width: 33.333%; }
  .col-lg-5  { width: 41.666%; }
  .col-lg-6  { width: 50%; }
  .col-lg-7  { width: 58.333%; }
  .col-lg-8  { width: 66.666%; }
  .col-lg-12 { width: 100%; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   CARDS — rounded, soft shadow, warm white
   ═══════════════════════════════════════════════════════════════════════════ */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 1px 8px rgba(0,0,0,.06);
  overflow: hidden;
}
.card-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card-bg);
}
.card-header small { font-weight: 400; font-size: 12px; color: var(--muted); }
.card-body { padding: 20px; }
.card-body.p-0 { padding: 0; }
.card-footer {
  padding: 13px 20px;
  border-top: 1px solid var(--border-light);
  font-size: 13px;
  color: var(--muted);
  background: var(--sand-row);
}
.card.mb-3 { margin-bottom: 18px; }

/* ═══════════════════════════════════════════════════════════════════════════
   STAT CARDS — KPI dashboard tiles
   ═══════════════════════════════════════════════════════════════════════════ */
.stat-card {
  border-left: 4px solid var(--border);
  transition: box-shadow .2s, border-color .2s;
}
.stat-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.1); }

/* Colour-coded left border variants — apply via utility classes on the card */
.stat-card.stat-amber  { border-left-color: var(--amber); }
.stat-card.stat-green  { border-left-color: var(--success); }
.stat-card.stat-red    { border-left-color: var(--danger); }
.stat-card.stat-blue   { border-left-color: var(--info); }

/* Card body for stat cards */
.stat-card .card-body {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
}
.stat-info { flex: 1; min-width: 0; }
.stat-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--muted);
  margin-bottom: 4px;
}
.stat-value {
  font-size: 30px;
  font-weight: 800;
  color: var(--dark);
  line-height: 1;
  margin-bottom: 3px;
}
.stat-sub { font-size: 11.5px; color: var(--muted); }

/* Icon circle (avatar within stat card) */
.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   AVATAR
   ═══════════════════════════════════════════════════════════════════════════ */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
}
.avatar-sm  { width: 2.2rem; height: 2.2rem; font-size: 14px; }
.avatar-md  { width: 2.8rem; height: 2.8rem; font-size: 18px; }
.avatar-lg  { width: 3.4rem; height: 3.4rem; font-size: 20px; }
.avatar-title {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}
.rounded-pill { border-radius: 50px !important; }
.mr-3 { margin-right: 14px; }

/* Avatar colour helpers — tinted icon circles */
.bg-primary-bright   { background: var(--amber-bright-bg); }
.bg-secondary-bright { background: rgba(217,119,6,.08); }
.bg-success-bright   { background: var(--success-bright); }
.bg-danger-bright    { background: var(--danger-bright); }
.bg-warning-bright   { background: var(--warning-bright); }
.bg-info-bright      { background: var(--info-bright); }

/* Text colour helpers */
.text-primary   { color: var(--amber) !important; }
.text-secondary { color: var(--amber-hover) !important; }
.text-success   { color: var(--success) !important; }
.text-danger    { color: var(--danger) !important; }
.text-warning   { color: var(--warning) !important; }
.text-info      { color: var(--info) !important; }
.text-muted     { color: var(--muted) !important; }
.text-dark      { color: var(--dark) !important; }
.text-forest    { color: var(--forest) !important; }
.text-amber     { color: var(--amber) !important; }
.text-white     { color: #fff !important; }

/* ═══════════════════════════════════════════════════════════════════════════
   BADGES — status pills
   ═══════════════════════════════════════════════════════════════════════════ */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  line-height: 1.4;
}
/* Active / approved / paid */
.badge-success,
.badge-active,
.badge-approved,
.badge-paid      { background: var(--success-bright); color: #047857; }

/* Danger / expired / suspended / revoked */
.badge-danger,
.badge-expired,
.badge-suspended,
.badge-revoked,
.badge-critical  { background: var(--danger-bright); color: #B91C1C; }

/* Warning / expiring / high / overdue */
.badge-warning,
.badge-expiring,
.badge-high,
.badge-overdue   { background: var(--warning-bright); color: #92400E; }

/* Info / submitted / under review */
.badge-info,
.badge-submitted,
.badge-under_review { background: var(--info-bright); color: #0369A1; }

/* Primary (amber) */
.badge-primary   { background: var(--amber-bright-bg); color: #92400E; }

/* Neutral / pending / new / draft */
.badge-grey,
.badge-pending,
.badge-new,
.badge-draft     { background: #F4F0EC; color: var(--muted); }

/* ═══════════════════════════════════════════════════════════════════════════
   BUTTONS — warm amber primary, rounded
   ═══════════════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .18s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
  font-family: inherit;
}
.btn:hover { text-decoration: none; }
.btn i { font-size: 17px; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-sm i { font-size: 15px; }
.btn-lg { padding: 13px 28px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }

/* Primary — warm amber */
.btn-primary {
  background: var(--amber);
  color: #fff;
  box-shadow: 0 2px 10px rgba(217,119,6,.35);
}
.btn-primary:hover {
  background: var(--amber-hover);
  color: #fff;
  box-shadow: 0 4px 16px rgba(217,119,6,.4);
  transform: translateY(-1px);
}

/* Success — forest green */
.btn-success {
  background: var(--success);
  color: #fff;
  box-shadow: 0 2px 10px rgba(5,150,105,.3);
}
.btn-success:hover {
  background: #047857;
  color: #fff;
  transform: translateY(-1px);
}

/* Danger */
.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 2px 10px rgba(220,38,38,.3);
}
.btn-danger:hover {
  background: #B91C1C;
  color: #fff;
  transform: translateY(-1px);
}

/* Warning */
.btn-warning {
  background: var(--warning);
  color: #fff;
  box-shadow: 0 2px 10px rgba(217,119,6,.3);
}
.btn-warning:hover { background: var(--amber-hover); color: #fff; }

/* Info */
.btn-info {
  background: var(--info);
  color: #fff;
  box-shadow: 0 2px 10px rgba(2,132,199,.3);
}
.btn-info:hover { background: #0369A1; color: #fff; }

/* Light / ghost */
.btn-light {
  background: #F5F0E8;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-light:hover { background: var(--border); color: var(--dark); }

/* Dark */
.btn-dark {
  background: var(--dark);
  color: #fff;
  box-shadow: 0 2px 8px rgba(28,25,23,.3);
}
.btn-dark:hover { background: #0C0A09; color: #fff; }

/* Outline variants */
.btn-outline-primary {
  background: transparent;
  color: var(--amber);
  border: 1.5px solid var(--amber);
}
.btn-outline-primary:hover { background: var(--amber); color: #fff; }

.btn-outline-light {
  background: transparent;
  color: rgba(255,255,255,.8);
  border: 1.5px solid rgba(255,255,255,.3);
}
.btn-outline-light:hover { background: rgba(255,255,255,.12); color: #fff; }

/* Login sign-in button */
.btn-signin {
  width: 100%;
  padding: 14px;
  background: var(--amber);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: .2px;
  box-shadow: 0 2px 12px rgba(217,119,6,.4);
  transition: background .18s, transform .12s, box-shadow .18s;
}
.btn-signin:hover {
  background: var(--amber-hover);
  box-shadow: 0 4px 18px rgba(217,119,6,.45);
  transform: translateY(-1px);
}
.btn-signin:active { transform: scale(.99); }

/* ═══════════════════════════════════════════════════════════════════════════
   TABLES — warm sand header, alternating cream rows
   ═══════════════════════════════════════════════════════════════════════════ */
.table-responsive { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.table thead th {
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
  background: var(--sand-th);
  white-space: nowrap;
}
.table thead th:first-child { border-radius: 0; }
.table tbody td {
  padding: 12px 16px;
  color: var(--text);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
.table tbody tr:nth-child(even) td { background: var(--sand-row); }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td {
  background: rgba(217,119,6,.05);
}
.font-mono { font-family: 'Courier New', Courier, monospace; }

/* ═══════════════════════════════════════════════════════════════════════════
   FORMS — warm focused border with amber ring
   ═══════════════════════════════════════════════════════════════════════════ */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--dark);
  background: var(--card-bg);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  font-family: inherit;
}
.form-control::placeholder { color: var(--placeholder); }
.form-control:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(217,119,6,.15);
}
.form-control:hover:not(:focus) { border-color: #A8A29E; }
select.form-control { cursor: pointer; }
textarea.form-control { min-height: 100px; resize: vertical; }
.form-control-sm { padding: 6px 10px; font-size: 13px; }

/* Login-specific field variants */
.field-group { margin-bottom: 18px; }
.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: 8px;
}
.field-input {
  width: 100%;
  padding: 12px 16px;
  background: #F8F5EE;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--dark);
  outline: none;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.field-input:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(217,119,6,.15);
  background: #fff;
}
.field-input::placeholder { color: var(--placeholder); }

/* ═══════════════════════════════════════════════════════════════════════════
   ALERTS — left-bordered info panels
   ═══════════════════════════════════════════════════════════════════════════ */
.alert {
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  border: none;
  border-left: 3px solid;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert i { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-success {
  background: var(--success-bright);
  border-color: var(--success);
  color: #065F46;
}
.alert-danger {
  background: var(--danger-bright);
  border-color: var(--danger);
  color: #991B1B;
}
.alert-warning {
  background: var(--warning-bright);
  border-color: var(--warning);
  color: #92400E;
}
.alert-info {
  background: var(--info-bright);
  border-color: var(--info);
  color: #075985;
}
.alert-primary {
  background: var(--amber-bright-bg);
  border-color: var(--amber);
  color: #92400E;
}
/* Non-standard selector found in PHP pages */
.alert-error {
  background: var(--danger-bright);
  border-color: var(--danger);
  color: #991B1B;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FILTER TABS — pill-style row filter buttons
   ═══════════════════════════════════════════════════════════════════════════ */
.filter-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.filter-tabs .btn {
  border-radius: 50px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 600;
}
/* Active pill = amber background, white text */
.filter-tabs .btn-primary {
  background: var(--amber);
  color: #fff;
  border: 1.5px solid var(--amber);
}
/* Inactive pill = light warm */
.filter-tabs .btn-light {
  background: #F5F0E8;
  color: var(--muted);
  border: 1.5px solid var(--border);
}
.filter-tabs .btn-light:hover {
  background: var(--amber-bright);
  color: var(--amber-hover);
  border-color: var(--amber);
}

/* ═══════════════════════════════════════════════════════════════════════════
   STATUS TIMELINE — vertical timeline for status history
   ═══════════════════════════════════════════════════════════════════════════ */
.status-timeline { list-style: none; padding: 0; margin: 0; }
.status-timeline li {
  display: flex;
  gap: 14px;
  padding-bottom: 20px;
  position: relative;
}
.status-timeline li:last-child { padding-bottom: 0; }

/* Vertical connecting line */
.status-timeline li::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 28px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.status-timeline li:last-child::before { display: none; }

/* Dot / icon circle */
.timeline-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  z-index: 1;
}
.timeline-dot i { font-size: 16px; color: var(--muted); }
.timeline-dot.success { background: var(--success-bright); }
.timeline-dot.success i { color: var(--success); }
.timeline-dot.danger  { background: var(--danger-bright); }
.timeline-dot.danger  i { color: var(--danger); }
.timeline-dot.warning { background: var(--warning-bright); }
.timeline-dot.warning i { color: var(--warning); }
.timeline-dot.amber   { background: var(--amber-bright-bg); }
.timeline-dot.amber   i { color: var(--amber); }

.timeline-content { flex: 1; padding-top: 5px; }
.timeline-title { font-weight: 600; font-size: 13.5px; color: var(--dark); margin-bottom: 2px; }
.timeline-meta { font-size: 12px; color: var(--muted); }

/* ═══════════════════════════════════════════════════════════════════════════
   RISK BAR
   ═══════════════════════════════════════════════════════════════════════════ */
.risk-bar {
  display: inline-block;
  width: 60px;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  vertical-align: middle;
}
.risk-bar-fill {
  height: 100%;
  background: linear-gradient(to right, var(--success), var(--warning) 55%, var(--danger));
  border-radius: 3px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ATTENTION LIST (right-rail panel)
   ═══════════════════════════════════════════════════════════════════════════ */
.attention-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}
.attention-list li:last-child { border-bottom: none; padding-bottom: 0; }
.attention-list .att-label { color: var(--text); }
.attention-list .att-value { font-weight: 700; font-size: 14px; }

/* ═══════════════════════════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════════════════════════ */
.empty-state {
  text-align: center;
  color: var(--muted);
}
.empty-state i {
  font-size: 48px;
  color: var(--border);
  margin-bottom: 12px;
  display: block;
}
.empty-state p { font-size: 14px; color: var(--muted); }

/* ═══════════════════════════════════════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════════════════════════════════════ */
.login-wrap {
  display: flex;
  min-height: 100vh;
}

/* Left hero panel */
.login-hero {
  flex: 0 0 48%;
  position: relative;
  overflow: hidden;
  background-color: var(--forest-dark);
  background-image: url('https://images.unsplash.com/photo-1534177616072-ef7dc120449d?auto=format&fit=crop&w=900&q=85');
  background-size: cover;
  background-position: center 55%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.login-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(6,78,59,.92) 0%, rgba(6,78,59,.4) 55%, transparent 100%),
    linear-gradient(to bottom, transparent 40%, rgba(0,0,0,.8) 100%);
}

/* Kenya flag bar */
.hero-flag-bar {
  position: relative;
  z-index: 1;
  display: flex;
  height: 4px;
}
.hero-flag-bar span:nth-child(1) { flex: 1; background: #006600; }
.hero-flag-bar span:nth-child(2) { flex: 1; background: #cc0000; }
.hero-flag-bar span:nth-child(3) { flex: 1; background: #fff; }
.hero-flag-bar span:nth-child(4) { flex: 1; background: #000; }

.hero-top {
  position: relative;
  z-index: 1;
  padding: 32px 36px;
}
.hero-shield {
  width: 52px;
  height: 52px;
  background: rgba(255,255,255,.12);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 22px;
}
.hero-title-sm {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,.6);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.hero-title {
  font-size: 30px;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
  letter-spacing: -.4px;
  text-shadow: 0 2px 12px rgba(0,0,0,.5);
  margin-bottom: 14px;
}
.hero-sub {
  font-size: 13px;
  color: rgba(255,255,255,.7);
  line-height: 1.6;
  max-width: 320px;
}
.hero-bottom {
  position: relative;
  z-index: 1;
  padding: 24px 36px 28px;
}
.hero-access-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
}
.hero-access-bar .material-icons { font-size: 15px; color: var(--amber); }
.hero-access-text { font-size: 11px; color: rgba(255,255,255,.8); letter-spacing: .2px; }
.hero-copyright { font-size: 10px; color: rgba(255,255,255,.35); }

/* Right login panel */
.login-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 56px 64px;
  background: var(--body-bg);
}
.login-logo { margin-bottom: 8px; }
.login-brand-name {
  font-size: 22px;
  font-weight: 800;
  color: var(--dark);
  letter-spacing: -.3px;
  margin-bottom: 4px;
}
.login-brand-sub {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 32px;
}
.login-heading {
  font-size: 24px;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 6px;
}
.login-hint { font-size: 13.5px; color: var(--muted); margin-bottom: 28px; }
.login-coa { width: 56px; height: 56px; object-fit: contain; margin-bottom: 20px; }
.login-portal-label {
  display: inline-block;
  background: var(--amber-bright-bg);
  color: var(--amber-hover);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 12px;
  border-radius: 50px;
  border: 1px solid rgba(217,119,6,.2);
  margin-bottom: 24px;
}
.login-divider { height: 1px; background: var(--border-light); margin: 20px 0; }
.login-panel { max-width: 400px; width: 100%; }
.login-footer { font-size: 11px; color: var(--muted); margin-top: 28px; }

.security-note {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(5,150,105,.08);
  border: 1px solid rgba(5,150,105,.2);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  color: #065F46;
  margin-top: 16px;
}
.security-note .material-icons { font-size: 15px; color: var(--success); flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════════════════════════
   UTILITY CLASSES
   ═══════════════════════════════════════════════════════════════════════════ */
.d-flex            { display: flex; }
.d-inline-flex     { display: inline-flex; }
.d-block           { display: block; }
.d-none            { display: none; }
.align-items-center    { align-items: center; }
.align-items-start     { align-items: flex-start; }
.justify-content-between { justify-content: space-between; }
.justify-content-center  { justify-content: center; }
.flex-wrap         { flex-wrap: wrap; }
.flex-1            { flex: 1; }
.ml-auto           { margin-left: auto; }
.mr-auto           { margin-right: auto; }
.gap-1 { gap: 6px; }
.gap-2 { gap: 12px; }
.gap-3 { gap: 18px; }

/* Margins */
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 6px; }
.mb-2 { margin-bottom: 12px; }
.mb-3 { margin-bottom: 18px; }
.mb-4 { margin-bottom: 24px; }
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 18px; }
.mt-4 { margin-top: 24px; }

/* Padding */
.p-0  { padding: 0; }
.p-3  { padding: 18px; }
.px-3 { padding-left: 12px; padding-right: 12px; }
.py-3 { padding-top: 18px; padding-bottom: 18px; }

/* Typography */
.text-sm     { font-size: 12.5px; }
.text-xs     { font-size: 11px; }
.fw-bold     { font-weight: 700; }
.fw-semibold { font-weight: 600; }
.fw-medium   { font-weight: 500; }
.text-nowrap { white-space: nowrap; }
.text-center { text-align: center; }
.text-right  { text-align: right; }

/* Sizing */
.w-100 { width: 100%; }
.h-100 { height: 100%; }

/* ═══════════════════════════════════════════════════════════════════════════
   SCROLLBAR — warm subtle
   ═══════════════════════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(120,113,108,.25); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(120,113,108,.4); }

/* ═══════════════════════════════════════════════════════════════════════════
   CHARTS — canvas sizing within cards
   ═══════════════════════════════════════════════════════════════════════════ */
canvas { max-width: 100%; }

.revenue-chart-body {
  padding: 16px 18px 14px;
}

#revenueChart {
  display: block;
  width: 100%;
  height: 260px;
}

@media (max-width: 768px) {
  #revenueChart { height: 220px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — collapse sidebar on mobile
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Layout */
  .navigation {
    transform: translateX(calc(-1 * var(--nav-w)));
    z-index: 998;
  }
  .navigation.open {
    transform: translateX(0);
  }
  .content-body {
    margin-left: 0;
  }
  .login-hero { display: none; }
  .login-box  { padding: 32px 24px; }
  .content { padding: 18px 16px; }

  /* Touch targets: ensure buttons and links are at least 44px */
  .btn, button, a.btn {
    min-height: 44px;
    padding: 12px 16px;
    font-size: 14px;
  }
  .btn-sm {
    min-height: 36px;
    padding: 8px 12px;
  }

  /* Tables: responsive with horizontal scroll */
  .table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .table {
    min-width: 600px;
  }

  /* Forms: full width on mobile */
  .form-group {
    margin-bottom: 18px;
  }
  .form-control, .form-label, input, select, textarea {
    font-size: 16px; /* Prevents zoom on iOS */
  }
  .row {
    margin: 0 -8px;
  }
  .col-md-6, .col-md-3, .col-md-4 {
    width: 100%;
    flex: none;
    padding: 0 8px;
    margin-bottom: 12px;
  }

  /* Cards: better spacing */
  .card {
    margin-bottom: 16px;
    border-radius: 8px;
  }
  .card-header {
    padding: 14px 16px;
  }
  .card-body {
    padding: 14px 16px;
  }
  .card-footer {
    padding: 12px 16px;
  }

  /* Page header: stack on mobile */
  .page-header {
    flex-direction: column;
    gap: 12px;
  }
  .page-header-actions {
    width: 100%;
  }
  .page-header-actions .btn {
    width: 100%;
  }

  /* Badges and status: bigger on mobile */
  .badge {
    padding: 6px 10px;
    font-size: 12px;
  }

  /* Modals: full width on mobile */
  .modal {
    padding: 16px;
  }
  .modal-content {
    width: 100%;
    max-width: 100%;
    border-radius: 12px;
  }

  /* Navigation toggle button visibility */
  .nav-toggle {
    display: block;
  }

  /* Header: optimize for small screens */
  .header-container {
    padding: 8px 16px;
  }
  .header-logo span {
    font-size: 14px;
  }
  .header-date {
    display: none;
  }

  /* User avatar: bigger for touch */
  .avatar-sm {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 480px) {
  /* Extra small screens */
  .content { padding: 12px 12px; }
  .page-header h3 { font-size: 20px; }
  .btn, button, a.btn {
    width: 100%;
    display: block;
  }
  .card-header, .card-body, .card-footer {
    padding: 12px 12px;
  }
  .form-control, input, select, textarea {
    padding: 12px;
    border-radius: 6px;
  }
  table { font-size: 12px; }
  th, td { padding: 10px 8px; }
}
