/* ================================================================
   AFUO PLATFORM — Core Design System
   Role tokens: farmer=green, aggregator=amber, driver=blue,
                buyer=violet, admin=slate
   ================================================================ */

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

/* ── GLOBAL TOKENS ─────────────────────────────────────────── */
:root {
  /* Brand */
  --brand:        #16a34a;
  --brand-dark:   #14532d;
  --brand-light:  #dcfce7;
  /* Neutrals */
  --bg:           #f6f8f6;
  --surface:      #ffffff;
  --surface-2:    #f0f4f0;
  --border:       #e2e8e2;
  --border-focus: #16a34a;
  /* Text */
  --text-1:       #0f1f0f;
  --text-2:       #3d5c3d;
  --text-3:       #7a9c7a;
  /* Status */
  --green:  #16a34a; --green-bg:  #dcfce7;
  --amber:  #d97706; --amber-bg:  #fef3c7;
  --red:    #dc2626; --red-bg:    #fee2e2;
  --blue:   #2563eb; --blue-bg:   #dbeafe;
  --violet: #7c3aed; --violet-bg: #ede9fe;
  --slate:  #475569; --slate-bg:  #f1f5f9;
  /* Role colors */
  --role-farmer:     #16a34a;
  --role-aggregator: #d97706;
  --role-driver:     #2563eb;
  --role-buyer:      #7c3aed;
  --role-admin:      #475569;
  /* Layout */
  --sidebar-w: 240px;
  --topbar-h:  60px;
  /* Typography */
  --font-sans: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  /* Radii */
  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 24px;
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 2px 8px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.1), 0 2px 8px rgba(0,0,0,.06);
  --shadow-modal: 0 24px 64px rgba(0,0,0,.18);
  /* Transition */
  --t: .18s cubic-bezier(.4,0,.2,1);
}

/* Role-specific overrides applied by JS on body */
body.role-farmer     { --role-color: var(--role-farmer);     --role-bg: var(--green-bg);  }
body.role-aggregator { --role-color: var(--role-aggregator); --role-bg: var(--amber-bg);  }
body.role-driver     { --role-color: var(--role-driver);     --role-bg: var(--blue-bg);   }
body.role-buyer      { --role-color: var(--role-buyer);      --role-bg: var(--violet-bg); }
body.role-admin      { --role-color: var(--role-admin);      --role-bg: var(--slate-bg);  }

/* ── RESET ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-1);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font-family: var(--font-sans); cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: var(--font-sans); }
ul { list-style: none; }
img { max-width: 100%; }

/* ── BUTTONS ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px;
  border-radius: var(--r-sm);
  font-size: .83rem; font-weight: 500;
  transition: all var(--t);
  white-space: nowrap; cursor: pointer;
}
.btn-primary   { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-role      { background: var(--role-color, var(--brand)); color: #fff; }
.btn-role:hover { opacity: .9; transform: translateY(-1px); }
.btn-outline   { background: transparent; color: var(--text-1); border: 1.5px solid var(--border); }
.btn-outline:hover { background: var(--surface-2); }
.btn-ghost     { background: transparent; color: var(--text-2); padding: 7px 14px; }
.btn-ghost:hover { background: var(--surface-2); color: var(--text-1); }
.btn-danger    { background: var(--red); color: #fff; }
.btn-sm        { padding: 6px 12px; font-size: .76rem; }
.btn-lg        { padding: 12px 24px; font-size: .92rem; }
.btn-block     { width: 100%; justify-content: center; }
.btn-icon      { padding: 8px; border-radius: var(--r-sm); }
.btn:disabled  { opacity: .45; cursor: not-allowed; transform: none !important; }

/* ── FORM ELEMENTS ──────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 16px; }
.form-label { font-size: .78rem; font-weight: 500; color: var(--text-2); }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: .88rem;
  background: var(--surface);
  color: var(--text-1);
  transition: border-color var(--t), box-shadow var(--t);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--role-color, var(--brand));
  box-shadow: 0 0 0 3px rgba(22,163,74,.12);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: .73rem; color: var(--text-3); }
.form-error { font-size: .73rem; color: var(--red); }

/* ── CARD ───────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-title { font-size: .9rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-body  { padding: 20px; }
.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--r-md) var(--r-md);
}

/* ── STAT CARD ──────────────────────────────────────────────── */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 20px;
  box-shadow: var(--shadow-md);
}
.stat-label { font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin-bottom: 8px; }
.stat-value { font-size: 1.6rem; font-weight: 700; color: var(--text-1); font-family: var(--font-mono); line-height: 1; }
.stat-sub   { font-size: .75rem; color: var(--text-3); margin-top: 4px; }
.stat-change { font-size: .72rem; font-weight: 600; display: inline-flex; align-items: center; gap: 3px; margin-top: 4px; }
.stat-change.up   { color: var(--green); }
.stat-change.down { color: var(--red); }

