/* ==========================================================
   TOVAPAY — Brand CSS
   Brand: deep forest green #1F7A6C · gold #CFAF6E · off-white #F7F7F5
   ========================================================== */

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

/* ── Variables ──────────────────────────────────────────────── */
:root {
  --primary:        #1F7A6C;
  --primary-dark:   #14584e;
  --primary-light:  #e8f5f3;
  --gold:           #CFAF6E;
  --gold-dark:      #b8953d;
  --beige:          #E6D8C3;
  --off-white:      #F7F7F5;
  --charcoal:       #2C2C2C;
  --gray-100:       #f1f1f1;
  --gray-200:       #e5e7eb;
  --gray-300:       #d1d5db;
  --gray-400:       #9ca3af;
  --gray-500:       #6b7280;
  --gray-600:       #4b5563;
  --gray-700:       #374151;
  --success:        #3cb371;
  --danger:         #d9534f;
  --warning:        #e6a817;
  --info:           #0891b2;

  --radius:         10px;
  --shadow-soft:    0 4px 12px rgba(0,0,0,0.08);
  --shadow-md:      0 8px 24px rgba(0,0,0,0.12);
  --transition:     0.25s ease;
  --font:           'Inter', 'Segoe UI', system-ui, sans-serif;
  --header-h:       75px;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--charcoal);
  background: var(--off-white);
  min-height: 100vh;
  line-height: 1.5;
  margin: 0;
  padding: 0;
}

/* Fixed header spacer — all pages sit below the fixed header */
body {
  padding-top: var(--header-h);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--primary-dark); }

h1, h2, h3, h4 { color: var(--primary); font-weight: 700; }

/* ══════════════════════════════════════════════════════════════
   NAVIGATION — header + logo + nav links + hamburger
   ══════════════════════════════════════════════════════════════ */

/* Fixed header */
.site-header {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 0 1.5rem;
  z-index: 1000;
  background: rgba(247,247,245,.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1.5px solid rgba(31,122,108,.12);
  box-shadow: 0 2px 16px rgba(0,0,0,.06);
}

/* Logo */
.site-logo {
  display: flex;
  align-items: center;
  gap: .4rem;
  text-decoration: none;
  flex-shrink: 0;
}
.site-logo:hover { text-decoration: none; }
.site-logo img { max-width: 110px; height: auto; max-height: 40px; }
.logo-fallback { display: inline-flex; align-items: center; gap: 3px; }
.logo-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--gold);
  margin-bottom: 9px;
  flex-shrink: 0;
}

/* Desktop nav links — pushed right */
.site-nav {
  display: flex;
  align-items: center;
  gap: .1rem;
  margin-left: auto;
  min-width: 0;
  overflow: visible;
  padding: 0 .25rem;
}

/* Section labels — desktop: hidden; mobile: shown as dividers */
.nav-section { display: none; }

/* Desktop nav links */
.site-nav a {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  font-weight: 600;
  color: var(--gray-600);
  text-decoration: none;
  padding: .45rem .85rem;
  border-radius: 7px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background .14s, color .14s;
  position: relative;
}
.site-nav a i { font-size: .85rem; flex-shrink: 0; color: currentColor; opacity: .8; }
.site-nav a:hover {
  background: var(--primary-light);
  color: var(--primary);
  text-decoration: none;
}
.site-nav a:hover i { opacity: 1; }
.site-nav a.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
}
.site-nav a.active::after {
  content: '';
  position: absolute;
  bottom: 0; left: 8px; right: 8px;
  height: 2px;
  background: var(--primary);
  border-radius: 2px 2px 0 0;
}

/* Desktop logout — red pill button */
.nav-logout-desktop {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  font-weight: 700;
  color: #dc2626;
  text-decoration: none;
  padding: .42rem .85rem;
  border-radius: 7px;
  border: 1.5px solid #fecaca;
  background: #fef2f2;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all .14s;
}
.nav-logout-desktop i { font-size: .85rem; }
.nav-logout-desktop:hover { background: #fee2e2; border-color: #fca5a5; color: #b91c1c; text-decoration: none; }

/* Login CTA */
.nav-login-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .82rem;
  font-weight: 700;
  color: var(--gold);
  text-decoration: none;
  padding: .48rem 1.1rem;
  border-radius: 8px;
  background: var(--primary);
  white-space: nowrap;
  flex-shrink: 0;
  transition: all .14s;
}
.nav-login-btn:hover { background: var(--primary-dark); color: var(--gold); text-decoration: none; }

/* Mobile logout — hidden on desktop */
.nav-logout-mobile { display: none !important; }

