/* ============================================================
   MASI EARTH — Design Tokens & Global Foundation
   iTaukei Trust Fund Board — Database Management System
   ============================================================
   Culturally grounded design language inspired by traditional
   Fijian masi (tapa cloth) — hand-stamped geometric patterns
   in earthy ochre, terracotta, and espresso on cream parchment.
   ============================================================ */

/* ── FONT IMPORTS ── */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Playfair+Display:wght@400;600;700&display=swap');

/* ── DESIGN TOKENS ── */
:root {
  /* ── COLOUR PALETTE — Modern Refresh ── */

  /* Surface — clean, cool-toned whites */
  --cream:        #F1F5F9;   /* slate-100 — main page background */
  --cream-dark:   #E2E8F0;   /* slate-200 — borders, dividers */

  /* Espresso → Deep Navy — sidebar & header accents */
  --espresso:     #0F172A;   /* slate-900 */
  --espresso-lt:  #1E293B;   /* slate-800 */

  /* Terra / Terracotta → Vibrant Coral-Orange — primary brand action */
  --terra:        #EA580C;   /* orange-600 */
  --terra-lt:     #F97316;   /* orange-500 */

  /* Fern Green → Emerald — positive/success semantic */
  --fern:         #059669;   /* emerald-600 */

  /* Gold → Amber — accent highlights */
  --gold:         #D97706;   /* amber-600 */

  /* Text */
  --charcoal:     #1E293B;   /* slate-800 */
  --muted:        #64748B;   /* slate-500 */

  /* Pure white — card surfaces */
  --white:        #FFFFFF;

  /* NEW: Accent blue for links / info elements */
  --accent-blue:  #3B82F6;   /* blue-500 */

  /* ── ELEVATION ── */
  --shadow:       0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md:    0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg:    0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);

  /* ── SHAPE ── */
  --radius:       10px;
  --radius-sm:    6px;
  --radius-lg:    14px;

  /* ── LAYOUT ── */
  --sidebar-w:    250px;
}

/* ── GLOBAL RESETS & BODY ── */

/* Universal box-sizing — prevents padding/border from breaking layouts */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--cream);
  color: var(--charcoal);
  min-height: 100vh;
  display: flex;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── TYPOGRAPHY — TYPE SCALE ── */
/* Playfair Display carries institutional authority — appropriate for a
   government trust fund body. Its wide serif numerals are distinctly
   readable at 36px for KPI cards. DM Sans handles all interactive UI
   without stylistic noise. Pairing communicates: "trusted institution,
   modern operations." */

/* Page title */
h1,
.page-title {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 28px;
  color: var(--espresso);
  line-height: 1.2;
}

/* Card / chart title */
h2,
.card-title {
  font-family: 'Playfair Display', serif;
  font-weight: 600;
  font-size: 15px;
  color: var(--espresso);
  line-height: 1.3;
}

/* KPI number — large stat figures on dashboard cards */
.kpi-number {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 36px;
  color: var(--espresso);
  line-height: 1;
}

/* Donut / chart center number */
.donut-number {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 18px;
}

/* Logo org name — gold on espresso sidebar */
.logo-org-name {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 12px;
  color: var(--gold);
}

/* Logo emblem letter */
.logo-emblem-letter {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 18px;
  color: var(--espresso);
}

/* All UI / body text — inherited from body, explicit class available */
.body-text,
p {
  font-family: 'DM Sans', sans-serif;
  font-weight: 400;
  font-size: 14px;
  color: var(--charcoal);
  line-height: 1.6;
}

/* Button labels */
.btn-label {
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  font-size: 13px;
}

/* Table body text */
.table td,
.table-body-text {
  font-family: 'DM Sans', sans-serif;
  font-weight: 400;
  font-size: 13px;
  color: var(--charcoal);
}

/* Column headers — uppercase, muted */
.table th,
.col-header {
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

/* Badge text — colour set per badge variant elsewhere */
.badge-text {
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 11px;
}

/* Nav section labels — uppercase, 30% white on dark sidebar */
.nav-section-label {
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.30);
}

/* Metadata / footer — small muted text */
.meta-text,
small,
.footer-text {
  font-family: 'DM Sans', sans-serif;
  font-weight: 400;
  font-size: 11px;
  color: var(--muted);
}

/* ── MASI SVG BACKGROUND PATTERNS ── */
/* Inline SVG data-URIs: zero network cost, infinite resolution scaling. */

/* Pattern A — Sidebar: Triangular Masi Motif
   40×40px repeating tile: 4 corner right-triangles in gold at 8–12% opacity,
   2 alternating quadrant fills in terracotta at 7% opacity.
   Creates the diagonal triangular masi tapa grid.
   Opacities kept very low — pattern must be felt, not seen.
   Nielsen H8: Aesthetic & minimalist design — decoration must never
   compete with navigation content for attention. */
.masi-pattern {
  background: linear-gradient(180deg, #0F172A 0%, #1E293B 100%);
}

/* Pattern B — Footer Border: Checkerboard Masi Motif
   20×20px repeating tile: alternating 10×10px squares —
   terracotta at 30% and espresso at 20%.
   Traditional masi border checkerboard, 6px height only —
   purely ornamental, never structural. */
.masi-border {
  background: linear-gradient(90deg, #EA580C, #F97316, #D97706, #059669);
  height: 4px;
  width: 100%;
  border-radius: 2px;
}

/* Pattern C — Sidebar Top: Gradient Masi Strip
   Three-colour gradient: Terracotta (fire/earth) → Gold (sun/harvest) → Fern (land/nature)
   The three dominant natural colours of Fiji's physical landscape.
   At 4px height it acts as a brand colour bar anchoring the sidebar's top. */
.masi-strip {
  height: 3px;
  background: linear-gradient(90deg, #EA580C, #F97316, #D97706, #059669);
}

/* ── SIDEBAR COMPONENT ── */
/* Primary navigation surface. Fixed full-height, 230px wide,
   with masi background pattern applied. */

.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 1200;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-logo {
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo-img {
  width: 160px;
  height: auto;
  object-fit: contain;
}

/* Logo emblem — circular gold badge with "T" initial */
.logo-emblem {
  width: 42px;
  height: 42px;
  background: var(--gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--espresso);            /* Dark letter on gold ≈ 8.2:1 contrast */
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(212, 168, 54, 0.25);
  /* Soft gold halo ring: creates depth without a hard border.
     3px matches the active nav indicator width — internal coherence. */
}

.logo-text { line-height: 1.2; }

.logo-text strong {
  display: block;
  font-family: 'Playfair Display', serif;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);                /* Gold text on espresso ≈ 6.1:1 contrast */
  letter-spacing: 0.5px;
}

.logo-text span {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.45); /* De-emphasised subtitle — context only */
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Nav scroll container */
.sidebar-nav {
  flex: 1;
  padding: 16px 0;
  overflow-y: auto;
  /* Scrollable independently: if nav items exceed viewport height,
     main content remains accessible. No keyboard trap.
     Nielsen H3: User control and freedom */
}

/* Section group labels */
.sidebar-nav .nav-section-label {
  padding: 12px 24px 4px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.30);
  /* Very low opacity: structural grouping, not content.
     Nielsen H8: Remove anything not necessary. */
}

/* Nav link — default state */
.sidebar-nav .nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 24px;
  /* 11px vertical × 2 = 22px + content ≈ 44px touch target minimum.
     Fitts's Law: adequate hit area for navigation. */
  color: rgba(255, 255, 255, 0.65); /* Inactive: visible but receded */
  cursor: pointer;
  transition: all 0.18s ease;
  text-decoration: none;
  position: relative;
  font-size: 13.5px;
  font-weight: 400;
}

/* Hover state */
.sidebar-nav .nav-item:hover {
  color: var(--cream);
  background: rgba(212, 168, 54, 0.08);
  /* Gold-tinted hover glow at 8%: acknowledges cursor position
     without competing with terracotta active state.
     Nielsen H1: Visibility of system status */
}

/* Active / current page state */
.sidebar-nav .nav-item.active {
  color: var(--cream);
  background: rgba(196, 98, 45, 0.18); /* Terracotta at 18% */
  font-weight: 500;
}

/* Active indicator — left-edge vertical bar */
.sidebar-nav .nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--terra);
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 8px rgba(234, 88, 12, 0.40);
}

