/* BUSCOR GO - powered by Mojo Money
   Brand palette borrowed from buscor.co.za:
     - Primary blue (header, primary actions): #003366
     - Accent yellow (highlights, CTAs):       #f9c80e
     - Neutral surface:                        #f4f6fa
   Mojo Money "Powered by" strip uses Mojo's signature red #c8102e. */
:root {
  --buscor-blue: #003366;
  --buscor-blue-dark: #001f3f;
  --buscor-yellow: #f9c80e;
  --buscor-yellow-dark: #d6a500;
  --mojo-red: #c8102e;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --text: #1a1a1a;
  --muted: #6b7280;
  --border: #e5e7eb;
  --success: #0a7f3f;
  --danger: #b91c1c;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: var(--buscor-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Header ---------- */
.app-header {
  background: var(--buscor-blue);
  color: white;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.app-header .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.5px;
}
.app-header .brand .logo {
  width: 34px; height: 34px;
  background: var(--buscor-yellow);
  color: var(--buscor-blue);
  font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  font-size: 1rem;
}
.app-header .brand small { font-weight: 400; opacity: 0.85; font-size: 0.7rem; display: block; }
.app-header nav a { color: white; margin-left: 14px; font-size: 0.9rem; opacity: 0.9; }
.app-header nav a:hover { opacity: 1; }

/* ---------- Mojo Money strip ---------- */
.mojo-strip {
  background: var(--mojo-red);
  color: white;
  font-size: 0.78rem;
  text-align: center;
  padding: 5px 12px;
  letter-spacing: 0.6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.mojo-strip .mojo-logo {
  background: white;
  color: var(--mojo-red);
  font-weight: 900;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.72rem;
}

/* ---------- Layout ---------- */
.container { max-width: 760px; margin: 0 auto; padding: 16px; }
.container.wide { max-width: 1180px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 180px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  margin-bottom: 12px;
  border: 1px solid var(--border);
}
.card h2 { margin: 0 0 8px; font-size: 1.05rem; color: var(--buscor-blue); }
.card h3 { margin: 0 0 6px; font-size: 0.95rem; }
.card .muted { color: var(--muted); font-size: 0.85rem; }

.kpi {
  background: var(--surface);
  border-left: 4px solid var(--buscor-yellow);
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.kpi .label { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.kpi .value { font-size: 1.5rem; font-weight: 700; color: var(--buscor-blue); }

/* ---------- Forms ---------- */
label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 4px; }
input, select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  background: white;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--buscor-yellow); border-color: var(--buscor-yellow); }
.field { margin-bottom: 12px; }
button, .btn {
  background: var(--buscor-blue);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
button:hover, .btn:hover { background: var(--buscor-blue-dark); }
button.accent, .btn.accent { background: var(--buscor-yellow); color: var(--buscor-blue); }
button.accent:hover, .btn.accent:hover { background: var(--buscor-yellow-dark); }
button.ghost, .btn.ghost { background: transparent; color: var(--buscor-blue); border: 1px solid var(--buscor-blue); }
button.danger { background: var(--danger); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Pills / status ---------- */
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; background: #e0e7ff; color: #1e3a8a; }
.pill.success { background: #d1fae5; color: var(--success); }
.pill.danger  { background: #fee2e2; color: var(--danger); }
.pill.warn    { background: #fef3c7; color: #92400e; }
.pill.muted   { background: #e5e7eb; color: #374151; }

/* ---------- Table ---------- */
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: #fafafa; font-weight: 600; color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.4px; }
tr:hover td { background: #fafafa; }

/* ---------- Ticket card ---------- */
.ticket {
  background: linear-gradient(135deg, var(--buscor-blue) 0%, #1d4f86 100%);
  color: white;
  border-radius: 14px;
  padding: 18px;
  position: relative;
  overflow: hidden;
  margin-bottom: 12px;
}
.ticket::before, .ticket::after {
  content: '';
  position: absolute;
  width: 24px; height: 24px;
  background: var(--bg);
  border-radius: 50%;
  top: 50%; transform: translateY(-50%);
}
.ticket::before { left: -12px; }
.ticket::after  { right: -12px; }
.ticket .ref { font-family: 'Courier New', monospace; font-size: 1.15rem; letter-spacing: 1.5px; }
.ticket .row-info { display: flex; justify-content: space-between; margin-top: 12px; }
.ticket .od { font-size: 1.05rem; font-weight: 600; }
.ticket .amount { font-size: 1.4rem; font-weight: 800; color: var(--buscor-yellow); }
.ticket .status-bar { margin-top: 10px; font-size: 0.78rem; opacity: 0.9; display: flex; justify-content: space-between; }

/* ---------- Ad slot ---------- */
.ad-slot {
  border-radius: var(--radius);
  padding: 14px 16px;
  color: white;
  margin: 12px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}
.ad-slot .label-tiny { font-size: 0.66rem; opacity: 0.75; text-transform: uppercase; letter-spacing: 1px; }
.ad-slot h3 { margin: 2px 0; font-size: 1rem; }
.ad-slot .ad-cta {
  background: white; color: #111; padding: 6px 10px; border-radius: 6px;
  font-size: 0.8rem; font-weight: 700; white-space: nowrap;
}

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 14px; }
.tab {
  padding: 10px 14px;
  cursor: pointer;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 0;
}
.tab.active { color: var(--buscor-blue); border-bottom-color: var(--buscor-yellow); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- Misc ---------- */
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: #1f2937; color: white; padding: 10px 16px; border-radius: 8px;
  font-size: 0.9rem; box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 1000;
}
.toast.success { background: var(--success); }
.toast.danger { background: var(--danger); }
.hidden { display: none !important; }
.center { text-align: center; }
.spinner { border: 3px solid #e5e7eb; border-top-color: var(--buscor-blue); border-radius: 50%; width: 22px; height: 22px; animation: spin 0.8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.scan-target {
  border: 3px dashed var(--buscor-yellow);
  border-radius: 14px;
  padding: 30px;
  text-align: center;
  background: #fffbe6;
  margin: 12px 0;
}
.bus-marker {
  display: inline-block;
  background: var(--buscor-blue);
  color: white;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
}
.section-title {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--muted); margin: 14px 0 6px; font-weight: 700;
}

/* WhatsApp preview */
.wa-thread {
  background: #ECE5DD;
  padding: 12px;
  border-radius: var(--radius);
  min-height: 280px;
  max-height: 480px;
  overflow-y: auto;
}
.wa-bubble {
  max-width: 80%;
  padding: 8px 12px;
  margin: 6px 0;
  border-radius: 10px;
  white-space: pre-wrap;
  font-size: 0.92rem;
  line-height: 1.35;
}
.wa-bubble.user  { background: #DCF8C6; margin-left: auto; }
.wa-bubble.bot   { background: white; }
.wa-input { display: flex; gap: 6px; margin-top: 8px; }
.wa-input input { flex: 1; }