/* Hamburger — 3-bar with X animation */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
  width: 40px;
  height: 40px;
  padding: 8px;
  background: none;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  gap: 0;
}
.menu-toggle span {
  display: block;
  height: 2px;
  width: 20px;
  background: var(--charcoal);
  border-radius: 2px;
  transform-origin: center;
  transition: transform .25s ease, opacity .25s ease;
}
.menu-toggle.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-toggle.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.menu-toggle.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Backdrop overlay */
.nav-backdrop {
  display: none;
  position: fixed;
  inset: var(--header-h) 0 0 0;
  background: rgba(0,0,0,.3);
  z-index: 998;
  animation: fade-in .2s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* Mobile CTA hidden on desktop (must come BEFORE the media query so mobile override wins) */
.nav-mobile-cta { display: none; }

/* Mobile nav */
@media (max-width: 1000px) {
  /* Header: logo left | hamburger far right */
  .site-header {
    padding: 0 1rem;
    gap: .5rem;
    justify-content: space-between;
  }

  /* Hamburger → far right */
  .menu-toggle { display: flex; }

  /* Hide desktop button — Login/Logout is a button inside the drawer */
  .nav-logout-desktop { display: none !important; }
  .nav-login-btn      { display: none !important; }

  /* Nav drawer */
  .site-nav {
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    position: fixed;
    top: var(--header-h);
    left: 0; right: 0;
    max-height: calc(100vh - var(--header-h));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #fff;
    border-top: 3px solid var(--primary);
    box-shadow: 0 16px 48px rgba(0,0,0,.18);
    z-index: 999;
    padding-bottom: 1.5rem;
    overflow-x: hidden;
  }
  .site-nav.open { display: flex; }

  .nav-section {
    display: block;
    padding: .85rem 1.25rem .3rem;
    font-size: .65rem;
    font-weight: 800;
    letter-spacing: .9px;
    text-transform: uppercase;
    color: var(--primary);
    background: var(--primary-light);
    border-top: 1px solid rgba(31,122,108,.12);
    margin-top: .25rem;
  }
  .nav-section:first-child { margin-top: 0; border-top: none; }

  .site-nav a {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .9rem 1.25rem;
    border-radius: 0;
    font-size: .9rem;
    font-weight: 600;
    color: var(--charcoal);
    border-bottom: 1px solid var(--gray-100);
    min-height: 3rem;
    white-space: normal;
  }
  .site-nav a::after { display: none; }
  .site-nav a i { font-size: 1rem; width: 22px; text-align: center; color: var(--primary); flex-shrink: 0; opacity: 1; }
  .site-nav a:hover, .site-nav a.active {
    background: var(--primary-light);
    color: var(--primary);
  }
  .site-nav a.active { border-left: 3px solid var(--primary); padding-left: calc(1.25rem - 3px); }

  /* Old mobile logout link — replaced by .nav-mobile-cta */
  .nav-logout-mobile { display: none !important; }

  /* Styled button at the bottom of the mobile drawer */
  .nav-mobile-cta {
    display: block;
    padding: 1rem 1.25rem 0;
    border-top: 1px solid var(--gray-100);
    margin-top: .25rem;
  }
  .nav-mobile-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    width: 100%;
    padding: 13px 20px;
    font-size: 15px;
    font-weight: 700;
    border-radius: 8px;
    text-decoration: none;
    background: var(--primary);
    color: var(--gold) !important;
    box-sizing: border-box;
    transition: var(--transition);
    box-shadow: var(--shadow-soft);
  }
  .nav-mobile-btn:hover { background: var(--primary-dark); text-decoration: none; }
}

/* ── Nav group dropdowns ─────────────────────────────────────── */
.nav-group { position: relative; flex-shrink: 0; }

/* Toggle button looks identical to .site-nav a */
.nav-group-toggle {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  font-weight: 600;
  color: var(--gray-600);
  background: none;
  border: none;
  padding: .45rem .85rem;
  border-radius: 7px;
  white-space: nowrap;
  cursor: pointer;
  font-family: inherit;
  transition: background .14s, color .14s;
  position: relative;
}
.nav-group-toggle i { font-size: .85rem; flex-shrink: 0; opacity: .8; }
.nav-group-toggle:hover,
.nav-group-toggle.active {
  background: var(--primary-light);
  color: var(--primary);
}
.nav-group-toggle.active::after {
  content: '';
  position: absolute;
  bottom: 0; left: 8px; right: 8px;
  height: 2px;
  background: var(--primary);
  border-radius: 2px 2px 0 0;
}
.nav-chevron { font-size: .6rem !important; opacity: .55; margin-left: .05rem; transition: transform .18s; }
.nav-group.open .nav-chevron { transform: rotate(180deg); }