/* Icon spec — all nav icons */
.nav-icon {
  width: 18px;
  height: 18px;
  opacity: 0.8;
  flex-shrink: 0;
  transition: all 0.18s ease;
  /* stroke="currentColor" fill="none" stroke-width="1.8"
     viewBox="0 0 24 24" — outlined, light on dark sidebar.
     Never use icon fonts: screen reader accessibility issues. */
}

/* Nav icon on hover — brighten and scale up slightly for interactive feedback */
.sidebar-nav .nav-item:hover .nav-icon {
  opacity: 1;
  transform: scale(1.1);
}

/* Nav icon on active nav item — show at full brightness */
.sidebar-nav .nav-item.active .nav-icon {
  opacity: 1;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.25);
  text-align: center;
}

/* ── TOPBAR COMPONENT ── */
/* Fixed at top of content area, offset left by sidebar width.
   Height: 62px. z-index below sidebar. */

.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: 64px;
  background: rgba(255, 255, 255, 0.80);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--cream-dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  z-index: 1100;
}

.topbar .breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  background: none;
  margin: 0;
  padding: 0;
  /* Nielsen H1: Visibility of system status — breadcrumb
     tells users exactly where they are. */
}
.topbar .breadcrumb a { color: var(--muted); text-decoration: none; transition: color 0.15s; }
.topbar .breadcrumb a:hover { color: var(--terra); }
.breadcrumb-sep { color: var(--cream-dark); }
.breadcrumb-current { color: var(--charcoal); font-weight: 500; }

/* Secondary button (User Manual) */
.topbar-btn {
  padding: 7px 16px;
  border-radius: var(--radius);
  border: 1.5px solid var(--cream-dark);
  background: var(--white);
  color: var(--charcoal);
  font-family: 'DM Sans', sans-serif;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.topbar-btn:hover { border-color: var(--terra); color: var(--terra); }

/* Primary button (+ App) */
.topbar-btn.primary {
  background: linear-gradient(135deg, var(--terra) 0%, var(--terra-lt) 100%);
  border-color: var(--terra);
  border: 1.5px solid var(--terra) !important;
  color: var(--white) !important;
  font-weight: 600 !important;
  cursor: pointer;
  transition: all 0.2s ease !important;
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.25) !important;
}
.topbar-btn.primary:hover {
  background: linear-gradient(135deg, var(--terra-lt) 0%, var(--terra) 100%) !important;
  border-color: var(--terra-lt) !important;
  color: var(--white) !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(234, 88, 12, 0.35) !important;
}

/* User identity chip */
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 6px;
  background: var(--white);
  border: 1.5px solid var(--cream-dark);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'DM Sans', sans-serif;
}
.user-chip:hover { border-color: var(--terra); }

.user-avatar {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--terra) 0%, var(--terra-lt) 100%);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--white);
  letter-spacing: 0.5px;
}
.user-info strong { display: block; font-size: 12px; font-weight: 600; color: var(--charcoal); }
.user-info span   { font-size: 10px; color: var(--muted); }

.topbar-right { display: flex; align-items: center; gap: 16px; }

/* User dropdown */
.user-chip-wrapper {
  position: relative;
}
.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 160px;
  background: var(--white);
  border: 1px solid var(--cream-dark);
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.10);
  overflow: hidden;
  z-index: 1300;
}
.user-dropdown a,
.user-dropdown button {
  display: block;
  width: 100%;
  padding: 10px 16px;
  text-align: left;
  font-size: 13px;
  color: var(--charcoal);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s;
}
.user-dropdown a:hover,
.user-dropdown button:hover { background: var(--cream); }
.user-dropdown form { margin: 0; }
.user-dropdown button { color: var(--terra); }

/* ── GLOBAL LINK STYLE ── */
a {
  text-decoration: none;
}
a:hover {
  text-decoration: none;
}

/* ── MAIN CONTENT AREA ── */

.main {
  margin-left: var(--sidebar-w);
  margin-top: 64px;
  padding: 28px 32px;
  flex: 1;
  min-height: calc(100vh - 64px);
  background-color: var(--cream);
  position: relative;
}

/* Ensure all sections/cards within main inherit cream bg */
.main .card-body.card-dashboard,
.main section {
  background-color: transparent;
}
.main > section,
.main .row {
  background-color: transparent;
}



.page-header { margin-bottom: 24px; }

.page-title {
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--espresso);
  margin-bottom: 2px;
}

.page-subtitle {
  font-size: 14px;
  color: var(--muted);
  font-weight: 400;
}

/* Smooth fade-in for main content */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.main > .page-header,
.main > .stats-grid,
.main > .charts-row,
.main > .card,
.main > .project-grid,
.main > section,
.main > .row {
  animation: fadeInUp 0.4s ease both;
}
.main > :nth-child(2) { animation-delay: 0.05s; }
.main > :nth-child(3) { animation-delay: 0.10s; }
.main > :nth-child(4) { animation-delay: 0.15s; }

/* ── KPI STAT CARDS ── */
/* 4-equal columns: all KPIs identical visual weight.
   Nielsen H6: Recognition over recall — all 4 key metrics visible. */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  border: 1px solid var(--cream-dark);
  position: relative;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* Bottom accent bars — 4px vibrant per card */