/* ── BADGE / PILL ───────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 99px;
  font-size: .7rem; font-weight: 600;
}
.badge-green  { background: var(--green-bg);  color: #14532d; }
.badge-amber  { background: var(--amber-bg);  color: #92400e; }
.badge-red    { background: var(--red-bg);    color: #991b1b; }
.badge-blue   { background: var(--blue-bg);   color: #1e40af; }
.badge-violet { background: var(--violet-bg); color: #5b21b6; }
.badge-gray   { background: var(--surface-2); color: var(--text-2); }

/* ── TABLE ──────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .83rem; }
thead th { padding: 10px 14px; text-align: left; font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); border-bottom: 1px solid var(--border); }
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--text-1); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg); }

/* ── DIVIDER ────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ── SECTION LABEL ──────────────────────────────────────────── */
.section-label {
  font-size: .7rem; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-3); margin-bottom: 12px;
}

/* ── GRID ───────────────────────────────────────────────────── */
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 1024px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px)  { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }

/* ── INFO ROW (KEY-VALUE DISPLAY) ───────────────────────────── */
.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: .84rem;
}
.info-row:last-child { border-bottom: none; }
.info-row .key, .info-row .label, .info-row > span:first-child {
  color: var(--text-3);
  font-weight: 500;
  font-size: .82rem;
}
.info-row .value, .info-row > span:last-child {
  font-weight: 600;
  color: var(--text-1);
  text-align: right;
}

/* ── AVATAR & PHOTO UPLOAD ──────────────────────────────────── */
.avatar {
  border-radius: 50%; background: var(--role-color, var(--brand));
  color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; position: relative; overflow: hidden;
  background-size: cover; background-position: center;
}
.avatar-sm { width: 34px; height: 34px; font-size: .8rem; }
.avatar-md { width: 48px; height: 48px; font-size: 1.1rem; }
.avatar-lg { width: 80px; height: 80px; font-size: 1.6rem; border: 3px solid rgba(255,255,255,.2); }
.avatar-upload-btn {
  position: absolute; bottom: 0; right: 0;
  background: var(--brand); color: #fff;
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; cursor: pointer; border: 2px solid #fff;
  box-shadow: var(--shadow-sm); transition: transform var(--t);
}
.avatar-upload-btn:hover { transform: scale(1.1); }