/* Dropdown panel — compact, same link style */
.nav-group-panel {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,.10);
  z-index: 1050;
  padding: .25rem 0;
}
.nav-group.open .nav-group-panel { display: block; }

.nav-group-panel a {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-size: .8rem;
  font-weight: 600;
  color: var(--gray-600);
  padding: .5rem .9rem;
  border-radius: 0;
  white-space: nowrap;
  text-decoration: none;
  transition: background .12s, color .12s;
}
.nav-group-panel a i { font-size: .82rem; opacity: .75; flex-shrink: 0; }
.nav-group-panel a:hover,
.nav-group-panel a.active {
  background: var(--primary-light);
  color: var(--primary);
  text-decoration: none;
}
.nav-group-panel a:hover i,
.nav-group-panel a.active i { opacity: 1; }

/* nav-section inside a nav-group is hidden on desktop */
.nav-group .nav-section { display: none; }

/* Mobile — section label + expanded list (no toggle button) */
@media (max-width: 1000px) {
  .nav-group { display: contents; }
  .nav-group-toggle { display: none; }
  .nav-group .nav-section { display: block; }
  .nav-group-panel {
    display: contents;
    position: static;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    background: none;
  }
  .nav-group-panel a {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .9rem 1.25rem;
    border-radius: 0;
    font-size: .9rem;
    color: var(--charcoal);
    border-bottom: 1px solid var(--gray-100);
    min-height: 3rem;
  }
  .nav-group-panel a i { font-size: 1rem; width: 22px; text-align: center; color: var(--primary); opacity: 1; }
  .nav-group-panel a:hover,
  .nav-group-panel a.active { background: var(--primary-light); color: var(--primary); }
  .nav-group-panel a.active { border-left: 3px solid var(--primary); padding-left: calc(1.25rem - 3px); }
}

/* ── Main content wrapper ───────────────────────────────────── */
.main-content {
  min-height: calc(100vh - var(--header-h));
  max-width: 1300px;
  margin: 0 auto;
  width: 100%;
  padding: 1.75rem 1.5rem;
  box-sizing: border-box;
}
.main-content:has(.auth-wrap),
body.admin-page .main-content:has(.auth-wrap),
body.portal-page .main-content:has(.auth-wrap),
body.auth-page .main-content {
  padding: 0 !important;
  max-width: 100% !important;
  margin: 0 !important;
}

/* Flash container inside admin/portal pages */
.flash-wrap {
  padding: .75rem 1.5rem 0;
  max-width: 1300px;
  margin: 0 auto;
}

/* Admin page layout constraints */
body.admin-page .main-content,
body.portal-page .main-content {
  max-width: 1300px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem;
}

body.admin-page .flash-wrap,
body.portal-page .flash-wrap {
  padding: 0 0 1rem;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.04);
}

.card-header {
  padding: .9rem 1.35rem;
  font-weight: 600;
  font-size: .875rem;
  color: var(--primary);
  border-bottom: 1px solid var(--gray-200);
  background: var(--off-white);
  display: flex;
  align-items: center;
  gap: .5rem;
}

.card-header::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 16px;
  background: var(--gold);
  border-radius: 2px;
  flex-shrink: 0;
}

.card-body { padding: 1.35rem; }

/* ── Grid utilities ─────────────────────────────────────────── */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

@media (max-width: 768px) {
  .grid-2 { grid-template-columns: 1fr; }
}