.stat-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 4px;
}
.stat-card.c1::after { background: linear-gradient(90deg, #059669, #34D399); }
.stat-card.c2::after { background: linear-gradient(90deg, #EA580C, #F97316); }
.stat-card.c3::after { background: linear-gradient(90deg, #D97706, #FBBF24); }
.stat-card.c4::after { background: linear-gradient(90deg, #3B82F6, #60A5FA); }

/* Icon area — coloured tint matching card accent */
.stat-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
  font-size: 15px;
}
.stat-card.c1 .stat-icon { background: rgba(5, 150, 105, 0.10); }
.stat-card.c2 .stat-icon { background: rgba(234, 88, 12, 0.10); }
.stat-card.c3 .stat-icon { background: rgba(217, 119, 6, 0.10); }
.stat-card.c4 .stat-icon { background: rgba(59, 130, 246, 0.10); }

.stat-num {
  font-family: 'Playfair Display', serif;
  font-size: 30px;
  font-weight: 700;
  color: var(--espresso);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-label { font-size: 11px; color: var(--muted); font-weight: 500; letter-spacing: 0.3px; }

.stat-trend { margin-top: 12px; }
.trend-badge {
  padding: 2px 7px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
}
.trend-badge.up {
  background: rgba(77, 107, 69, 0.12);
  color: var(--fern);
}

/* ── CHARTS ROW ── */
/* Two side-by-side chart cards in asymmetric grid */

.charts-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 20px;
  margin-bottom: 24px;
}

.chart-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  border: 1px solid var(--cream-dark);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.chart-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.chart-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.chart-title {
  font-family: 'Playfair Display', serif;
  font-size: 15px; font-weight: 600;
  color: var(--espresso);
}
.chart-subtitle { font-size: 11px; color: var(--muted); margin-top: 2px; }
.chart-badge {
  font-size: 11px; font-weight: 600;
  padding: 4px 10px; border-radius: 20px;
  background: rgba(196, 98, 45, 0.10);
  color: var(--terra);
}

/* Donut chart layout */
.donut-wrap { display: flex; align-items: center; gap: 28px; }
.donut-svg  { flex-shrink: 0; }
.donut-legend { flex: 1; }

.legend-item {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px; font-size: 12px; color: var(--charcoal);
}
.legend-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.legend-val {
  margin-left: auto;
  font-weight: 600; font-size: 12px;
}

/* Bar chart */
.bar-chart {
  display: flex; align-items: flex-end;
  gap: 10px; height: 140px; margin-top: 8px;
}
.bar-group { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bar-wrap { width: 100%; display: flex; flex-direction: column; justify-content: flex-end; height: 120px; }
.bar {
  width: 100%; border-radius: 4px 4px 0 0;
  transition: opacity 0.2s; cursor: pointer;
}
.bar:hover { opacity: 0.8; }
.bar-label { font-size: 10px; color: var(--muted); text-align: center; white-space: nowrap; }

/* ── DATA TABLE ── */

.table-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(46, 29, 18, 0.06);
  overflow: hidden;
}

.table-header {
  padding: 20px 24px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--cream-dark);
}

.search-box {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  background: var(--cream);
  border: 1px solid var(--cream-dark);
  border-radius: 6px;
  font-size: 12px; color: var(--muted);
  cursor: text;
}

.table-card table { width: 100%; border-collapse: collapse; }

.table-card thead th {
  padding: 11px 24px;
  text-align: left;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--muted);
  background: var(--cream);
  border-bottom: 1px solid var(--cream-dark);
}

.table-card tbody tr {
  border-bottom: 1px solid rgba(237, 224, 192, 0.6);
  transition: background 0.12s;
  cursor: pointer;
}
.table-card tbody tr:last-child { border-bottom: none; }
.table-card tbody tr:hover {
  background: rgba(247, 239, 216, 0.5);
}
.table-card tbody td { padding: 14px 24px; font-size: 13px; color: var(--charcoal); }

/* Badges */
.badge {
  display: inline-flex; align-items: center;
  padding: 4px 12px; border-radius: 20px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.3px;
}
.badge.green  { background: rgba(5,150,105,0.10);  color: var(--fern);  }
.badge.orange { background: rgba(234,88,12,0.10);  color: var(--terra); }
.badge.gold   { background: rgba(217,119,6,0.10); color: var(--gold);   }

/* Action buttons */
.action-btn {
  width: 30px; height: 30px;
  border-radius: 6px;
  border: 1px solid var(--cream-dark);
  background: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  margin-right: 4px;
  color: var(--muted);
}
.action-btn:hover {
  border-color: var(--terra); color: var(--terra);
  background: rgba(196, 98, 45, 0.06);
}

/* Primary add button */
.add-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  padding: 9px 20px !important;
  background: linear-gradient(135deg, var(--terra) 0%, var(--terra-lt) 100%) !important;
  color: var(--white) !important;
  border: none !important;
  border-radius: var(--radius) !important;
  font-family: 'DM Sans', sans-serif !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.25) !important;
  text-decoration: none !important;
}
.add-btn:hover {
  background: linear-gradient(135deg, var(--terra-lt) 0%, var(--terra) 100%) !important;
  color: var(--white) !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(234, 88, 12, 0.35) !important;
}

/* ── ACCESSIBILITY ── */

/* Skip to main content link — WCAG 2.2 SC 2.4.1 */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  padding: 8px 16px;
  background: var(--terra);
  color: white;
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px; font-weight: 500;
  text-decoration: none;
  z-index: 9999;
  transition: top 0.15s;
}
.skip-link:focus {
  top: 16px;
  /* Visible only when keyboard-focused. Lets keyboard/screen-reader
     users skip sidebar nav and jump directly to main content. */
}

/* ── INTERACTION STATE MATRIX ── */
/* Applied to every interactive element for consistent feedback. */

/* Focus-visible — keyboard navigation ring.
   NEVER suppress — keyboard users depend on this entirely. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible,
.nav-item:focus-visible,
.topbar-btn:focus-visible,
.user-chip:focus-visible,
.action-btn:focus-visible,
.add-btn:focus-visible,
.stat-card:focus-visible,
.bar:focus-visible {
  outline: 2px solid var(--terra);
  outline-offset: 2px;
}

/* Active / pressed — visual confirmation of click */
.topbar-btn:active,
.add-btn:active,
.action-btn:active {
  transform: translateY(0);
  box-shadow: none;
  /* Sinks back to resting position — confirms click registered */
}

/* Disabled — unavailable state */
button:disabled,
input:disabled,
select:disabled,
textarea:disabled,
[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  /* 45% opacity: clearly non-interactive but still visible.
     Nielsen H5: Error prevention — disabled = not available in current state */
}

/* ── PROJECT DETAIL ACTION BUTTONS ── */
/* Override all inline-styled buttons on project detail to use system colors */

/* Primary action: Edit, Save, Upload, Training, Sub-Project, etc. */
.btn.btn-sm[style*="background-color:#C4622D"],
.btn.btn-sm[style*="background-color: #C4622D"],
a.btn.btn-sm[style*="background-color:#C4622D"] {
  background: linear-gradient(135deg, var(--terra) 0%, var(--terra-lt) 100%) !important;
  border: none !important;
  border-radius: var(--radius) !important;
  color: var(--white) !important;
  font-family: 'DM Sans', sans-serif !important;
  font-weight: 500 !important;
  font-size: 13px !important;
  padding: 8px 18px !important;
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.25) !important;
  transition: all 0.2s !important;
}
.btn.btn-sm[style*="background-color:#C4622D"]:hover,
a.btn.btn-sm[style*="background-color:#C4622D"]:hover {
  background: linear-gradient(135deg, var(--terra-lt) 0%, var(--terra) 100%) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.35) !important;
}

