/*
 * W/B Investments — local utility stylesheet.
 * Hand-built subset of Tailwind covering exactly the classes used in the
 * templates, so the app loads instantly with NO external CDN dependency.
 * If you later add new utility classes in templates, add them here too
 * (or switch to a compiled Tailwind build for production).
 */

/* ---- minimal reset ---- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
table { border-collapse: collapse; }
button { font: inherit; cursor: pointer; border: 0; background: none; }
h1 { font-size: inherit; font-weight: inherit; margin: 0; }

/* ---- layout ---- */
.flex { display: flex; }
.inline { display: inline; }
.inline-block { display: inline-block; }
.block { display: block; }
.hidden { display: none; }
.grid { display: grid; }
.flex-1 { flex: 1 1 0%; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-6 { gap: 1.5rem; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0,1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.items-end { align-items: flex-end; }
.self-end { align-self: flex-end; }
.min-h-screen { min-height: 100vh; }
.mx-auto { margin-left: auto; margin-right: auto; }
.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }
.whitespace-nowrap { white-space: nowrap; }
.w-full { width: 100%; }
.w-28 { width: 7rem; }

/* max-width */
.max-w-sm { max-width: 24rem; }
.max-w-md { max-width: 28rem; }
.max-w-lg { max-width: 32rem; }
.max-w-5xl { max-width: 64rem; }

/* ---- spacing ---- */
.p-4 { padding: 1rem; } .p-5 { padding: 1.25rem; } .p-6 { padding: 1.5rem; }
.px-2 { padding-left: .5rem; padding-right: .5rem; }
.px-3 { padding-left: .75rem; padding-right: .75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-0\.5 { padding-top: .125rem; padding-bottom: .125rem; }
.py-1 { padding-top: .25rem; padding-bottom: .25rem; }
.py-2 { padding-top: .5rem; padding-bottom: .5rem; }
.py-3 { padding-top: .75rem; padding-bottom: .75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.pb-3 { padding-bottom: .75rem; }
.pl-5 { padding-left: 1.25rem; }
.mb-1 { margin-bottom: .25rem; } .mb-2 { margin-bottom: .5rem; }
.mb-3 { margin-bottom: .75rem; } .mb-4 { margin-bottom: 1rem; } .mb-6 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: .25rem; } .mt-2 { margin-top: .5rem; } .mt-3 { margin-top: .75rem; } .mt-6 { margin-top: 1.5rem; }
.my-1 { margin-top: .25rem; margin-bottom: .25rem; }
.ml-2 { margin-left: .5rem; }

/* ---- typography ---- */
.text-xs { font-size: .75rem; line-height: 1rem; }
.text-sm { font-size: .875rem; line-height: 1.25rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: .025em; }
.leading-none { line-height: 1; }
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.list-disc { list-style: disc; }
.opacity-80 { opacity: .8; }
.underline { text-decoration: underline; }
.hover\:underline:hover { text-decoration: underline; }

/* ---- borders / radius / shadow ---- */
.border { border: 1px solid #e2e8f0; }
.border-t { border-top: 1px solid #e2e8f0; }
.border-b { border-bottom: 1px solid #e2e8f0; }
.border-slate-300 { border-color: #cbd5e1; }
.border-amber-200 { border-color: #fde68a; }
.divide-y > * + * { border-top: 1px solid #e2e8f0; }
.rounded { border-radius: .25rem; }
.rounded-lg { border-radius: .5rem; }
.rounded-xl { border-radius: .75rem; }
.rounded-full { border-radius: 9999px; }
.shadow { box-shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06); }

/* ---- colours (backgrounds) ---- */
.bg-white { background:#fff; }
.bg-slate-50 { background:#f8fafc; } .bg-slate-100 { background:#f1f5f9; }
.bg-slate-200 { background:#e2e8f0; } .bg-slate-700 { background:#334155; }
.bg-slate-800 { background:#1e293b; }
.bg-teal-700 { background:#0f766e; } .bg-teal-800 { background:#115e59; }
.bg-amber-50 { background:#fffbeb; } .bg-amber-100 { background:#fef3c7; }
.bg-red-100 { background:#fee2e2; }
.bg-green-100 { background:#dcfce7; }
.bg-blue-100 { background:#dbeafe; }
.bg-purple-100 { background:#f3e8ff; }

/* ---- colours (text) ---- */
.text-white { color:#fff; }
.text-slate-400 { color:#94a3b8; } .text-slate-500 { color:#64748b; }
.text-slate-600 { color:#475569; } .text-slate-700 { color:#334155; }
.text-slate-800 { color:#1e293b; }
.text-teal-700 { color:#0f766e; }
.text-amber-600 { color:#d97706; } .text-amber-700 { color:#b45309; } .text-amber-800 { color:#92400e; }
.text-red-500 { color:#ef4444; } .text-red-600 { color:#dc2626; }
.text-red-700 { color:#b91c1c; } .text-red-800 { color:#991b1b; }
.text-green-700 { color:#15803d; } .text-green-800 { color:#166534; }
.text-blue-700 { color:#1d4ed8; }
.text-purple-700 { color:#7e22ce; }

/* ---- hover states ---- */
.hover\:bg-slate-50:hover { background:#f8fafc; }
.hover\:bg-slate-200:hover { background:#e2e8f0; }
.hover\:bg-slate-300:hover { background:#cbd5e1; }
.hover\:bg-slate-800:hover { background:#1e293b; }
.hover\:bg-slate-900:hover { background:#0f172a; }
.hover\:bg-teal-800:hover { background:#115e59; }
.hover\:bg-teal-900:hover { background:#134e4a; }

/* ---- body base colours (from base.html) ---- */
.text-slate-800 { color:#1e293b; }

/* ---- responsive: sm ≥640px ---- */
@media (min-width: 640px) {
  .sm\:flex { display: flex; }
  .sm\:hidden { display: none; }
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .sm\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .sm\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
}

/* ---- popup modal (agent breakdown) ---- */
.cursor-pointer { cursor: pointer; }
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.55);
  display: none; align-items: flex-start; justify-content: center;
  padding: 6vh 1rem 1rem; z-index: 50;
}
.modal-overlay.open { display: flex; }
.modal-panel {
  background: #fff; border-radius: .85rem; width: 100%; max-width: 34rem;
  max-height: 84vh; display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,.35); animation: modalpop .16s ease-out;
}
@keyframes modalpop { from { transform: translateY(-8px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-body { overflow-y: auto; }

/* ---- responsive: lg ≥1024px ---- */
@media (min-width: 1024px) {
  .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

/* ---- KPI position cards (management dashboard) ---- */
.kpi-card {
  position: relative; background: #fff; border-radius: 1rem; overflow: hidden;
  cursor: pointer; border: 1px solid #eef1f6;
  box-shadow: 0 1px 2px rgba(15,23,42,.06), 0 6px 16px -12px rgba(15,23,42,.25);
  transition: transform .22s cubic-bezier(.2,.8,.2,1), box-shadow .22s;
}
.kpi-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent2, var(--accent)));
}
.kpi-card:hover { transform: translateY(-4px); box-shadow: 0 18px 34px -16px var(--accent); }
.kpi-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 1.05rem 1.1rem .5rem; }
.kpi-headL { display: flex; align-items: center; gap: .7rem; }
.kpi-icon {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent2, var(--accent)));
  box-shadow: 0 6px 14px -5px var(--accent);
}
.kpi-icon svg { width: 22px; height: 22px; stroke: #fff; fill: none; stroke-width: 1.7; }
.kpi-title { font-size: .72rem; letter-spacing: .07em; text-transform: uppercase; color: #475569; font-weight: 700; line-height: 1.1; }
.kpi-note { font-size: .7rem; color: #94a3b8; margin-top: 1px; }
.kpi-details { font-size: .72rem; color: var(--accent); font-weight: 600; white-space: nowrap; }
.kpi-details:hover { text-decoration: underline; }
.kpi-stats { padding: .1rem 1.1rem 1.05rem; }
.kpi-stat { display: flex; align-items: baseline; justify-content: space-between; padding: .6rem 0; }
.kpi-stat + .kpi-stat { border-top: 1px dashed #e6eaf1; }
.kpi-label { font-size: .66rem; letter-spacing: .05em; text-transform: uppercase; color: #94a3b8; font-weight: 600; }
.kpi-label small { color: #cbd5e1; font-weight: 500; text-transform: none; letter-spacing: 0; }
.kpi-value { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1; }
.kpi-usdt { color: var(--accent); }
.kpi-money { color: #334155; }
.kpi-neg { color: #dc2626; }

/* ---- extra utilities ---- */
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.bg-teal-50 { background:#f0fdfa; }
.bg-teal-600 { background:#0d9488; }
.bg-green-600 { background:#16a34a; }
.bg-red-600 { background:#dc2626; }
.hover\:bg-green-700:hover { background:#15803d; }
.hover\:bg-red-700:hover { background:#b91c1c; }
.border-teal-200 { border-color:#99f6e4; }
.border-dashed { border-style: dashed; }
.text-teal-800 { color:#115e59; }
.text-green-600 { color:#16a34a; }
.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.tracking-widest { letter-spacing: .1em; }
.mt-4 { margin-top: 1rem; }
.mb-5 { margin-bottom: 1.25rem; }
.pt-3 { padding-top: .75rem; }
.w-auto { width: auto; }

/* ---- navigation menus ----
 * Grouped nav: related screens sit under one heading instead of nine flat
 * links. Purpose-built rather than utility classes, because the dropdown needs
 * positioning and stacking this stylesheet's Tailwind subset doesn't carry.
 * Opens on click, not hover — hover menus are unusable on the phone PWA.
 */
.site-header { position: relative; z-index: 30; }

.nav-group { position: relative; }

.nav-trigger {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .25rem .5rem;
  border-radius: .375rem;
  color: inherit;
}
.nav-trigger:hover { background: #115e59; }
.nav-trigger .caret { font-size: .65rem; transition: transform .15s ease; }
.nav-group.open .nav-trigger { background: #115e59; }
.nav-group.open .caret { transform: rotate(180deg); }

.nav-panel {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: .35rem;
  min-width: 13rem;
  padding: .25rem;
  background: #fff;
  color: #1e293b;
  border-radius: .5rem;
  box-shadow: 0 10px 25px rgba(0,0,0,.18), 0 2px 6px rgba(0,0,0,.10);
}
.nav-group.open .nav-panel { display: block; }
.nav-panel a {
  display: block;
  padding: .5rem .75rem;
  border-radius: .375rem;
  font-size: .875rem;
  white-space: nowrap;
}
.nav-panel a:hover { background: #f1f5f9; }

/* Keyboard users must be able to see where they are. */
.nav-trigger:focus-visible,
.nav-panel a:focus-visible,
#navMenu a:focus-visible {
  outline: 2px solid #99f6e4;
  outline-offset: 1px;
}

/* Mobile: the same groups as labelled sections. Nested dropdowns inside a
   burger menu are worse than a short scroll, so these stay open. */
.nav-mobile-label {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  opacity: .6;
  margin-top: .6rem;
  padding-bottom: .1rem;
}
.nav-mobile-group a { padding-left: .5rem; }

@media (prefers-reduced-motion: reduce) {
  .nav-trigger .caret { transition: none; }
}

/* ---- receipts ---- */
.receipt {
  max-width: 22rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem;
  background: #fff;
}
.receipt-head {
  text-align: center;
  border-bottom: 1px dashed #cbd5e1;
  padding-bottom: .75rem;
  margin-bottom: .75rem;
}
.receipt-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: .875rem;
  padding: .2rem 0;
}
.receipt-row > span:first-child { color: #64748b; }
.receipt-row > span:last-child { text-align: right; }
.receipt-total {
  border-top: 1px solid #e2e8f0;
  margin-top: .5rem;
  padding-top: .5rem;
  font-weight: 700;
  font-size: 1rem;
}
.receipt-total > span:first-child { color: #1e293b; }
.receipt-foot {
  text-align: center;
  border-top: 1px dashed #cbd5e1;
  margin-top: .75rem;
  padding-top: .75rem;
  font-size: .75rem;
  color: #64748b;
}
.receipt-no {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .08em;
  font-weight: 700;
}

/* ---- print: receipt only, no app chrome ---- */
@media print {
  body { background: #fff !important; }
  header, footer, .no-print { display: none !important; }
  main { padding: 0 !important; margin: 0 !important; max-width: none !important; }
  .shadow { box-shadow: none !important; }
  .receipt {
    max-width: none;
    width: 100%;
    padding: 0;
    border-radius: 0 !important;
    box-shadow: none !important;
  }
}