/* ── Stats ──────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 1.4rem 1.25rem;
  border: 1px solid rgba(0,0,0,0.04);
  border-top: 3px solid var(--beige);
  transition: var(--transition);
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card.success { border-top-color: var(--success); }
.stat-card.danger  { border-top-color: var(--danger); }
.stat-card.warning { border-top-color: var(--warning); }
.stat-card.info    { border-top-color: var(--primary); }

.stat-icon  { font-size: 1.3rem; color: var(--primary); margin-bottom: .35rem; }
.stat-value { font-size: 1.6rem; font-weight: 700; color: var(--charcoal); line-height: 1.2; }
.stat-label { font-size: .75rem; color: var(--gray-500); text-transform: uppercase; letter-spacing: .6px; margin-top: .2rem; }

/* ── Tables ─────────────────────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
  background: #fff;
}

.table th {
  text-align: left;
  padding: .7rem 1rem;
  background: var(--charcoal);
  color: #fff;
  font-weight: 600;
  font-size: .8rem;
  letter-spacing: .4px;
}

.table td {
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
  color: var(--charcoal);
}

.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--primary-light); }
.table-sm th, .table-sm td { padding: .5rem .75rem; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .55rem 1.1rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: .875rem;
  font-weight: 600;
  line-height: 1;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
  min-height: 2.5rem;
}

.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--primary);
  color: var(--gold) !important;
  box-shadow: var(--shadow-soft);
  border: none;
}
.btn-primary:hover { background: var(--primary-dark); color: var(--gold) !important; }

.btn-gold {
  background: var(--gold);
  color: var(--primary-dark);
  box-shadow: var(--shadow-soft);
}
.btn-gold:hover { background: var(--gold-dark); color: #fff; }

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-light); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b02a27; }

.btn-sm { padding: .35rem .7rem; font-size: .78rem; min-height: auto; }
.btn-block { width: 100%; }
.btn-group { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Bootstrap btn-primary override */
.btn.btn-primary,
button.btn-primary {
  background-color: var(--primary) !important;
  border-color: var(--primary) !important;
  color: var(--gold) !important;
}
.btn.btn-primary:hover,
button.btn-primary:hover {
  background-color: var(--primary-dark) !important;
  border-color: var(--primary-dark) !important;
}

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

.form-group label {
  display: block;
  font-size: .825rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: .375rem;
}

.form-control {
  width: 100%;
  padding: .6rem .85rem;
  border: 1.5px solid var(--gray-300);
  border-radius: 8px;
  font-family: var(--font);
  font-size: .875rem;
  color: var(--charcoal);
  background: #fff;
  transition: border-color .2s, box-shadow .2s;
  outline: none;
  height: 2.75rem;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(31,122,108,.15);
}

textarea.form-control { resize: vertical; min-height: 80px; height: auto; }
select.form-control { cursor: pointer; }