/* Delete action */
.btn.btn-sm[style*="background-color:#7B1C1C"],
.btn.btn-sm[style*="background-color: #7B1C1C"] {
  background: #991B1B !important;
  border: none !important;
  border-radius: var(--radius) !important;
  color: var(--white) !important;
  font-family: 'DM Sans', sans-serif !important;
  font-weight: 500 !important;
  font-size: 13px !important;
  padding: 8px 18px !important;
  transition: all 0.2s !important;
}
.btn.btn-sm[style*="background-color:#7B1C1C"]:hover {
  background: #B91C1C !important;
  transform: translateY(-1px) !important;
}

/* Cancel action */
.btn.btn-sm[style*="background-color:#6c757d"],
.btn.btn-sm[style*="background-color: #6c757d"] {
  background: var(--espresso-lt) !important;
  border: none !important;
  border-radius: var(--radius) !important;
  color: var(--white) !important;
  font-family: 'DM Sans', sans-serif !important;
  font-weight: 500 !important;
  font-size: 13px !important;
  padding: 8px 18px !important;
  transition: all 0.2s !important;
}
.btn.btn-sm[style*="background-color:#6c757d"]:hover {
  background: var(--espresso) !important;
  transform: translateY(-1px) !important;
}

/* Modal footer buttons — consistent radius and sizing */
.modal .btn-green,
.modal .btn-red {
  border-radius: var(--radius) !important;
  font-family: 'DM Sans', sans-serif !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  padding: 8px 22px !important;
}

/* Icon-only action buttons (edit/delete/view icons) */
.btn[style*="font-size:14px"],
.btn[style*="font-size: 14px"] {
  border-radius: var(--radius-sm) !important;
  padding: 4px 8px !important;
  transition: all 0.15s !important;
}
.btn[style*="font-size:14px"]:hover,
.btn[style*="font-size: 14px"]:hover {
  background: var(--cream) !important;
}

/* ── FOOTER MASI BAND ── */

.footer-band {
  margin-top: 36px;
}
.footer-band .footer-copy {
  text-align: center;
  margin-top: 12px;
  font-size: 11px;
  color: var(--muted);
}

/* ── MODAL / FORM COMPONENTS ── */
/* ── Bootstrap Modals — don't obscure fixed topbar / sidebar ──
   Bootstrap 4 modal default: backdrop=1040, dialog=1050.
   Our topbar=1100, sidebar=1200. We raise backdrop/dialog just enough
   to stay above page content but below the topbar, then pad the top
   so the dialog always opens below the 62px topbar. */
.modal-backdrop {
  z-index: 1060 !important;
}
.modal {
  z-index: 1070 !important;
  padding-top: 62px !important;
}

/* SweetAlert2 must always appear above Bootstrap modals */
.swal2-container {
  z-index: 2000 !important;
}

/* Shared modal and form styles for Add Profile, Add Contact, etc. */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(46, 29, 18, 0.40);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: 0 8px 40px rgba(46, 29, 18, 0.20);
  width: 90%;
  max-width: 640px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 0;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--cream-dark);
}

.modal-header .chart-title { margin: 0; }

.modal-close {
  width: 32px; height: 32px;
  border-radius: 6px;
  border: 1px solid var(--cream-dark);
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.15s;
}
.modal-close:hover {
  border-color: var(--terra);
  color: var(--terra);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--cream-dark);
}

/* Form grid — two-column layout for paired fields */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
}
.form-grid .full-width {
  grid-column: 1 / -1;
}

/* Form group */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.form-group label {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--charcoal);
  letter-spacing: 0.2px;
}
.form-group label .required {
  color: var(--terra);
  margin-left: 2px;
}

/* Form inputs */
.form-input,
.form-select {
  padding: 9px 12px;
  border: 1.5px solid var(--cream-dark);
  border-radius: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--charcoal);
  background: var(--white);
  transition: border-color 0.15s;
}
.form-input::placeholder {
  color: var(--muted);
}
.form-input:focus,
.form-select:focus {
  border-color: var(--terra);
  outline: none;
  box-shadow: 0 0 0 3px rgba(196, 98, 45, 0.10);
}

/* Validation error */
.form-input.error,
.form-select.error {
  border-color: #B91C1C;
}
.form-error {
  font-size: 11px;
  color: #B91C1C;
  margin-top: 2px;
}

/* ── GLOBAL BUTTON CONSISTENCY ── */
.btn {
  border-radius: var(--radius) !important;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
}
.btn-info {
  background: var(--accent-blue) !important;
  border-color: var(--accent-blue) !important;
  color: var(--white) !important;
  border-radius: var(--radius) !important;
}
.btn-info:hover {
  background: #2563EB !important;
  border-color: #2563EB !important;
  transform: translateY(-1px);
}

/* ── BUTTON VARIANTS ── */