/* ── MODAL ──────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(5,15,5,.55);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity var(--t);
}
.modal-backdrop.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-modal);
  width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto;
  border: 1px solid var(--border);
  transform: scale(.96) translateY(8px);
  transition: transform .22s cubic-bezier(.4,0,.2,1);
}
.modal-backdrop.open .modal { transform: scale(1) translateY(0); }
.modal-wide  { max-width: 680px; }
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.modal-title    { font-size: .95rem; font-weight: 600; }
.modal-subtitle { font-size: .78rem; color: var(--text-3); margin-top: 2px; }
.modal-body     { padding: 24px; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
  background: var(--surface); position: sticky; bottom: 0;
}
.modal-close {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface-2); color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; flex-shrink: 0; transition: background var(--t); margin-top: -2px;
}
.modal-close:hover { background: var(--border); color: var(--text-1); }

/* ── SIDEBAR LAYOUT ─────────────────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px;
}
.sidebar-brand-logo { font-size: 1.1rem; font-weight: 800; color: var(--brand-dark); display: flex; align-items: center; gap: 8px; text-decoration: none; cursor: pointer; transition: opacity var(--t); }
.sidebar-brand-logo:hover { opacity: .85; }
.sidebar-brand-role {
  font-size: .68rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--role-color, var(--brand)); background: var(--role-bg, var(--green-bg));
  padding: 2px 8px; border-radius: 99px; width: fit-content;
}
.sidebar-nav { flex: 1; padding: 12px 10px; }
.nav-group-label { font-size: .65rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); padding: 8px 10px 4px; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  font-size: .83rem; font-weight: 500;
  color: var(--text-2);
  transition: all var(--t);
  margin-bottom: 2px;
}
.nav-link:hover   { background: var(--bg); color: var(--text-1); }
.nav-link.active  { background: var(--role-bg, var(--green-bg)); color: var(--role-color, var(--brand)); font-weight: 600; }
.nav-link .nav-icon { width: 18px; text-align: center; font-size: 1rem; }
.nav-link .nav-badge { margin-left: auto; background: var(--role-color, var(--brand)); color: #fff; font-size: .65rem; font-weight: 700; padding: 1px 6px; border-radius: 99px; }
.sidebar-footer {
  padding: 14px 10px;
  border-top: 1px solid var(--border);
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--t);
}
.sidebar-user:hover { background: var(--bg); }
.sidebar-user-name { font-size: .83rem; font-weight: 600; line-height: 1.2; }
.sidebar-user-role { font-size: .7rem; color: var(--text-3); }

/* ── MAIN CONTENT ───────────────────────────────────────────── */
.main-content {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
}
.topbar {
  height: var(--topbar-h); background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; position: sticky; top: 0; z-index: 100;
}
.topbar-title { font-size: 1rem; font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.page-content { flex: 1; padding: 28px; }
.page-header { margin-bottom: 24px; }
.page-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 4px; }
.page-subtitle { font-size: .83rem; color: var(--text-2); }

/* ── PUBLIC TOPNAV ──────────────────────────────────────────── */
.pub-topnav {
  background: #fff; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  height: 64px; display: flex; align-items: center;
  padding: 0 32px;
}
.pub-topnav-logo { font-size: 1.2rem; font-weight: 800; color: var(--brand-dark); display: flex; align-items: center; gap: 8px; margin-right: auto; text-decoration: none; cursor: pointer; transition: opacity var(--t); }
.pub-topnav-logo:hover { opacity: .85; }
.pub-topnav-links { display: flex; align-items: center; gap: 4px; }
.pub-nav-link { padding: 7px 14px; border-radius: var(--r-sm); font-size: .83rem; font-weight: 500; color: var(--text-2); transition: all var(--t); }
.pub-nav-link:hover  { background: var(--bg); color: var(--text-1); }
.pub-nav-link.active { color: var(--brand); font-weight: 600; }
.pub-topnav-actions  { display: flex; align-items: center; gap: 10px; margin-left: 16px; }