/* ── Flash / Alert ──────────────────────────────────────────── */
.alert {
  padding: .8rem 1.1rem;
  border-radius: var(--radius);
  margin-bottom: .5rem;
  font-size: .875rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.alert-success { background: #d9f5df; color: #1a6b33; border-left: 4px solid var(--success); }
.alert-danger  { background: #fde8e8; color: #8b1a1a; border-left: 4px solid var(--danger); }
.alert-error   { background: #fde8e8; color: #8b1a1a; border-left: 4px solid var(--danger); }
.alert-warning { background: #fef3d0; color: #7a4a00; border-left: 4px solid var(--warning); }
.alert-info    { background: var(--primary-light); color: var(--primary-dark); border-left: 4px solid var(--primary); }

/* ── Search bar ─────────────────────────────────────────────── */
.search-bar {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: center;
}
.search-bar .form-control { flex: 1; min-width: 200px; }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: .22em .7em;
  border-radius: 20px;
  font-size: .73rem;
  font-weight: 600;
  letter-spacing: .3px;
  text-transform: capitalize;
  background: var(--gray-200);
  color: var(--gray-700);
}

.badge-active, .badge-completed, .badge-paid, .badge-sent
  { background: #d9f5df; color: #1a6b33; }
.badge-suspended, .badge-failed, .badge-cancelled, .badge-terminated
  { background: #fde8e8; color: #8b1a1a; }
.badge-overdue, .badge-urgent, .badge-high
  { background: #fef3d0; color: #7a4a00; }
.badge-pending, .badge-partial, .badge-open
  { background: var(--primary-light); color: var(--primary-dark); }
.badge-in_progress { background: #ede9fe; color: #5b21b6; }
.badge-mpesa  { background: #d9f5df; color: #1a6b33; }
.badge-cash   { background: #f0fdf4; color: #15803d; }
.badge-bank   { background: var(--primary-light); color: var(--primary-dark); }
.badge-superadmin { background: #fef3d0; color: #7a4a00; }
.badge-admin  { background: var(--primary-light); color: var(--primary-dark); }
.badge-medium { background: #e0f2fe; color: #0c4a6e; }
.badge-low    { background: var(--gray-100); color: var(--gray-500); }

/* ── Page header ────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.35rem;
  flex-wrap: wrap;
  gap: .75rem;
}

.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 1.25rem;
}

/* ── Detail list ────────────────────────────────────────────── */
.detail-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: .6rem .85rem;
  font-size: .875rem;
}
.detail-list dt { color: var(--primary); font-weight: 600; white-space: nowrap; }
.detail-list dd { color: var(--charcoal); }

/* ── Auth pages ─────────────────────────────────────────────── */

/* Centering wrapper used inside all auth form pages */
.auth-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - var(--header-h));
  width: 100%;
  padding: 2rem 1rem;
  box-sizing: border-box;
}

@media (max-width: 480px) {
  .auth-wrap { align-items: flex-start; padding-top: 1.5rem; }
  .auth-card { max-width: 100%; border-radius: 16px; }
  .auth-split { border-radius: 16px; }
}

/* ── Simple auth card (OTP, change-password, small forms) ── */
.auth-card {
  background: #fff;
  border-radius: 20px;
  box-shadow: var(--shadow-md);
  padding: 2.75rem 2.25rem;
  width: 100%;
  max-width: 420px;
  border: 1px solid var(--gray-200);
}

.auth-logo { text-align: center; margin-bottom: 1rem; }
.auth-logo-img { height: 52px; width: auto; }

.auth-logo-text {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.5px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.auth-logo-text .dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gold);
  margin-bottom: 10px;
}

.auth-card h2 {
  text-align: center;
  margin-bottom: .4rem;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--charcoal);
}
.auth-card .auth-sub {
  text-align: center;
  font-size: .85rem;
  color: var(--gray-500);
  margin-bottom: 1.6rem;
}

.auth-footer {
  margin-top: 1rem;
  text-align: center;
  font-size: .8rem;
  color: var(--gray-500);
  line-height: 1.8;
}

/* ── Split auth card (login pages — logo panel + form) ─────── */
.auth-split {
  width: 100%;
  max-width: 860px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0,0,0,.10);
  overflow: hidden;
  display: flex;
  border: 1px solid var(--gray-200);
}

/* Left brand panel — off-white, NOT green */
.auth-brand {
  width: 42%;
  flex-shrink: 0;
  background: var(--off-white);
  border-right: 1px solid var(--gray-200);
  padding: 3rem 2.25rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-brand-logo { margin-bottom: 1.5rem; }
.auth-brand-logo img { height: 48px; width: auto; }

.auth-brand-badge {
  display: inline-block;
  background: var(--gold);
  color: var(--charcoal);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  padding: .3em .85em;
  border-radius: 20px;
  margin-bottom: 1.1rem;
}

.auth-brand h2 {
  color: var(--charcoal);
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: .6rem;
  text-align: left;
}

.auth-brand h2 span { color: var(--primary); }

.auth-brand p {
  color: var(--gray-500);
  font-size: .875rem;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.auth-feature {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin-bottom: .75rem;
  font-size: .875rem;
  color: var(--charcoal);
  font-weight: 500;
}

.auth-feature i {
  color: var(--primary);
  font-size: 1rem;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

/* Right form panel */
.auth-form {
  flex: 1;
  padding: 3rem 2.5rem;
  background: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-form h3 {
  color: var(--charcoal);
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: .35rem;
  text-align: left;
}

.auth-form .auth-sub {
  color: var(--gray-500);
  font-size: .875rem;
  margin-bottom: 1.75rem;
}

/* Input groups with icons */
.auth-input-group {
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--gray-300);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color .2s, box-shadow .2s;
  background: #fff;
}

.auth-input-group:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(31,122,108,.12);
}

.auth-input-group .input-icon {
  display: flex;
  align-items: center;
  padding: 0 .85rem;
  color: var(--primary);
  font-size: 1rem;
  background: var(--off-white);
  border-right: 1px solid var(--gray-200);
  flex-shrink: 0;
}

.auth-input-group input {
  flex: 1;
  border: none;
  outline: none;
  padding: .75rem .9rem;
  font-family: var(--font);
  font-size: .875rem;
  color: var(--charcoal);
  background: transparent;
  height: 2.9rem;
}

.auth-input-group .pw-toggle {
  display: flex;
  align-items: center;
  padding: 0 .85rem;
  background: none;
  border: none;
  border-left: 1px solid var(--gray-200);
  cursor: pointer;
  color: var(--gray-500);
  font-size: .95rem;
  transition: color .2s;
}

.auth-input-group .pw-toggle:hover { color: var(--primary); }

.auth-divider {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: var(--gray-300);
  font-size: .78rem;
  margin: 1.25rem 0;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gray-200);
}

.auth-links {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: 1rem;
  font-size: .825rem;
}

.auth-links a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}
.auth-links a:hover { text-decoration: underline; }

.auth-footer-note {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--gray-200);
  text-align: center;
  font-size: .8rem;
  color: var(--gray-500);
}
.auth-footer-note a { color: var(--primary); font-weight: 600; }

/* Hide brand panel on small screens */
@media (max-width: 767px) {
  .auth-split { flex-direction: column; max-width: 440px; }
  .auth-brand { display: none; }
  .auth-form { padding: 2.25rem 1.75rem; }
}

.otp-input {
  text-align: center;
  font-size: 1.6rem;
  letter-spacing: .6rem;
  font-weight: 700;
}

/* ── Notification items ─────────────────────────────────────── */
.notification-item { padding: 1rem 0; border-bottom: 1px solid var(--gray-100); }
.notification-item:last-child { border-bottom: none; }
.notification-meta { display: flex; gap: .75rem; align-items: center; margin-bottom: .35rem; }
.notification-subject { font-weight: 600; color: var(--charcoal); margin-bottom: .25rem; }
.notification-body { color: var(--gray-500); font-size: .875rem; }

/* ── Error pages ────────────────────────────────────────────── */
.error-page { text-align: center; padding: 5rem 1rem; }
.error-code { font-size: 5.5rem; font-weight: 800; color: var(--beige); line-height: 1; }
.error-msg  { font-size: 1.5rem; font-weight: 700; color: var(--primary); margin: .5rem 0 1rem; }

/* ── Public pages ───────────────────────────────────────────── */

/* Section wrappers */
.pub-section     { padding: 5rem 0; }
.pub-section-alt { background: var(--off-white); }
.pub-section-full { min-height: calc(100vh - var(--header-h)); display: flex; align-items: center; }

/* Hero */
.pub-hero {
  background: linear-gradient(135deg, var(--off-white), var(--beige));
  min-height: 88vh;
  display: flex;
  align-items: center;
  padding: 5rem 0 4rem;
}

/* Gold badge label */
.pub-badge {
  display: inline-block;
  background: var(--gold);
  color: var(--charcoal);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .4px;
  text-transform: uppercase;
  padding: .3em .9em;
  border-radius: 20px;
  margin-bottom: 1rem;
}

/* Public buttons */
.btn-tova         { background: var(--primary); color: var(--gold); border: none; font-weight: 600; }
.btn-tova:hover   { background: var(--primary-dark); color: var(--gold); text-decoration: none; }

.btn-outline-tova         { background: transparent; color: var(--primary); border: 2px solid var(--primary); font-weight: 600; }
.btn-outline-tova:hover   { background: var(--primary); color: #fff; text-decoration: none; }

/* Feature cards */
.feature-card { border: 1px solid var(--gray-200) !important; border-radius: 20px; transition: var(--transition); }
.feature-card:hover { transform: translateY(-8px); box-shadow: 0 15px 35px rgba(0,0,0,.08); }

/* Circular icon box */
.icon-box { width: 70px; height: 70px; border-radius: 50%; background: var(--primary-light);
  display: flex; align-items: center; justify-content: center; margin: auto; }
.icon-box i { font-size: 1.75rem; color: var(--primary); }

/* Mission / Vision / Values cards */
.mv-card { border: 1px solid var(--gray-200); border-radius: 18px; box-shadow: var(--shadow-soft);
  transition: var(--transition); background: #fff; }
.mv-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); }
.mv-card .pub-icon { font-size: 2.5rem; color: var(--primary); }

/* Trust stat cards */
.trust-card { background: #fff; border-radius: 20px; padding: 2.25rem 1.5rem; text-align: center;
  height: 100%; border: 1px solid var(--gray-200); transition: var(--transition); box-shadow: var(--shadow-soft); }
.trust-card:hover { transform: translateY(-8px); box-shadow: var(--shadow-md); }
.trust-card h2 { color: var(--primary); }

/* Lordicon / trust icon wrapper */
.icon-wrapper { width: 90px; height: 90px; margin: 0 auto 1.25rem; display: flex;
  align-items: center; justify-content: center; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light), rgba(207,175,110,.12)); }

/* CTA banner — charcoal background, NOT green */
.cta-section { background: var(--charcoal); border-radius: 20px; }

/* Floating badge overlay on images */
.img-float-badge { position: absolute; bottom: 1.25rem; left: 1.25rem; background: #fff;
  padding: .7rem 1rem; border-radius: 14px; box-shadow: var(--shadow-md); }
.img-float-badge h6 { color: var(--primary); margin-bottom: .15rem; font-weight: 700; font-size: .875rem; }

/* Contact / about form card */
.pub-contact-card { background: #fff; border: 1px solid var(--gray-200);
  border-radius: 20px; box-shadow: var(--shadow-md); }

/* Public footer */
.pub-footer { background: #fff; border-top: 1px solid var(--gray-200); padding: 2rem 0; text-align: center; }

/* ── Utilities ──────────────────────────────────────────────── */
.mt-2 { margin-top: .5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.ml-2 { margin-left: .5rem; }
.text-muted  { color: var(--gray-500) !important; }
.text-center { text-align: center; }
.text-gold   { color: var(--gold); }
.text-green  { color: var(--primary); }

code {
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: .1em .4em;
  border-radius: 5px;
  font-size: .85em;
  font-family: 'Consolas', 'Monaco', monospace;
}

hr { border: none; border-top: 1px solid var(--gray-200); margin: 1.25rem 0; }

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--off-white); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-dark); }

/* Nav: icons visible on desktop (defined in main section above) */

/* ── Responsive admin/portal ────────────────────────────────── */
@media (max-width: 1024px) {
  body.admin-page .main-content,
  body.portal-page .main-content { padding: 1.25rem 1rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  body.admin-page .main-content,
  body.portal-page .main-content { padding: 1rem .75rem; }

  /* Stats */
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card { padding: 1rem; }
  .stat-value { font-size: 1.25rem; }

  /* Page header */
  .page-header { flex-direction: column; align-items: flex-start; gap: .5rem; }
  .page-title { font-size: 1.15rem; margin-bottom: 0; }

  /* Cards */
  .card-body { padding: .85rem; }
  .card-header { padding: .7rem .85rem; font-size: .82rem; }

  /* Auth card */
  .auth-card { padding: 1.75rem 1.1rem; }

  /* Buttons */
  .btn { min-height: 2.75rem; font-size: .875rem; }
  .btn-group { flex-wrap: wrap; gap: .4rem; }
  .btn-group .btn { font-size: .78rem; padding: .45rem .75rem; }
  .btn-sm { min-height: 2rem; }

  /* Tables (non-card ones scroll) */
  .table { font-size: .82rem; }
  .table th, .table td { padding: .55rem .6rem; }

  /* Detail list — stacked */
  .detail-list { grid-template-columns: 1fr; gap: .25rem; }
  .detail-list dt { color: var(--primary); font-size: .72rem; text-transform: uppercase; letter-spacing: .3px; margin-top: .6rem; }
  .detail-list dd { padding-left: 0; font-size: .9rem; }

  /* Forms — bigger touch targets */
  .form-group { margin-bottom: .9rem; }
  .form-control { height: 3rem; font-size: 1rem; padding: .65rem .9rem; }
  textarea.form-control { height: auto; }
  select.form-control { height: 3rem; }
  .form-group label { font-size: .8rem; }

  /* Auth input groups */
  .auth-input-group input { font-size: 1rem; height: 3.2rem; }

  /* Hide password show/hide toggle on mobile — typing in password field without it */
  .pw-toggle { display: none !important; }
  /* Ensure input still spans full width without the toggle */
  .auth-input-group input { border-radius: 0 10px 10px 0 !important; }

  /* Grid collapses to single column */
  .grid-2 { grid-template-columns: 1fr; gap: 1rem; }
}

@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr; }
  .auth-card { margin: 0 .25rem; padding: 1.5rem .9rem; }
  .btn-group .btn { flex: 1 1 calc(50% - .4rem); justify-content: center; }
  .card-body { padding: .75rem; }
}

/* ── Horizontal-scroll wrapper ───────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
}

/* ══════════════════════════════════════════════════════════════
   GLOBAL RESPONSIVE TABLES
   Every <table> inside a .card-body stacks as cards on ≤ 640px.
   Add data-label="Column name" to each <td> for labelled rows.
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .card-body table,
  .card-body table thead,
  .card-body table tbody,
  .card-body table tfoot,
  .card-body table tr,
  .card-body table th,
  .card-body table td { display: block !important; }

  .card-body table thead tr { display: none !important; }

  .card-body table tbody tr {
    background: #fff !important;
    border: 1px solid var(--gray-200) !important;
    border-radius: 10px !important;
    margin-bottom: .65rem !important;
    box-shadow: var(--shadow-soft) !important;
    overflow: hidden !important;
  }

  .card-body table td {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: .5rem !important;
    padding: .6rem 1rem !important;
    border: none !important;
    border-bottom: 1px solid var(--gray-100) !important;
    font-size: .875rem !important;
    min-height: 2.5rem !important;
    background: transparent !important;
  }

  .card-body table td:last-child { border-bottom: none !important; }

  /* Label shown when data-label attribute is present */
  .card-body table td[data-label]::before {
    content: attr(data-label);
    font-size: .7rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: .4px;
    flex-shrink: 0;
    min-width: 75px;
  }
}