/* Close / cancel button — outlined terracotta */
.btn-outline-terra {
  padding: 9px 18px;
  border: 1.5px solid var(--terra);
  border-radius: var(--radius);
  background: transparent;
  color: var(--terra);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-outline-terra:hover {
  background: rgba(196, 98, 45, 0.08);
}

/* Save / create button — filled green */
.btn-green {
  padding: 9px 18px;
  border: none;
  border-radius: var(--radius);
  background: #27AE60;
  color: var(--white);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 2px 8px rgba(39, 174, 96, 0.3);
}
.btn-green:hover {
  background: #219653;
  transform: translateY(-1px);
}

/* Close button — filled red (for contact modals) */
.btn-red {
  padding: 9px 18px;
  border: none;
  border-radius: var(--radius);
  background: #B91C1C;
  color: var(--white);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-red:hover {
  background: #991B1B;
}

/* Danger action (delete) — distinct from terra */
.action-btn.danger:hover {
  border-color: #B91C1C;
  color: #B91C1C;
  background: rgba(185, 28, 28, 0.06);
}

/* Report action button — filled red */
.btn-report {
  padding: 7px 16px;
  border: none;
  border-radius: var(--radius);
  background: #CC3D26;
  color: var(--white);
  font-family: 'DM Sans', sans-serif;
  font-size: 12.5px; font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-report:hover {
  background: #B83520;
  transform: translateY(-1px);
}

/* ── FILTER BAR ── */

.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.filter-select {
  padding: 8px 12px;
  border: 1.5px solid var(--cream-dark);
  border-radius: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 12.5px;
  color: var(--charcoal);
  background: var(--white);
  min-width: 160px;
  transition: border-color 0.15s;
}
.filter-select:focus {
  border-color: var(--terra);
  outline: none;
}

.filter-btn {
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius);
  background: var(--terra);
  color: var(--white);
  font-family: 'DM Sans', sans-serif;
  font-size: 12.5px; font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.filter-btn:hover {
  background: var(--terra-lt);
}

/* Teal filter button (Analytics page) */
.filter-btn.teal {
  background: #17C5B2;
}
.filter-btn.teal:hover {
  background: #14B0A0;
}

/* ── TAB BUTTONS ── */

.tab-group {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.tab-btn {
  padding: 8px 20px;
  border: 1.5px solid var(--terra);
  border-radius: var(--radius);
  background: transparent;
  color: var(--terra);
  font-family: 'DM Sans', sans-serif;
  font-size: 12.5px; font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.tab-btn:hover {
  background: rgba(196, 98, 45, 0.08);
}
.tab-btn.active {
  background: var(--terra);
  color: var(--white);
}

/* ── PROJECT FILTER BAR ── */

.project-filter-bar {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--cream-dark);
  padding: 16px 24px;
  margin-bottom: 24px;
}
.filter-row {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}
.filter-field {
  flex: 1;
  min-width: 180px;
}
.filter-action {
  flex-shrink: 0;
}
.project-filter-bar label {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--charcoal);
  letter-spacing: 0.2px;
  margin-bottom: 6px;
  display: block;
}
.project-filter-bar .form-control {
  border-radius: var(--radius) !important;
  border: 1.5px solid var(--cream-dark) !important;
  font-size: 13px !important;
  padding: 9px 14px !important;
  background: var(--cream) !important;
  transition: border-color 0.2s !important;
}
.project-filter-bar .form-control:focus {
  border-color: var(--terra) !important;
  background: var(--white) !important;
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.08) !important;
}
.project-filter-bar .btn-filter {
  padding: 9px 28px;
  background: var(--espresso) !important;
  color: var(--white) !important;
  border: none !important;
  border-radius: var(--radius) !important;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.project-filter-bar .btn-filter:hover {
  background: var(--espresso-lt) !important;
  transform: translateY(-1px);
}

/* ── PROJECT CARDS GRID ── */

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.project-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--cream-dark);
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}
.project-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(234, 88, 12, 0.2);
}

.project-card .project-card-img {
  width: 100%;
  height: 160px;
  overflow: hidden;
  position: relative;
}
.project-card .project-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.project-card:hover .project-card-img img {
  transform: scale(1.05);
}

.project-card-body {
  padding: 16px 20px 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.project-card-body .project-name {
  font-family: 'Playfair Display', serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--espresso);
  margin-bottom: 8px;
  line-height: 1.3;
}
.project-card-body .project-category {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(217, 119, 6, 0.1);
  color: var(--gold);
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  margin-bottom: 14px;
  width: fit-content;
}
.project-card-body .project-actions {
  margin-top: auto;
}
.project-card-body .btn-details {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 18px;
  border: 1.5px solid var(--terra);
  border-radius: var(--radius) !important;
  background: transparent;
  color: var(--terra);
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.3px;
}
.project-card-body .btn-details:hover {
  background: var(--terra);
  color: var(--white);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.25);
}

@media (max-width: 768px) {
  .project-grid {
    grid-template-columns: 1fr;
  }
  .filter-row {
    flex-direction: column;
  }
  .filter-field {
    min-width: 100%;
  }
}

/* ── EMPTY STATE ── */

.empty-state {
  text-align: center;
  padding: 40px 24px;
  color: var(--muted);
  font-size: 14px;
}

/* ── CHECKBOX INLINE GROUP ── */

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 16px;
}
.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 12.5px;
  color: var(--charcoal);
  cursor: pointer;
}

/* ── MAP CONTAINER ── */

.map-container {
  width: 100%;
  height: 500px;
  border-radius: var(--radius);
  border: 1px solid var(--cream-dark);
  overflow: hidden;
  margin-bottom: 24px;
}

/* ── REPORTS FOOTER — Fijian tapa band (navy + white triangles) ── */

.masi-border-navy {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='20'%3E%3Cpolygon points='0,20 20,0 40,20' fill='%231B3A6B' opacity='0.3'/%3E%3Cpolygon points='0,0 20,20 40,0' fill='%23FFFFFF' opacity='0.3'/%3E%3C/svg%3E");
  height: 6px;
  width: 100%;
}

/* ════════════════════════════════════════════════════════════
   MASI EARTH — Bootstrap Table + DataTables Overrides
   Applied to: Memo, Information, Profiles, Surveys, Reports
   All use .table.table-bordered.table-striped with DataTables
   ════════════════════════════════════════════════════════════ */

/* ── Wrapper card ── */
.table-responsive {
  border-radius: var(--radius);
  overflow: hidden;
}

/* ── Base table reset ── */
.table {
  width: 100% !important;
  border-collapse: collapse;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--charcoal);
  background: var(--white);
  margin-bottom: 0 !important;
}

/* ── Header row ── */
.table thead th,
.table > thead > tr > th {
  background: var(--cream) !important;
  color: var(--muted) !important;
  font-family: 'DM Sans', sans-serif !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.7px !important;
  padding: 13px 16px !important;
  border: none !important;
  border-bottom: 2px solid var(--cream-dark) !important;
  white-space: nowrap;
  text-transform: uppercase !important;
}

/* Sort arrows — DataTables adds these */
.table thead th.sorting::after,
.table thead th.sorting_asc::after,
.table thead th.sorting_desc::after {
  color: var(--muted) !important;
}
.table thead th.sorting_asc::after  { color: var(--terra) !important; }
.table thead th.sorting_desc::after { color: var(--terra) !important; }

/* ── Body rows ── */
.table tbody tr {
  border-bottom: 1px solid var(--cream-dark) !important;
  transition: background 0.12s;
}
.table tbody tr:last-child {
  border-bottom: none !important;
}

