* { box-sizing: border-box; }
:root {
  --bg: #02281b;
  --card: #0b3b29;
  --text: #e8fdf5;
  --muted: #a5d6c0;
  --primary: #16a34a;
  --danger: #ff5c5c;
  --border: #145f3d;
}
html, body { height: 100%; }
body {
  margin: 0;
  background: radial-gradient(1200px 800px at 50% -10%, #16a34a, #02281b);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Inter, Arial, "Noto Sans", "Helvetica Neue", "Apple Color Emoji", "Segoe UI Emoji";
  line-height: 1.5;
}
.container {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.card {
  width: 100%;
  max-width: 560px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.45);
}
.card-refer {
  max-width: 640px;
  width: 100%;
  padding: 0;
  overflow: hidden;
}
.card-team {
  max-width: 640px;
  width: 100%;
}
.card h1 { margin: 0 0 16px; font-size: 28px; }
.card h2 { margin-top: 0; }
.field { margin-bottom: 14px; }
label { display: block; font-weight: 600; margin-bottom: 6px; }
input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0e1526;
  color: var(--text);
  outline: none;
}
input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,124,255,0.2); }
.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: #0f1730;
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
}
.btn.primary { background: var(--primary); border-color: #3c62c2; color: #fff; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 600px) { .grid { grid-template-columns: 1fr; } }
.muted { color: var(--muted); }
.error { color: var(--danger); font-size: 12px; height: 16px; display: block; }
.details { display: grid; gap: 8px; margin-bottom: 16px; }
.actions { display: flex; justify-content: flex-end; }

/* Generic inline status/message line (for forms) */
.status-line { min-height: 18px; }

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(180deg, #047857, #022c22);
  border-bottom: 1px solid rgba(15,118,110,0.6);
}
.topbar.centered { justify-content: center; position: relative; }
.page-title { margin: 0; font-size: 20px; }
.icon-btn {
  background: #1a223a;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 10px;
  margin-left: 8px;
  cursor: pointer;
}
.icon-btn.menu-toggle { position: absolute; left: 16px; }
.icon-btn.notify { position: relative; }
.icon-btn.small { font-size: 18px; line-height: 1; }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--danger); border-color: #cc4444; color: #fff; }
.btn.block-center { text-align:center; display:block; }

/* Admin complaints badge above hamburger */
.badge-complaints {
  position:absolute;
  top:-6px;
  right:-6px;
  min-width:18px;
  height:18px;
  padding:0 4px;
  border-radius:999px;
  background:#ef4444;
  color:#fff;
  font-size:11px;
  font-weight:700;
  display:none;
  align-items:center;
  justify-content:center;
  box-shadow:0 0 0 2px #022c22;
}

/* Container width tweak for dashboard */
.container.narrow { max-width: 980px; margin: 0 auto; }

/* Admin users page */
.card.full-width { max-width: 100%; }
.users-summary { margin: 8px 0 12px; font-weight: 700; }
.users-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.users-label-inline { display: flex; gap: 6px; align-items: center; }
.users-select,
.users-date {
  padding: 6px 8px;
  border-radius: 8px;
  background: #0e1526;
  color: var(--text);
  border: 1px solid var(--border);
}
.users-search-wrap { margin-bottom: 12px; }
.users-search-input {
  width: 100%;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0e1526;
  color: var(--text);
}
.users-filters-row { display: flex; gap: 8px; align-items: center; margin: -4px 0 12px 0; flex-wrap: wrap; }
.users-table-head { text-align: center; border-bottom: 1px solid var(--border); padding: 8px; }
.users-table-head-wrap { white-space: normal; }