/* Legacy class kept for backward compat — the global rule above covers it */
.table-mobile-cards { /* intentionally empty */ }

/* ── Data card list (replaces tables for customers/invoices) ─── */
.data-list {
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.data-list-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--gray-500);
  font-size: .9rem;
}

.data-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: .9rem 1rem;
  gap: .6rem;
  text-decoration: none !important;
  color: var(--charcoal);
  transition: box-shadow .2s, transform .15s;
  box-shadow: var(--shadow-soft);
}

.data-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  color: var(--charcoal);
}

/* Top row: avatar + name/sub + status */
.data-card-primary {
  display: flex;
  align-items: center;
  gap: .75rem;
}

/* Coloured initial circle */
.data-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 800;
  font-size: .8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: -.5px;
}

.data-avatar.inv-avatar {
  background: #fef3d0;
  color: #92400e;
}

.data-card-info    { flex: 1; min-width: 0; }
.data-card-name    { font-weight: 700; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.data-card-name a  { color: var(--charcoal); text-decoration: none; }
.data-card-name a:hover { color: var(--primary); }
.data-card-sub     { font-size: .78rem; color: var(--gray-500); display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .2rem; align-items: center; }

/* Bottom row: meta pills */
.data-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .65rem;
  font-size: .78rem;
  color: var(--gray-500);
  padding-top: .5rem;
  border-top: 1px solid var(--gray-100);
  align-items: center;
}