.table tbody td,
.table > tbody > tr > td {
  padding: 12px 16px !important;
  vertical-align: middle !important;
  font-size: 13px !important;
  color: var(--charcoal) !important;
  border: none !important;
  border-bottom: 1px solid rgba(237, 224, 192, 0.7) !important;
  background: transparent !important;
}

/* ── Striping — subtle slate instead of warm cream ── */
.table-striped tbody tr:nth-of-type(odd) > * {
  background-color: rgba(241, 245, 249, 0.60) !important;
}
.table-striped tbody tr:nth-of-type(even) > * {
  background-color: var(--white) !important;
}

/* ── Hover ── */
.table-hover tbody tr:hover > * {
  background-color: rgba(59, 130, 246, 0.04) !important;
  cursor: pointer;
}

/* ── Bordered — cool slate borders ── */
.table-bordered,
.table-bordered > :not(caption) > * > * {
  border-color: var(--cream-dark) !important;
}
.table-bordered thead th {
  border-color: var(--cream-dark) !important;
}

/* ════════════════════════════════════════════════════════════
   DataTables Control Bar — search, length, pagination, info
   ════════════════════════════════════════════════════════════ */

/* ── Wrapper ── */
.dataTables_wrapper {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--charcoal);
}

/* ── Top controls row (length + search) ── */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 12.5px;
}
.dataTables_wrapper .dataTables_filter {
  text-align: right;
}

/* Length "Show X entries" select */
.dataTables_wrapper .dataTables_length select {
  padding: 6px 10px;
  border: 1.5px solid var(--cream-dark);
  border-radius: 6px;
  background: var(--white);
  color: var(--charcoal);
  font-family: 'DM Sans', sans-serif;
  font-size: 12.5px;
  margin: 0 4px;
  transition: border-color 0.15s;
}
.dataTables_wrapper .dataTables_length select:focus {
  border-color: var(--terra);
  outline: none;
}

/* Search input */
.dataTables_wrapper .dataTables_filter input {
  padding: 7px 12px;
  border: 1.5px solid var(--cream-dark);
  border-radius: 6px;
  background: var(--white);
  color: var(--charcoal);
  font-family: 'DM Sans', sans-serif;
  font-size: 12.5px;
  margin-left: 8px;
  transition: border-color 0.15s;
  min-width: 200px;
}
.dataTables_wrapper .dataTables_filter input:focus {
  border-color: var(--terra);
  outline: none;
  box-shadow: 0 0 0 3px rgba(196, 98, 45, 0.10);
}

/* ── Bottom row (info + pagination) ── */
.dataTables_wrapper .dataTables_info {
  padding-top: 14px;
  font-size: 12px;
  color: var(--muted);
}

/* Pagination buttons */
.dataTables_wrapper .dataTables_paginate {
  padding-top: 10px;
  text-align: right;
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  margin: 0 2px;
  border-radius: 6px !important;
  border: 1.5px solid var(--cream-dark) !important;
  background: var(--white) !important;
  color: var(--charcoal) !important;
  font-size: 12.5px;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: none !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: rgba(196, 98, 45, 0.08) !important;
  border-color: var(--terra) !important;
  color: var(--terra) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: var(--terra) !important;
  border-color: var(--terra) !important;
  color: var(--white) !important;
  font-weight: 600;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
  opacity: 0.35;
  cursor: not-allowed;
  border-color: var(--cream-dark) !important;
  background: var(--white) !important;
  color: var(--muted) !important;
}

/* ── "Processing…" overlay ── */
.dataTables_wrapper .dataTables_processing {
  background: rgba(255,255,255,0.9);
  border: 1px solid var(--cream-dark);
  border-radius: var(--radius);
  color: var(--terra);
  font-size: 13px;
}

/* ── Card/panel wrapper that surrounds the tables on these pages ── */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--cream-dark);
  transition: box-shadow 0.2s ease;
}
.card:hover {
  box-shadow: var(--shadow-md);
}
.card-body {
  padding: 24px;
}
.panel-heading {
  margin-bottom: 4px;
}
.panel-title {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--espresso);
}

/* ── Add-record buttons (+ Profile, + Survey, + Information, + Contact) ──
   Override the legacy Vuexy theme's full-width .add-file-btn */
.add-file-btn,
.btn.add-file-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  width: auto !important;
  padding: 9px 20px !important;
  background: linear-gradient(135deg, var(--terra) 0%, var(--terra-lt) 100%) !important;
  color: var(--white) !important;
  border: none !important;
  border-radius: var(--radius) !important;
  font-family: 'DM Sans', sans-serif !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.25) !important;
  text-decoration: none !important;
}
.add-file-btn:hover,
.btn.add-file-btn:hover {
  background: linear-gradient(135deg, var(--terra-lt) 0%, var(--terra) 100%) !important;
  color: var(--white) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 16px rgba(234, 88, 12, 0.35) !important;
}

/* ════════════════════════════════════════════════════════════
   ANALYTICS PAGE — Map & Filter Form
   ════════════════════════════════════════════════════════════ */

/* Filter form labels */
.formAnalytics .form-group label {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--charcoal);
  letter-spacing: 0.2px;
  margin-bottom: 4px;
}

/* Filter dropdowns — override Bootstrap form-control */
.formAnalytics .form-control {
  padding: 9px 12px;
  border: 1.5px solid var(--cream-dark) !important;
  border-radius: var(--radius) !important;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--charcoal);
  background: var(--white) !important;
  box-shadow: none !important;
  transition: border-color 0.15s;
}
.formAnalytics .form-control:focus {
  border-color: var(--terra) !important;
  outline: none;
  box-shadow: 0 0 0 3px rgba(196, 98, 45, 0.10) !important;
}

/* Data Type checkbox row */
.formAnalytics .form-check-input {
  accent-color: var(--terra);
}
.formAnalytics .form-check-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--charcoal);
}

/* Map container */
.analytics-map {
  border-radius: var(--radius);
  border: 1.5px solid var(--cream-dark);
  overflow: hidden;
  box-shadow: var(--shadow);
}

/* ── RESPONSIVE LAYOUT ── */

/* ── Hamburger button — hidden on desktop, visible on mobile ── */
.topbar-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--cream-dark);
  border-radius: var(--radius);
  background: var(--white);
  cursor: pointer;
  flex-shrink: 0;
  color: var(--charcoal);
  transition: all 0.15s;
}
.topbar-hamburger:hover { border-color: var(--terra); color: var(--terra); }

/* ── Sidebar mobile overlay ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(46, 29, 18, 0.50);
  z-index: 99;
}
.sidebar-overlay.show { display: block; }

/* ── Breakpoint: ≤ 1400px — large laptop / wide screen ──
   Stats drop to 2×2, forms tighten */