/* Dashboard header banner */
.card.dashboard {
  padding: 0;
  overflow: hidden;
  background: transparent;
  border: none;
  box-shadow: none;
}
.header-banner {
  position: relative;
  margin: 16px 16px 12px;
  padding: 16px 18px 14px;
  border-radius: 24px;
  background: radial-gradient(circle at 0% 0%, #22c55e, #047857);
  box-shadow: 0 18px 40px rgba(0,0,0,0.6);
}
.header-left { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 60px;
  height: 60px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 26px;
  background: #bbf7d0;
  color: #064e3b;
  border: 3px solid rgba(22,163,74,0.8);
}
.identity {
  flex: 1;
}
.identity .name { font-weight: 800; font-size: 18px; letter-spacing: 0.02em; }
.identity .subtext { color: #d1fae5; opacity: 0.9; font-size: 12px; }
.rank-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin-top: 2px;
}
.rank-text {
  margin-right: auto;
}
.header-right { position: absolute; right: 16px; top: 16px; display:flex; align-items:center; gap:8px; }
.badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 12px;
  background: rgba(6,95,70,0.9);
  color: #bbf7d0;
  border: 1px solid rgba(16,185,129,0.8);
}
.badge.success { background: rgba(22,163,74,0.95); color: #022c22; }
.badge.danger { background: var(--danger); color: #fff; }
.badge-notify {
  position:absolute;
  top:-6px;
  right:-6px;
  display:none;
  font-size:10px;
  padding:2px 5px;
}
.header-bottom {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}
.notice-bar {
  margin-top: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: #b91c1c;
  border: 2px solid #fca5a5;
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
  overflow: hidden;
  white-space: nowrap;
  cursor: pointer;
}
.notice-track {
  display: inline-block;
  padding-left: 100%;
  animation: notice-marquee 25s linear infinite;
}
.notice-bar:hover .notice-track {
  animation-play-state: paused;
}
@keyframes notice-marquee {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}
.balance-pill {
  display: inline-block;
  padding: 8px 16px;
  background: #ecfdf5;
  color: #047857;
  font-weight: 900;
  border-radius: 999px;
  min-width: 96px;
  text-align: center;
}
.btn.pill {
  border-radius: 999px;
  background: #10b981;
  border-color: #059669;
  color: #022c22;
  font-weight: 800;
}

/* Tiles */
.tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 14px;
  padding: 12px 8px 18px;
  margin: 0;
  border-radius: 20px;
  background: rgba(6,95,70,0.8);
  box-shadow: 0 14px 32px rgba(0,0,0,0.55);
}
@media (max-width: 800px) { .tiles { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 520px) { .tiles { grid-template-columns: 1fr; } }
.tile {
  border-radius: 18px;
  padding: 14px 10px;
  border: 1px solid rgba(148,247,191,0.7);
  font-weight: 800;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(0,0,0,0.45);
  background: #ecfdf5;
  color: #064e3b;
}
.tile:active { transform: translateY(2px); box-shadow: 0 4px 10px rgba(0,0,0,0.35); }

@media (max-width: 600px) {
  .tiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding: 10px 12px 14px;
  }
  .tile {
    padding: 10px 6px;
    border-radius: 14px;
    /* Make text and emoji significantly larger on mobile */
    font-size: 20px;
    line-height: 1.3;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 20px rgba(0,0,0,0.55);
  }
  /* Slightly richer colors on mobile for a cooler look */
  .tile.mint   { background: #d1fae5; color: #065f46; }
  .tile.yellow { background: #fef3c7; color: #92400e; }
  .tile.red    { background: #fecaca; color: #b91c1c; }
  .tile.green  { background: #bbf7d0; color: #166534; }
  .tile.purple { background: #ddd6fe; color: #5b21b6; }
  .tile.gold   { background: #facc15; color: #78350f; }
  .tile.cyan   { background: #bae6fd; color: #075985; }
  .tile.pink   { background: #fecdd3; color: #9d174d; }
  .tile.orange { background: #fed7aa; color: #9a3412; }
  .tile.sand   { background: #fef9c3; color: #713f12; }
  .tile.lilac  { background: #e9d5ff; color: #6b21a8; }
  .tile.sky    { background: #bfdbfe; color: #1d4ed8; }
}

/* Tile Colors (subtle tone variations, all within green family) */
.tile.mint   { background: #ecfdf5; color: #065f46; }
.tile.yellow { background: #fef9c3; color: #854d0e; }
.tile.red    { background: #fee2e2; color: #b91c1c; }
.tile.green  { background: #dcfce7; color: #166534; }
.tile.purple { background: #ede9fe; color: #5b21b6; }
.tile.gold   { background: #fef3c7; color: #92400e; }
.tile.cyan   { background: #e0f2fe; color: #075985; }
.tile.pink   { background: #ffe4e6; color: #9d174d; }
.tile.orange { background: #ffedd5; color: #9a3412; }
.tile.sand   { background: #fefce8; color: #713f12; }
.tile.lilac  { background: #f3e8ff; color: #6b21a8; }
.tile.sky    { background: #e0f2fe; color: #0ea5e9; }

/* Rank and avatar image */
.rank-text { color: #00134b; font-weight: 700; margin-top: 4px; }
.avatar.bg-image { background-size: cover !important; background-position: center !important; color: transparent; }

/* Admin sidebar (legacy generic sidebar styles) */
.admin-layout { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (max-width: 900px) { .admin-layout { grid-template-columns: 1fr; } }
.sidebar {
  background: #0f1730; border: 1px solid var(--border); border-radius: 12px; padding: 12px; height: fit-content;
}
.sidebar h3 { margin: 0 0 8px; font-size: 16px; }
.sidebar .nav { display: grid; gap: 8px; }
.sidebar .nav a { color: var(--text); text-decoration: none; background:#111a36; border:1px solid var(--border); padding:8px 10px; border-radius:8px; }
.sidebar.user-left-menu {
  position:absolute;
  left:16px;
  top:72px;
  max-width:220px;
  z-index:20;
}

/* Utilities */
.collapsed { display: none !important; }
.nowrap td, .nowrap th { white-space: nowrap; }
.wide { max-width: 1600px; width: 100%; }

/* Text color helpers */
.text-success { color: #21c46b; }
.text-danger { color: var(--danger); }

/* Tables */
table { width: 100%; }
.table-bordered { border-collapse: collapse; border: 1px solid var(--border); }
.table-bordered th, .table-bordered td { border: 1px solid var(--border); padding: 8px; }

/* ===== Admin Dashboard New Look ===== */
.admin-shell { display: grid; grid-template-columns: 1fr; min-height: calc(100vh - 64px); gap: 16px; }
@media (max-width: 1000px){ .admin-shell { grid-template-columns: 1fr; } }
.admin-sidebar {
  position: fixed;
  top: calc(56px + var(--safe-top));
  left: 0;
  max-height: calc(100vh - (56px + var(--safe-top)) - 16px);
  overflow-y: auto;
  width: 260px;
  max-width: 80vw;
  background:#111827;
  color:#e5e7eb;
  border-right: 1px solid #1f2937;
  padding:16px;
  border-radius:0 16px 16px 0;
  box-shadow: 8px 0 30px rgba(0,0,0,0.6);
  transform: translateX(0);
  transition: transform .25s ease-out;
  z-index: 40;
}
.admin-sidebar.collapsed {
  display: block !important;
  transform: translateX(-110%);
}
.admin-sidebar .brand { font-weight:800; font-size:18px; margin-bottom:12px; }
.admin-sidebar .nav a { display:block; color:#e5e7eb; padding:10px 12px; border-radius:8px; text-decoration:none; margin-bottom:6px; background:#0f172a; border:1px solid #1f2937; }
.admin-sidebar .nav a:hover { background:#0b1226; }

.admin-header {
  display:grid; grid-template-columns: 1fr 320px 240px 200px; gap:12px; align-items:center; margin-bottom:16px;
}
@media (max-width: 1100px){ .admin-header { grid-template-columns: 1fr; } }
.admin-title { background:#8fd14f; color:#0b2e05; padding:14px 16px; border-radius:10px; font-weight:900; text-transform:uppercase; text-align:center; }
.admin-search { background:#fde047; padding:10px 12px; border-radius:10px; }
.admin-icons { display:flex; gap:10px; justify-content:center; }
.admin-icons .icon-btn { background:#60a5fa; border-color:#3b82f6; color:#0b1020; }
.admin-profile { background:#a78bfa; padding:10px 12px; border-radius:10px; display:flex; align-items:center; gap:8px; justify-content:flex-end; }

.stat-grid { display:grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap:14px; margin-bottom:16px; }
@media (max-width: 1100px){ .stat-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 600px){ .stat-grid { grid-template-columns: 1fr; } }
.stat-card { color:#fff; padding:18px; border-radius:12px; box-shadow: 0 6px 18px rgba(0,0,0,0.25); display:grid; gap:6px; }
.stat-card .label { opacity:0.95; font-weight:700; }
.stat-card .value { font-size:28px; font-weight:900; }
.stat-red { background:#ef4444; }
.stat-blue { background:#3b82f6; }
.stat-green { background:#84cc16; color:#0a1a02; }
.stat-purple { background:#8b5cf6; }

.panel { background: var(--card); border:1px solid var(--border); border-radius:12px; padding:16px; }
.panel h3 { margin:0 0 10px; }

/* Admin dashboard – sidebar layout helpers */
.admin-sidebar-header { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.sidebar-form-spaced { margin-top:12px; }
.sidebar-form-card {
  margin-top:8px;
  padding:8px 10px;
  border-radius:10px;
  border:1px solid #38bdf8;
  background:#e5f6ff;
}
.sidebar-form-card.alt-indigo {
  border-color:#4f46e5;
  background:#eef2ff;
}
.sidebar-history { margin-top:12px; }

/* Admin dashboard – visitor stats */
.panel.mb-16 { margin-bottom:16px; }
.panel-title-strong {
  margin-bottom:8px;
  text-align:center;
  font-weight:900;
  font-size:18px;
}
.visitor-buttons-row {
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:stretch;
}
.visitor-stat-btn {
  flex:1;
  min-width:160px;
  border-radius:12px;
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  justify-content:center;
  padding:10px 12px;
  font-weight:900;
}
.visitor-stat-btn.green { background:#16a34a; color:#fff; }
.visitor-stat-btn.sky { background:#0ea5e9; color:#fff; }
.visitor-stat-btn.indigo { background:#6366f1; color:#fff; }
.visitor-stat-label { font-size:12px; opacity:.9; }
.visitor-stat-value { font-size:22px; }
.visitor-highlow-row {
  margin-top:8px;
  font-size:13px;
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  justify-content:space-between;
  align-items:center;
}
.visitor-highlow-strong { font-weight:700; }
.visitor-details { margin-top:10px; }

/* Admin dashboard – generic pill heading + grids */
.pill-section {
  border-radius:16px;
  padding:10px 12px;
  background:#111827;
  border:2px solid #4b2bb3;
}
.pill-section-header {
  text-align:center;
  margin-bottom:10px;
}
.pill-badge {
  display:inline-block;
  padding:6px 16px;
  border-radius:999px;
  background:#7b3fe4;
  border:3px solid #4b2bb3;
  font-weight:900;
  font-size:18px;
  color:#fff;
}
.pill-grid-4 { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; }

/* All Pending Status buttons: 4 per row on desktop, 2 per row on mobile */
#allPendingButtons { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; }
@media (max-width: 600px){
  #allPendingButtons { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

.pill-section-light {
  border-radius:16px;
  padding:12px;
  background:#e2d5ff;
  border:2px solid #7b3fe4;
}
.pill-section-light.muted-purple { background:#d8c8f2; }
.pill-section-light.pink { background:#fbe9f2; border-color:#b300ff; }
.pill-section-light.orange { background:#fce0c1; border-color:#f59e0b; }

.pill-section-header-lg { text-align:center; margin-bottom:12px; }
.pill-badge-lg {
  display:inline-block;
  padding:8px 18px;
  border-radius:999px;
  background:#7b3fe4;
  border:3px solid #4b2bb3;
  font-weight:900;
  font-size:22px;
  color:#fff;
}
.pill-badge-lg.pink { background:#b300ff; border-color:#7b3fe4; }
.pill-badge-lg.yellow { background:#ffe34d; border-color:#b59a12; color:#000; }

.pill-grid-6 { display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:10px; align-items:stretch; }
.pill-grid-5 { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:10px; align-items:stretch; }
.pill-grid-5-narrow { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:10px; }

/* On mobile, show admin dashboard pill grids in 2 columns */
@media (max-width: 600px){
  .pill-grid-4,
  .pill-grid-5,
  .pill-grid-5-narrow,
  .pill-grid-6 { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

.mt-10 { margin-top:10px; }
.mt-12 { margin-top:12px; }
.mt-14 { margin-top:14px; }
.mt-16 { margin-top:16px; }
.mt-24 { margin-top:24px; }

.mb-16 { margin-bottom:16px; }
.mt-0 { margin-top:0; }

/* Actions row variants */
.actions.inline-gap { gap:8px; align-items:center; }

/* Generic larger margin utility */
.mt-48 { margin-top:48px; }

/* User fund transfer + history helpers */
.balance-info { margin-bottom:8px; font-weight:700; }
.inline-msg { margin-left:8px; }
.card-wide { max-width:560px; width:100%; }
.ft-history-header { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.ft-filter { margin-left:auto; display:flex; gap:6px; align-items:center; }
.table-scroll { overflow:auto; margin-top:10px; }
.table-wide-900 { min-width:900px; }

/* User dashboard – complain section layout */
.complain-card {
  max-width:720px;
  width:100%;
  display:none;
}

.btn-pill-yellow {
  background:#ffe34d;
  color:#000;
  font-weight:900;
  border-radius:12px;
  padding:10px 12px;
  min-height:60px;
}
.btn-pill-yellow.nowrap { white-space:nowrap; }

.flex-row-stretch { display:flex; gap:10px; align-items:stretch; }
.flex-1 { flex:1; }
.flex-center { display:flex; align-items:stretch; }

/* Admin dashboard – company fund panel */
.company-fund-card {
  border:2px solid #1f2937;
  border-radius:12px;
  padding:12px;
  background:#fdebd2;
}
.company-fund-title {
  text-align:center;
  font-weight:900;
  font-size:20px;
  color:#0b1020;
  background:#ffe34d;
  border:2px solid #b59a12;
  border-radius:999px;
  padding:8px 12px;
  display:inline-block;
  margin:0 auto 12px;
}
.company-fund-actions { margin-top:14px; text-align:center; }
.btn-fund-transfer {
  font-weight:900;
  font-size:18px;
  border-radius:999px;
  background:#ff2d2d;
  border-color:#cc2424;
}

.rank-banner {
  text-align:center;
  font-weight:900;
  font-size:20px;
  color:#0b1020;
  background:#ffe34d;
  border:2px solid #b59a12;
  border-radius:999px;
  padding:8px 12px;
  display:inline-block;
  margin:8px auto 12px;
}
.rank-buttons-grid { grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap:10px; }
.rank-tables-wrap { margin-top:12px; }

/* Company Fund Management buttons grid */
#cfmButtons {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 14px;
}
@media (max-width: 1100px){ #cfmButtons { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 600px){ #cfmButtons { grid-template-columns: repeat(2, minmax(0,1fr)); } }
#cfmButtons button {
  display: grid;
  place-items: center;
  padding: 18px;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  font-weight: 800;
  border-width: 2px;
  min-height: 92px;
}

/* ===== Mobile-first & Responsive Enhancements ===== */
/* Safe area support for notched devices */
:root { --safe-top: env(safe-area-inset-top); --safe-bottom: env(safe-area-inset-bottom); }
.topbar { padding-top: calc(12px + var(--safe-top)); }

/* Media defaults for small screens */
@media (max-width: 480px){
  body { font-size: 14px; }
  .container { padding: 12px; }
  .card { padding: 14px; border-radius: 12px; max-width: 100%; }
  .page-title { font-size: 18px; }
  .btn { padding: 10px 14px; font-weight: 600; }
  input { padding: 10px 12px; }
  .tiles { padding: 8px 6px; gap: 8px; margin: 0; }
  .tile { padding: 10px; font-size: 16px; }
  .header-banner { margin: 8px; padding: 10px; }
}

/* Password show/hide controls */
.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.password-wrapper input {
  padding-right: 40px;
}
.toggle-password {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  padding: 0 4px;
}

/* Images and media scale down on mobile */
img, svg { max-width: 100%; height: auto; }

/* Responsive tables: horizontal scroll on narrow screens */
@media (max-width: 768px){
  table { display: block; width: 100%; overflow-x: auto; }
  .table-bordered th, .table-bordered td { white-space: nowrap; }
}

/* Desktop-wide tweaks */
@media (min-width: 1200px){
  .container.narrow { max-width: 1160px; }
  .card { max-width: 720px; }
}