/* ── CART BADGE ─────────────────────────────────────────────── */
.cart-btn { position: relative; }
.cart-count {
  position: absolute; top: -4px; right: -4px;
  background: var(--brand); color: #fff;
  width: 18px; height: 18px; border-radius: 50%;
  font-size: .65rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ── HERO (Landing / Marketplace) ───────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--brand-dark) 0%, #052e16 100%);
  padding: 72px 32px;
  text-align: center;
  color: #fff;
}
.hero-eyebrow { font-size: .75rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: #86efac; margin-bottom: 12px; }
.hero-title { font-size: 2.4rem; font-weight: 800; line-height: 1.15; margin-bottom: 16px; max-width: 640px; margin-left: auto; margin-right: auto; }
.hero-subtitle { font-size: 1rem; color: #bbf7d0; max-width: 520px; margin: 0 auto 28px; }
.hero-actions { display: flex; align-items: center; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ── PRODUCE LISTING CARD (Marketplace) ─────────────────────── */
.produce-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  position: relative;
}
.produce-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 16px 32px rgba(20, 83, 45, 0.12), 0 4px 12px rgba(0, 0, 0, 0.05);
  border-color: rgba(22, 101, 52, 0.3);
}
.produce-card-img {
  height: 160px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.produce-card-img .produce-emoji {
  font-size: 3.8rem;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.3));
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 2;
}
.produce-card:hover .produce-emoji {
  transform: scale(1.15) rotate(4deg);
}
.produce-img-glow {
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0) 70%);
  pointer-events: none;
}
.produce-card-top-tag {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
}
.produce-card-stock-tag {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  color: #fff;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: .68rem;
  font-weight: 600;
}
.produce-card-hover-hint {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent);
  color: #fff;
  font-size: .72rem;
  font-weight: 600;
  padding: 14px 12px 6px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 3;
}
.produce-card:hover .produce-card-hover-hint {
  opacity: 1;
}
.produce-card-body { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.produce-card-cluster { font-size: .7rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); margin-bottom: 4px; display: flex; align-items: center; gap: 4px; }
.produce-card-name  { font-size: 1.05rem; font-weight: 700; margin-bottom: 6px; color: var(--text-1); }
.produce-card-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.produce-card-price-row { display: flex; align-items: baseline; justify-content: space-between; margin-top: auto; padding-top: 6px; }
.produce-card-price { font-family: var(--font-mono); font-size: 1.15rem; font-weight: 800; color: var(--brand-dark); }
.produce-card-avail { font-size: .75rem; color: var(--text-3); font-weight: 500; }
.produce-card-footer {
  padding: 12px 16px; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--surface-2);
}

/* ── ACTIVITY FEED ──────────────────────────────────────────── */
.activity-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); flex-shrink: 0; margin-top: 5px; }
.activity-text { font-size: .83rem; color: var(--text-1); }
.activity-time { font-size: .72rem; color: var(--text-3); margin-top: 2px; }

/* ── PROGRESS BAR ───────────────────────────────────────────── */
.progress-wrap { }
.progress-labels { display: flex; justify-content: space-between; font-size: .74rem; color: var(--text-2); margin-bottom: 6px; }
.progress-bg { height: 8px; background: var(--border); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--role-color, var(--brand)); border-radius: 99px; transition: width .7s cubic-bezier(.4,0,.2,1); }

/* ── EMPTY STATE ────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-state-icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state-title { font-size: .95rem; font-weight: 600; margin-bottom: 6px; }
.empty-state-sub { font-size: .82rem; color: var(--text-3); }

/* ── TOAST ──────────────────────────────────────────────────── */
#toast-root {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  background: #0f1f0f; color: #fff;
  border-radius: var(--r-md); padding: 12px 18px;
  font-size: .83rem; box-shadow: var(--shadow-modal);
  border-left: 3px solid var(--brand);
  max-width: 320px; pointer-events: all;
  animation: toastIn .25s ease;
}
.toast.amber  { border-left-color: var(--amber); }
.toast.red    { border-left-color: var(--red); }
.toast.blue   { border-left-color: var(--blue); }
@keyframes toastIn { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }

/* ── TABS ───────────────────────────────────────────────────── */
.tab-bar { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab-btn {
  padding: 10px 18px; font-size: .83rem; font-weight: 500;
  color: var(--text-2); border-bottom: 2px solid transparent;
  transition: all var(--t);
}
.tab-btn:hover  { color: var(--text-1); }
.tab-btn.active { color: var(--role-color, var(--brand)); border-bottom-color: var(--role-color, var(--brand)); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── PROFILE PAGE ───────────────────────────────────────────── */
.profile-hero {
  background: linear-gradient(135deg, var(--brand-dark), #052e16);
  border-radius: var(--r-lg); padding: 32px; color: #fff;
  display: flex; align-items: center; gap: 20px; margin-bottom: 24px;
}
.profile-hero-info .name { font-size: 1.3rem; font-weight: 700; margin-bottom: 4px; }
.profile-hero-info .sub  { font-size: .83rem; color: #bbf7d0; margin-bottom: 10px; }
.rating-stars { display: flex; gap: 2px; font-size: .9rem; }

/* ── LOGIN PAGE ─────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 20px;
}
.auth-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 460px; overflow: hidden;
}
.auth-brand {
  background: linear-gradient(135deg, var(--brand-dark), #052e16);
  padding: 28px 32px 24px; color: #fff; text-align: center;
}
.auth-brand-logo { font-size: 1.4rem; font-weight: 800; margin-bottom: 4px; }
.auth-brand-sub  { font-size: .82rem; color: #bbf7d0; }
.auth-body { padding: 28px 32px 32px; }
.auth-tabs { display: flex; margin-bottom: 24px; border: 1.5px solid var(--border); border-radius: var(--r-sm); overflow: hidden; }
.auth-tab  {
  flex: 1; padding: 8px; text-align: center; font-size: .83rem; font-weight: 500;
  color: var(--text-2); transition: all var(--t); cursor: pointer;
}
.auth-tab.active { background: var(--brand); color: #fff; }
.role-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 20px; }
.role-option {
  border: 2px solid var(--border); border-radius: var(--r-md);
  padding: 12px 10px; text-align: center; cursor: pointer;
  transition: all var(--t);
}
.role-option:hover   { border-color: var(--text-3); }
.role-option.selected { border-color: var(--role-color, var(--brand)); background: var(--role-bg, var(--green-bg)); }
.role-option-icon  { font-size: 1.5rem; margin-bottom: 4px; }
.role-option-label { font-size: .76rem; font-weight: 600; }
.role-option-sub   { font-size: .68rem; color: var(--text-3); }

/* ── USSD PHONE (DEMO PAGE) ─────────────────────────────────── */
.ussd-page {
  min-height: 100vh; background: #0a1a0a;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; flex-direction: column; gap: 20px;
}
.ussd-phone {
  background: #1a1a1f; border-radius: 32px;
  padding: 20px 18px 28px;
  box-shadow: 0 30px 80px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.06);
  width: 280px; border: 2px solid #2a2a30;
}
.ussd-phone-top { text-align: center; margin-bottom: 10px; }
.ussd-phone-carrier { font-size: .65rem; color: #555; font-family: var(--font-mono); }
.ussd-screen {
  background: #0d2b0d; border-radius: 12px;
  padding: 14px 16px; min-height: 160px;
  font-family: var(--font-mono); font-size: .73rem; color: #86efac;
  line-height: 1.75; margin-bottom: 14px;
  border: 1px solid #1a3d1a; white-space: pre-wrap;
  overflow-y: auto; max-height: 200px;
}
.ussd-input-bar {
  background: #111; border-radius: 8px; padding: 8px 12px;
  font-family: var(--font-mono); font-size: 1rem; color: #fde68a;
  text-align: center; margin-bottom: 12px; min-height: 36px;
  letter-spacing: .12em;
}
.ussd-keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ussd-key {
  background: #2a2a30; color: #e0e0e0; border-radius: 10px;
  padding: 11px 0; text-align: center;
  font-size: .9rem; font-family: var(--font-mono); font-weight: 500;
  cursor: pointer; border: 1px solid #3a3a40;
  transition: background var(--t), transform var(--t);
}
.ussd-key:hover  { background: #3a3a40; }
.ussd-key:active { transform: scale(.92); background: var(--brand-dark); }
.ussd-action-bar { display: flex; gap: 6px; margin-top: 10px; }
.ussd-action-btn {
  flex: 1; padding: 9px 4px; border-radius: 10px;
  background: #1e3a1e; color: #86efac; font-size: .7rem; font-weight: 600;
  text-align: center; cursor: pointer; border: 1px solid #2a4a2a;
  transition: background var(--t);
}
.ussd-action-btn:hover { background: #2a4a2a; }
.ussd-lang-toggle { display: flex; justify-content: center; gap: 6px; margin-top: 12px; }
.ussd-lang-btn {
  padding: 4px 12px; border-radius: 99px; font-size: .68rem; font-weight: 600;
  border: 1px solid #2a2a30; color: #555; cursor: pointer; background: #1a1a1f;
  transition: all var(--t);
}
.ussd-lang-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.ussd-sms-box {
  background: #0d2b0d; border: 1px solid #1a4a1a; border-radius: var(--r-md);
  padding: 14px 16px; color: #86efac; font-size: .8rem; max-width: 340px;
  display: none;
}
.ussd-sms-box.show { display: block; animation: toastIn .3s ease; }
.ussd-sms-header { font-size: .65rem; letter-spacing: .1em; text-transform: uppercase; color: #4ade80; margin-bottom: 6px; font-weight: 600; }

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .page-content { padding: 16px; }
  .pub-topnav { padding: 0 16px; }
  .hero { padding: 48px 20px; }
  .hero-title { font-size: 1.8rem; }
  .pub-topnav-links { display: none; }
  .auth-body { padding: 24px 20px; }
  .role-picker { grid-template-columns: 1fr 1fr; }
}

/* ── ANIMATIONS ─────────────────────────────────────────────── */
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.fade-up { animation: fadeUp .3s ease; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }
.pulse { animation: pulse 2s infinite; }

/* ── CHIP FILTER ────────────────────────────────────────────── */
.chip-group { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.chip {
  padding: 5px 14px; border-radius: 99px; font-size: .76rem; font-weight: 500;
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text-2);
  cursor: pointer; transition: all var(--t);
}
.chip:hover  { border-color: var(--text-3); color: var(--text-1); }
.chip.active { border-color: var(--brand); background: var(--green-bg); color: var(--brand-dark); }

/* ── SEARCH BAR ─────────────────────────────────────────────── */
.search-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--r-sm); padding: 8px 14px;
  transition: border-color var(--t), box-shadow var(--t);
}
.search-bar:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(22,163,74,.1); }
.search-bar input { flex: 1; border: none; outline: none; font-size: .85rem; background: transparent; }
.search-icon { color: var(--text-3); font-size: .9rem; }

/* ── CART DRAWER ────────────────────────────────────────────── */
.cart-drawer {
  position: fixed; right: 0; top: 0; bottom: 0; width: 360px; z-index: 400;
  background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: -8px 0 40px rgba(0,0,0,.1);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.cart-drawer.open { transform: translateX(0); }
.cart-drawer-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.3);
  z-index: 399; opacity: 0; pointer-events: none; transition: opacity var(--t);
}
.cart-drawer-overlay.open { opacity: 1; pointer-events: all; }
.cart-drawer-header {
  padding: 20px 20px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: var(--surface);
}
.cart-drawer-title { font-size: .95rem; font-weight: 600; }
.cart-drawer-body  { flex: 1; overflow-y: auto; padding: 16px 20px; }
.cart-drawer-footer { padding: 16px 20px; border-top: 1px solid var(--border); }
.cart-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.cart-item:last-child { border-bottom: none; }
.cart-item-icon { font-size: 1.8rem; flex-shrink: 0; }
.cart-item-info { flex: 1; }
.cart-item-name { font-size: .85rem; font-weight: 600; margin-bottom: 2px; }
.cart-item-sub  { font-size: .74rem; color: var(--text-3); }
.cart-item-price { font-family: var(--font-mono); font-size: .85rem; font-weight: 700; color: var(--brand-dark); }
.cart-qty-ctrl { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.cart-qty-btn { width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); font-size: .9rem; display: flex; align-items: center; justify-content: center; cursor: pointer; border: 1px solid var(--border); }
.cart-qty { font-family: var(--font-mono); font-size: .85rem; font-weight: 600; }