@media (max-width: 1400px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Breakpoint: ≤ 1280px — standard laptop ──
   Charts stack, project grid 2-col, reduced padding */
@media (max-width: 1280px) {
  .main { padding: 28px 24px; }
  .charts-row { grid-template-columns: 1fr; }
  .project-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar { padding: 0 20px; }
}

/* ── Breakpoint: ≤ 1024px — small laptop / large tablet ──
   Sidebar collapses to icon strip (64px) */
@media (max-width: 1024px) {
  :root { --sidebar-w: 64px; }

  .sidebar { width: 64px; }

  /* Hide all text labels, show icons only */
  .sidebar-nav .nav-item { padding: 12px 0; justify-content: center; gap: 0; font-size: 0; }
  .sidebar-nav .nav-item .nav-icon { width: 20px; height: 20px; opacity: 1; }
  .sidebar-nav .nav-section-label { display: none; }
  .sidebar-logo { padding: 16px 8px; justify-content: center; }
  .sidebar-logo-img { width: 40px; height: 40px; object-fit: contain; border-radius: 50%; }
  .sidebar-footer { display: none; }

  .main { padding: 24px 16px; }
  .modal-card { max-width: 90%; }
  .form-grid { grid-template-columns: 1fr 1fr; gap: 12px 16px; }

  /* Active indicator still visible */
  .sidebar-nav .nav-item.active::before { top: 4px; bottom: 4px; }
}

/* ── Breakpoint: ≤ 768px — tablet / mobile ──
   Sidebar becomes an off-canvas overlay drawer */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  .sidebar {
    width: 250px;
    transform: translateX(-250px);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 101;
  }
  /* Override icon-only styles from 1024px breakpoint */
  .sidebar-nav .nav-item { padding: 11px 24px; justify-content: flex-start; gap: 12px; font-size: 13.5px; }
  .sidebar-nav .nav-item .nav-icon { width: 18px; height: 18px; }
  .sidebar-nav .nav-section-label { display: block; }
  .sidebar-logo { padding: 20px 24px; justify-content: flex-start; }
  .sidebar-logo-img { width: 140px; height: auto; border-radius: 0; }
  .sidebar-footer { display: block; }

  .sidebar.open { transform: translateX(0); }

  .topbar { left: 0; padding: 0 16px; }
  .topbar-hamburger { display: flex; }
  .topbar .topbar-btn:not(.primary) { display: none; }

  .main { margin-left: 0; padding: 16px; }
  .stats-grid { grid-template-columns: 1fr; }
  .project-grid { grid-template-columns: 1fr; }
  .charts-row { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .filter-bar { gap: 8px; }
  .filter-select { min-width: 120px; }
  .tab-group { flex-wrap: wrap; }
  .modal-card { width: 96%; max-height: 92vh; }
  .table-card thead th { padding: 8px 12px; }
  .table-card tbody td { padding: 10px 12px; }
  .map-container { height: 300px; }
  .topbar-right { gap: 10px; }
}

/* ── Breakpoint: ≤ 480px — small mobile ── */
@media (max-width: 480px) {
  .page-title { font-size: 22px; }
  .stat-num { font-size: 28px; }
  .add-btn { padding: 8px 14px; font-size: 12px; }
  .topbar .topbar-btn.primary { display: none; }
}

/* ── TOAST NOTIFICATIONS ── */

.toast {
  position: fixed;
  top: 80px;
  right: 32px;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px; font-weight: 500;
  z-index: 300;
  box-shadow: 0 4px 16px rgba(46, 29, 18, 0.15);
  transition: opacity 0.3s, transform 0.3s;
}
.toast.success {
  background: var(--fern);
  color: var(--white);
}
.toast.error {
  background: #B91C1C;
  color: var(--white);
}
.toast.warning {
  background: var(--gold);
  color: var(--espresso);
}

/* ════════════════════════════════════════════════════════════
   DETAIL PAGES — Bootstrap Form & Component Overrides
   Applied to: Profile Details, Memo Details, Info Details,
               Survey Details
   ════════════════════════════════════════════════════════════ */

/* ── Bootstrap .form-control — Masi Earth inputs ── */
.form-control {
  border: 1.5px solid var(--cream-dark) !important;
  border-radius: 6px !important;
  font-family: 'DM Sans', sans-serif !important;
  font-size: 13px !important;
  color: var(--charcoal) !important;
  background: var(--white) !important;
  box-shadow: none !important;
  transition: border-color 0.15s, box-shadow 0.15s !important;
}
.form-control:focus {
  border-color: var(--terra) !important;
  box-shadow: 0 0 0 3px rgba(196, 98, 45, 0.10) !important;
  outline: none !important;
}
.form-control[readonly],
.form-control:disabled {
  background: var(--cream) !important;
  color: var(--charcoal) !important;
  opacity: 1 !important;
  cursor: default;
}
.form-control::placeholder { color: var(--muted) !important; }

/* ── Form labels ── */
.form-group > label,
.form-group label {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--charcoal);
  letter-spacing: 0.2px;
  margin-bottom: 4px;
  display: block;
}
/* Column-label pattern (col-md-2/3 beside field) */
.col-md-2 > label,
.col-md-3 > label {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--charcoal);
  padding-top: 8px;
}

/* ── Card headers ── */
.card-header {
  background: var(--cream);
  border-bottom: 1px solid var(--cream-dark) !important;
  padding: 18px 24px !important;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
}
.card-title,
h4.card-title {
  font-family: 'Playfair Display', serif !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  color: var(--espresso) !important;
  margin: 0 !important;
}

/* ── Navigation tabs — button style, all pages ── */
/* Tab bar — underline style with subtle border */
.nav-tabs,
.nav.nav-tabs {
  border-bottom: 1px solid var(--cream-dark) !important;
  margin-bottom: 20px !important;
  background: transparent !important;
  gap: 0 !important;
  display: flex !important;
  flex-wrap: wrap !important;
}

/* Individual tab spacing */
.nav-tabs .nav-item,
.nav.nav-tabs .nav-item {
  margin: 0 !important;
  padding-bottom: 0 !important;
  position: static !important;
}

/* The <li> elements carry class "button" from custom_styles.css which sets
   background-color: #e6a28b and color: white on hover. Completely neutralise it
   so only the <a> carries styling. */
.nav-tabs .nav-item.button,
.nav.nav-tabs .nav-item.button {
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  padding: 0 !important;
  color: inherit !important;
}
.nav-tabs .nav-item.button:hover,
.nav-tabs .nav-item.button:focus,
.nav.nav-tabs .nav-item.button:hover,
.nav.nav-tabs .nav-item.button:focus {
  background: transparent !important;
  background-color: transparent !important;
  color: inherit !important;
}