.data-card-meta > span {
  display: inline-flex;
  align-items: center;
  gap: .28rem;
}

.data-card-meta i { color: var(--primary); font-size: .85rem; }

.data-card-actions {
  display: flex;
  gap: .35rem;
  margin-left: auto;
  flex-shrink: 0;
}

/* ── On wider screens: single-row horizontal card (table feel) ─ */
@media (min-width: 640px) {
  .data-card {
    flex-direction: row;
    align-items: center;
    padding: .75rem 1.1rem;
    gap: 1rem;
  }

  .data-card-primary { flex: 0 0 auto; width: 220px; }

  .data-card-meta {
    flex: 1;
    border-top: none;
    padding-top: 0;
    flex-wrap: nowrap;
    overflow: hidden;
  }

  .data-card-meta > span { white-space: nowrap; }
}

@media (min-width: 900px) {
  .data-card-primary { width: 260px; }
}

/* ── Search / filter bar ─────────────────────────────────────── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
}

.filter-bar .form-control { flex: 1; min-width: 140px; }
.filter-bar .filter-select { width: auto; min-width: 120px; flex-shrink: 0; }
@media (max-width: 640px) {
  .filter-bar { flex-direction: column; }
  .filter-bar .form-control,
  .filter-bar .filter-select { width: 100%; }
  .filter-bar .btn  { width: 100%; justify-content: center; }
}

/* ── Ticket thread ─────────────────────────────────────────── */
.ticket-note {
  border-left: 3px solid var(--gold);
  background: #fffbf0;
}