/* All tabs — espresso underline system (distinct from terra buttons) */
.nav-tabs .nav-item .nav-link,
.nav.nav-tabs .nav-item .nav-link,
.nav-tabs .nav-item .nav-link:not(.active),
.nav.nav-tabs .nav-item .nav-link:not(.active) {
  font-family: 'DM Sans', sans-serif !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  color: var(--muted) !important;
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  border-bottom: 2px solid transparent !important;
  border-radius: 0 !important;
  padding: 10px 20px !important;
  transition: all 0.2s ease !important;
  margin: 0 !important;
  box-shadow: none !important;
  display: inline-block !important;
  cursor: pointer !important;
}

/* Hover on inactive tabs */
.nav-tabs .nav-item .nav-link:not(.active):hover,
.nav-tabs .nav-item .nav-link:not(.active):focus,
.nav.nav-tabs .nav-item .nav-link:not(.active):hover,
.nav.nav-tabs .nav-item .nav-link:not(.active):focus {
  background: transparent !important;
  background-color: transparent !important;
  color: var(--espresso) !important;
  border-bottom-color: var(--cream-dark) !important;
  transform: none !important;
}

/* Active tab — espresso underline accent */
.nav-tabs .nav-item .nav-link.active,
.nav-tabs .nav-item.show .nav-link,
.nav.nav-tabs .nav-item .nav-link.active,
.nav.nav-tabs .nav-item.show .nav-link {
  background: transparent !important;
  background-color: transparent !important;
  color: var(--espresso) !important;
  border: none !important;
  border-bottom: 2px solid var(--terra) !important;
  border-radius: 0 !important;
  font-weight: 600 !important;
  box-shadow: none !important;
  transform: none !important;
}

/* Kill Vuexy's downward triangle pseudo-elements */
.nav-tabs .nav-item .nav-link::before,
.nav-tabs .nav-item .nav-link::after,
.nav.nav-tabs .nav-item .nav-link::before,
.nav.nav-tabs .nav-item .nav-link::after {
  display: none !important;
  content: none !important;
  border: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* ── Memo sub-section panels (replaces inline #f8f9fa style) ── */
.memo-section {
  background: var(--cream) !important;
  padding: 20px !important;
  border-radius: var(--radius) !important;
  border: 1px solid var(--cream-dark) !important;
  box-shadow: none !important;
  margin-bottom: 0;
}
.memo-section > h3 {
  font-family: 'Playfair Display', serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--espresso);
  margin-bottom: 16px;
}

/* ── Survey preview — form-header / form-body ── */
.form-header {
  background: var(--espresso) !important;
  color: var(--cream) !important;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 20px 24px !important;
  text-align: center;
}
.form-header h3,
.form-header h4 {
  color: var(--cream) !important;
  font-family: 'Playfair Display', serif;
  margin: 0 0 4px;
}
.form-header p { color: rgba(247, 239, 216, 0.80) !important; font-size: 13px; }
.form-body {
  background: var(--white) !important;
  color: var(--charcoal) !important;
  font-size: 14px !important;
  padding: 16px 20px;
  border-left: 1px solid var(--cream-dark);
  border-right: 1px solid var(--cream-dark);
  border-bottom: 1px solid var(--cream-dark);
}

/* ── Bootstrap button overrides for detail pages ── */
/* Outline buttons — ensure visible on cream background */
.btn-outline-primary {
  color: var(--terra) !important;
  border-color: var(--terra) !important;
  background-color: transparent !important;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius);
}
.btn-outline-primary:hover {
  background-color: var(--terra) !important;
  color: var(--white) !important;
}
.btn-outline-secondary {
  color: var(--charcoal) !important;
  border-color: var(--muted) !important;
  background-color: transparent !important;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius);
}
.btn-outline-secondary:hover {
  background-color: var(--muted) !important;
  color: var(--white) !important;
}
.btn-outline-dark {
  color: var(--espresso) !important;
  border-color: var(--espresso) !important;
  background-color: transparent !important;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius);
}
.btn-outline-dark:hover {
  background-color: var(--espresso) !important;
  color: var(--white) !important;
}

/* Primary — Terra */
.btn-primary,
.btn-primary:focus {
  background-color: var(--terra) !important;
  border-color: var(--terra) !important;
  color: var(--white) !important;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius);
}
.btn-primary:hover { background-color: var(--terra-lt) !important; border-color: var(--terra-lt) !important; }

/* Success — Fern green (Save / Update) */
.btn-success,
.btn-success:focus {
  background-color: var(--fern) !important;
  border-color: var(--fern) !important;
  color: var(--white) !important;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius);
}
.btn-success:hover { background-color: #3d5638 !important; border-color: #3d5638 !important; }

/* Warning — Gold (Edit buttons) */
.btn-warning,
.btn-warning:focus {
  background-color: var(--gold) !important;
  border-color: var(--gold) !important;
  color: var(--espresso) !important;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius);
}
.btn-warning:hover { background-color: #b88c24 !important; border-color: #b88c24 !important; }

/* Info — Teal */
.btn-info,
.btn-info:focus {
  background-color: #17C5B2 !important;
  border-color: #17C5B2 !important;
  color: var(--white) !important;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius);
}
.btn-info:hover { background-color: #14B0A0 !important; border-color: #14B0A0 !important; }

/* Secondary — muted (Submit memo button) */
.btn-secondary,
.btn-secondary:focus {
  background-color: var(--muted) !important;
  border-color: var(--muted) !important;
  color: var(--white) !important;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius);
}
.btn-secondary:hover { background-color: #6e5a4e !important; border-color: #6e5a4e !important; }

/* Danger — red (Cancel / Delete) */
.btn-danger,
.btn-danger:focus {
  background-color: #B91C1C !important;
  border-color: #B91C1C !important;
  color: var(--white) !important;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius);
}
.btn-danger:hover { background-color: #991B1B !important; border-color: #991B1B !important; }

/* ── GENERAL: Prevent buttons from stretching full-width in cards ── */
.card-body .btn,
.card-dashboard .btn {
  width: auto !important;
}

/* ── CARD FORM: spacing between card header and first form row ── */
.card-header + .card-body .form:first-child .row:first-child,
.card-header + .card-body > .row:first-child {
  margin-top: 8px;
}

/* ── Ensure .btn-block only stretches when explicitly used ── */
.btn-block {
  width: 100% !important;
}

/* ── Override legacy inline color on project name ── */
.project-card-body .project-name {
  color: var(--espresso) !important;
}

/* ── Fix any stray background inconsistencies on card-dashboard ── */
.card-body.card-dashboard {
  background: var(--white);
}