.ticket-reply-support {
  border-left: 3px solid var(--primary);
  background: #f4faf9;
}

.ticket-reply-customer {
  border-left: 3px solid var(--gray-300);
}

.badge-open       { background: #e8f4fd; color: #1a6fa8; }
.badge-assigned   { background: #fff3cd; color: #856404; }
.badge-in_progress { background: #cce5ff; color: #004085; }
.badge-resolved   { background: #d4edda; color: #155724; }
.badge-closed     { background: #e2e3e5; color: #383d41; }
.badge-critical   { background: #f8d7da; color: #721c24; }
.badge-high       { background: #ffeeba; color: #856404; }
.badge-medium     { background: #d1ecf1; color: #0c5460; }
.badge-low        { background: #e2e3e5; color: #383d41; }

/* ── Ticket attachments ────────────────────────────────────── */
.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .25em .7em;
  background: var(--off-white);
  border: 1px solid var(--gray-200);
  border-radius: 20px;
  font-size: .78rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  transition: background .15s;
}
.attachment-chip:hover { background: var(--beige); color: var(--primary); }

.attach-label {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .3em .85em;
  border: 1.5px dashed var(--gray-300);
  border-radius: 8px;
  font-size: .82rem;
  color: var(--gray-500);
  cursor: pointer;
  transition: border-color .2s, color .2s;
}
.attach-label:hover { border-color: var(--primary); color: var(--primary); }

/* ── Accounting module ─────────────────────────────────────── */
.acct-section-label {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--gray-500);
  margin-bottom: .6rem;
}

.card-section-title {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--gray-500);
  margin-bottom: 1rem;
}

.stat-sub {
  font-size: .75rem;
  color: var(--gray-500);
  margin-top: .2rem;
}

.text-success { color: #28a745 !important; }
.text-danger  { color: var(--danger) !important; }

@media print {
  .site-header, .page-header .btn, .card:last-child .btn { display: none !important; }
}
