/* ============================================================
   dayo — Global Styles
   Dark theme: black / zinc-gray / orange
   ============================================================ */

/* ---------- Google Font (Inter — same family GitHub now uses) ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ---------- CSS Variables ---------- */
:root {
  --bg:          #0a0a0a;
  --bg-card:     #111111;
  --bg-elevated: #191919;
  --bg-input:    #0f0f0f;

  --border:      #222222;
  --border-md:   #2d2d2d;
  --border-hi:   #3a3a3a;

  --text:        #f0f0f0;
  --text-2:      #a0a0a0;
  --text-3:      #606060;
  --text-4:      #404040;

  --orange:      #f97316;
  --orange-dim:  #ea580c;
  --orange-glow: rgba(249, 115, 22, 0.12);
  --orange-glow-strong: rgba(249, 115, 22, 0.25);

  --green:       #22c55e;
  --green-dim:   rgba(34, 197, 94, 0.15);
  --blue-dim:    rgba(59, 130, 246, 0.15);
  --red-dim:     rgba(239, 68, 68, 0.15);
  --amber-dim:   rgba(245, 158, 11, 0.15);

  --radius:      14px;
  --radius-sm:   8px;
  --radius-lg:   18px;

  --ease:        cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --t-fast:      120ms;
  --t-mid:       200ms;
  --t-slow:      350ms;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans',
               Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* ---------- Custom Scrollbar ---------- */
::-webkit-scrollbar          { width: 6px; height: 6px; }
::-webkit-scrollbar-track    { background: var(--bg); }
::-webkit-scrollbar-thumb    { background: var(--border-md); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hi); }

/* ---------- Selection ---------- */
::selection { background: var(--orange-glow-strong); color: var(--text); }

/* ============================================================
   NAVIGATION
   ============================================================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* Logo */
.nav-logo {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--orange);
  text-decoration: none;
  transition: opacity var(--t-fast) var(--ease);
  margin-right: 0;
}
.nav-logo:hover { opacity: 0.8; }

/* Nav links wrapper */
.nav-links {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Nav link */
.nav-link {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  transition: color var(--t-fast) var(--ease),
              background var(--t-fast) var(--ease);
  white-space: nowrap;
}
.nav-link:hover {
  color: var(--text);
  background: rgba(255,255,255,0.06);
}
.nav-link.active {
  color: #f97316;
  background: rgba(249,115,22,0.12);
}

/* Nav divider */
.nav-sep {
  width: 1px;
  height: 18px;
  background: var(--border-md);
  margin: 0 4px;
}

/* Username label */
.nav-username {
  font-size: 12px;
  color: var(--text-3);
  padding: 0 8px;
}

/* Wallet nav button */
.nav-wallet {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--orange);
  border: 1px solid rgba(249,115,22,0.35);
  background: var(--orange-glow);
  text-decoration: none;
  transition: background var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease);
  white-space: nowrap;
}
.nav-wallet:hover,
.nav-wallet.active {
  background: var(--orange-glow-strong);
  border-color: rgba(249,115,22,0.6);
  color: var(--orange);
}

/* Notification bell */
.nav-bell {
  position: relative;
  display: flex;
  align-items: center;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  text-decoration: none;
  transition: color var(--t-fast) var(--ease),
              background var(--t-fast) var(--ease);
}
.nav-bell:hover {
  color: var(--text);
  background: rgba(255,255,255,0.06);
}
.nav-bell-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--orange);
  border: 2px solid var(--bg);
}

/* Logout link */
.nav-logout {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3);
  text-decoration: none;
  transition: color var(--t-fast) var(--ease),
              background var(--t-fast) var(--ease);
}
.nav-logout:hover {
  color: #f87171;
  background: rgba(239, 68, 68, 0.08);
}

/* Username / profile link */
.nav-profile {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3);
  text-decoration: none;
  transition: color var(--t-fast) var(--ease),
              background var(--t-fast) var(--ease);
}
.nav-profile:hover {
  color: #f97316;
  background: rgba(249, 115, 22, 0.08);
}

/* ============================================================
   MAIN LAYOUT
   ============================================================ */
.main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 36px 20px;
}

/* ============================================================
   FLASH MESSAGES
   ============================================================ */
.flash-wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 20px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.flash {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid;
  font-size: 13px;
  animation: flashIn var(--t-mid) var(--ease) both;
}

@keyframes flashIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.flash-error   { background: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.25); color: #fca5a5; }
.flash-success { background: rgba(34,197,94,0.08);  border-color: rgba(34,197,94,0.25);  color: #86efac; }
.flash-warning { background: rgba(245,158,11,0.08); border-color: rgba(245,158,11,0.25); color: #fcd34d; }
.flash-info    { background: rgba(255,255,255,0.04); border-color: var(--border-md); color: var(--text-2); }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--t-mid) var(--ease),
              box-shadow var(--t-mid) var(--ease),
              transform var(--t-mid) var(--ease);
}

.card-hover:hover {
  border-color: var(--border-hi);
  box-shadow: 0 0 0 1px var(--border-hi),
              0 8px 24px rgba(0,0,0,0.4);
  transform: translateY(-2px);
}

.card-orange:hover {
  border-color: rgba(249,115,22,0.4);
  box-shadow: 0 0 0 1px rgba(249,115,22,0.2),
              0 8px 24px rgba(249,115,22,0.08);
}

.card-inner {
  padding: 20px;
}

.card-elevated {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
.page-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
  line-height: 1.25;
}

.page-sub {
  font-size: 14px;
  color: var(--text-2);
  margin-top: 4px;
}

.section-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.25px;
  color: var(--text);
}

.label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}

.mono {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease),
              transform var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease),
              opacity var(--t-fast) var(--ease);
  -webkit-user-select: none;
  user-select: none;
}

.btn:active { transform: scale(0.975); }

/* Primary — orange */
.btn-primary {
  background: var(--orange);
  color: #000;
}
.btn-primary:hover {
  background: #fb923c;
  box-shadow: 0 0 16px var(--orange-glow-strong);
}

/* Secondary — subtle gray */
.btn-secondary {
  background: var(--bg-elevated);
  border: 1px solid var(--border-md);
  color: var(--text-2);
}
.btn-secondary:hover {
  background: rgba(255,255,255,0.07);
  color: var(--text);
  border-color: var(--border-hi);
}

/* Danger */
.btn-danger {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.25);
  color: #f87171;
}
.btn-danger:hover {
  background: rgba(239,68,68,0.2);
  border-color: rgba(239,68,68,0.4);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-md);
  color: var(--text-2);
}
.btn-ghost:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text);
}

/* Full width */
.btn-full { width: 100%; }

/* Small */
.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.input,
.select,
.textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease);
  appearance: none;
  -webkit-appearance: none;
}

.input::placeholder, .textarea::placeholder {
  color: var(--text-4);
}

.input:focus, .select:focus, .textarea:focus {
  border-color: rgba(249,115,22,0.5);
  box-shadow: 0 0 0 3px var(--orange-glow);
}

.select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23606060' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.select option {
  background: var(--bg-card);
  color: var(--text);
}

.textarea { resize: vertical; min-height: 80px; }

.input-prefix-wrap { position: relative; }
.input-prefix {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  font-size: 13px;
  pointer-events: none;
  user-select: none;
}
.input-prefix + .input { padding-left: 26px; }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

.form-hint {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 4px;
}

/* Checkbox */
.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--orange);
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid;
  white-space: nowrap;
}

.badge-gray    { background: rgba(255,255,255,0.05); border-color: var(--border-md); color: var(--text-2); }
.badge-orange  { background: rgba(249,115,22,0.1);  border-color: rgba(249,115,22,0.3);  color: #fb923c; }
.badge-green   { background: rgba(34,197,94,0.1);   border-color: rgba(34,197,94,0.3);   color: #4ade80; }
.badge-blue    { background: rgba(59,130,246,0.1);  border-color: rgba(59,130,246,0.3);  color: #60a5fa; }
.badge-red     { background: rgba(239,68,68,0.1);   border-color: rgba(239,68,68,0.3);   color: #f87171; }
.badge-amber   { background: rgba(245,158,11,0.1);  border-color: rgba(245,158,11,0.3);  color: #fbbf24; }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

table { width: 100%; border-collapse: collapse; font-size: 13px; }

thead { background: rgba(0,0,0,0.3); }
thead th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
}

tbody tr {
  border-top: 1px solid var(--border);
  transition: background var(--t-fast) var(--ease);
}
tbody tr:first-child { border-top: none; }
tbody tr:hover { background: rgba(255,255,255,0.02); }

td { padding: 12px 16px; color: var(--text-2); vertical-align: middle; }

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress-track {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--orange-dim), var(--orange));
  transition: width var(--t-slow) var(--ease);
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color var(--t-mid) var(--ease);
}
.stat-card:hover { border-color: var(--border-md); }

.stat-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1;
  color: var(--text);
}
.stat-value-orange { color: var(--orange); }
.stat-value-green  { color: #4ade80; }
.stat-value-blue   { color: #60a5fa; }

/* ============================================================
   AUTH PAGES
   ============================================================ */
.auth-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 100px);
  padding: 40px 20px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
}

.auth-logo-area {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--orange);
}

.auth-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--text);
  margin-bottom: 24px;
}

/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2vw;
  margin-bottom: 20px;
}

/* ============================================================
   NUMBER INPUT — hide spinners
   ============================================================ */
input[type=number].no-spinner::-webkit-outer-spin-button,
input[type=number].no-spinner::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number].no-spinner { -moz-appearance: textfield; }

/* ============================================================
   RANGE SLIDER
   ============================================================ */
input[type=range].price-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--border-hi);
  outline: none;
  cursor: pointer;
}
input[type=range].price-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--orange);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--orange);
  cursor: pointer;
  transition: box-shadow var(--t-fast);
}
input[type=range].price-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--orange);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--orange);
  cursor: pointer;
}
input[type=range].price-slider:focus::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px var(--orange-glow);
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
  animation: backdropIn var(--t-mid) var(--ease) both;
}

@keyframes backdropIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-box {
  width: 100%;
  max-width: 880px;
  background: var(--bg-card);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  animation: modalIn var(--t-mid) var(--ease-bounce) both;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ============================================================
   STATUS TABS
   ============================================================ */
.status-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.status-tab {
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--border-md);
  color: var(--text-2);
  transition: color var(--t-fast) var(--ease),
              background var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease);
}

.status-tab:hover {
  color: var(--text);
  border-color: var(--border-hi);
  background: rgba(255,255,255,0.04);
}

.status-tab.active {
  background: var(--orange);
  border-color: var(--orange);
  color: #000;
  font-weight: 600;
}

/* ============================================================
   AVATAR
   ============================================================ */
.avatar {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--orange-dim), var(--orange));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #000;
  flex-shrink: 0;
  user-select: none;
}

/* ============================================================
   OFFER CARDS
   ============================================================ */
.offer-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  transition: border-color var(--t-mid) var(--ease),
              box-shadow var(--t-mid) var(--ease),
              transform var(--t-mid) var(--ease);
}

.offer-card:hover {
  border-color: var(--border-hi);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  transform: translateY(-1px);
}

/* ============================================================
   TRACKING LINK BOX
   ============================================================ */
.tracking-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
}

/* ============================================================
   HTMX Indicators
   ============================================================ */
[x-cloak] { display: none !important; }
.htmx-indicator { opacity: 0; transition: opacity var(--t-mid); }
.htmx-request .htmx-indicator { opacity: 1; }

/* ============================================================
   RESPONSIVE LAYOUT HELPERS
   ============================================================ */

/* Stats grid: 2-up on ≥480px, 1-up below */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
  gap: 14px;
}

/* Desktop: unwrap grouping divs so children participate in parent grid */
.stat-earned-row,
.stat-offers-row {
  display: contents;
}

/* Desktop: hide duplicate button — original sits in welcome header */
.stat-top-btn { display: none; }

/* Profile two-column layout */
.profile-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  width: 100%;
  align-items: flex-start;
}
.profile-col-left  { flex: 1 1 360px; min-width: 0; }
.profile-col-right { flex: 1 1 300px; min-width: 0; }

/* Price range inputs in filter bars */
.price-input-wrap {
  min-width: 80px;
  flex: 1;
  max-width: 130px;
}

/* Page header row: title left, actions right, stacks on mobile */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

/* ============================================================
   RESPONSIVE — 1024px
   ============================================================ */
@media (max-width: 1024px) {
  .main { padding: 28px 16px; }
}

/* ============================================================
   RESPONSIVE — 768px
   ============================================================ */
@media (max-width: 768px) {
  .main { padding: 20px 14px; }

  /* Nav: allow horizontal scroll so all links stay accessible */
  .nav { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-inner { min-width: max-content; padding: 0 14px; gap: 8px; }
  .nav-link  { padding: 6px 10px; font-size: 12px; }
  .nav-username { display: none; }
  .nav-sep { display: none; }

  /* Auth card */
  .auth-card { padding: 28px 20px; }

  /* Modal box */
  .modal-box { max-height: 95vh; border-radius: var(--radius); }

  /* Wallet */
  .wallet-wrap { flex-direction: column; }
  .balance-amount { font-size: 40px; }
  .wallet-right { min-width: 0; }

  /* Filter bar padding */
  .filter-bar { padding: 14px; }
}

/* ============================================================
   RESPONSIVE — 640px
   ============================================================ */
@media (max-width: 640px) {
  .page-title { font-size: 22px; }
  .stat-value  { font-size: 24px; }

  /* Auth card */
  .auth-card { padding: 24px 16px; }

  /* Table cells get min width so content doesn't crush */
  td, th { white-space: nowrap; }

  /* Hide TOP Affiliates from welcome header — shown in stats row instead */
  .welcome-top-btn { display: none; }

  /* Stats grid: single column, sub-rows span full width */
  .stats-grid { grid-template-columns: 1fr; }

  /* Total Earned + TOP Affiliates button side by side */
  .stat-earned-row {
    display: flex;
    align-items: center;
    gap: 12px;
    grid-column: 1 / -1;
  }
  .stat-earned-row .stat-card { flex: 1; }
  .stat-top-btn {
    display: block;
    flex-shrink: 0;
    white-space: nowrap;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
  }

  /* My Offers / Public / Private in one row */
  .stat-offers-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    grid-column: 1 / -1;
  }
  .stat-offers-row .stat-card { padding: 14px 10px; }
  .stat-offers-row .stat-label { font-size: 9px; }
  .stat-offers-row .stat-value { font-size: 20px; }
}

/* ============================================================
   RESPONSIVE — 480px
   ============================================================ */
@media (max-width: 480px) {
  .main { padding: 16px 12px; }

  .page-title { font-size: 20px; }

  /* Nav: tighter — only applies when hamburger NOT active (> 640px)
     At <= 640px the hamburger overrides these via the block below */
  .nav-inner { padding: 0 10px; gap: 4px; }
  .nav-link  { padding: 5px 7px; font-size: 11px; }
  .nav-logo  { font-size: 16px; }
  .nav-wallet { padding: 5px 8px; font-size: 11px; }
  .nav-logout  { padding: 5px 8px; font-size: 11px; }
  .nav-profile { padding: 5px 8px; font-size: 11px; }

  /* Cards */
  .card-inner { padding: 14px; }

  /* Buttons: allow wrap in flex rows */
  .btn { white-space: normal; text-align: center; }

  /* Filter bar */
  .filter-bar { padding: 10px; }

  /* Status tabs */
  .status-tabs { gap: 4px; }
  .status-tab  { padding: 6px 12px; font-size: 12px; }

  /* Page header: stack on very small screens */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ============================================================
   NAVIGATION — COLLAPSE WRAPPER & HAMBURGER
   These classes are added to base.html for the mobile menu.
   ============================================================ */

/* Desktop: nav-collapse is an inline flex row */
.nav-collapse {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 0;
  justify-content: space-between;
  min-width: 0;
  overflow: visible;
}

/* Hamburger button (hidden on desktop) */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 8px 7px;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  transition: background var(--t-fast) var(--ease);
}
.nav-hamburger:hover { background: rgba(255,255,255,0.06); }
.nav-hamburger-line {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-2);
  border-radius: 1px;
  transition: transform var(--t-mid) var(--ease),
              opacity   var(--t-mid) var(--ease);
}
.nav-hamburger.open .nav-hamburger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-hamburger.open .nav-hamburger-line:nth-child(2) {
  opacity: 0;
}
.nav-hamburger.open .nav-hamburger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ============================================================
   RESPONSIVE — 640px
   Activates the hamburger menu, overriding the 768px nav scroll.
   ============================================================ */
@media (max-width: 640px) {
  /* Disable horizontal nav scroll — hamburger takes over */
  .nav { overflow-x: visible; }

  .nav-inner {
    min-width: unset;
    padding: 0 14px;
    gap: 0;
    justify-content: space-between;
  }
  .nav-logo { font-size: 18px; }

  /* Show hamburger */
  .nav-hamburger { display: flex; }

  /* Collapse → fixed dropdown drawer */
  .nav-collapse {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    z-index: 39;
    background: rgba(10, 10, 10, 0.97);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 8px 0 20px;
    max-height: calc(100vh - 56px);
    overflow-y: auto;
    /* Closed state */
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity var(--t-mid) var(--ease),
                transform var(--t-mid) var(--ease);
  }
  .nav-collapse.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  /* Nav link groups inside drawer */
  .nav-collapse .nav-links {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 0 10px;
    width: 100%;
    flex-shrink: 0;
  }
  .nav-collapse .nav-link {
    padding: 11px 14px;
    font-size: 14px;
    white-space: normal;
    border-radius: var(--radius-sm);
  }
  .nav-collapse .nav-logout,
  .nav-collapse .nav-profile {
    padding: 11px 14px;
    font-size: 14px;
    border-radius: var(--radius-sm);
  }
  .nav-collapse .nav-wallet {
    display: flex;
    padding: 11px 14px;
    font-size: 13px;
    justify-content: flex-start;
    background: transparent;
    border: none;
    color: var(--orange);
    gap: 8px;
    border-radius: var(--radius-sm);
  }
  .nav-collapse .nav-wallet:hover {
    background: var(--orange-glow);
    border-color: transparent;
  }
  .nav-collapse .nav-bell {
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    justify-content: flex-start;
  }
  /* Add "Notifications" label after the bell icon in the drawer */
  .nav-collapse .nav-bell::after {
    content: 'Notifications';
    font-size: 14px;
    font-weight: 500;
    color: var(--text-2);
    margin-left: 10px;
  }
  .nav-collapse .nav-sep {
    display: block;
    width: auto;
    height: 1px;
    background: var(--border);
    margin: 8px 10px;
    flex-shrink: 0;
  }
  .nav-collapse .nav-username {
    display: block;
    padding: 8px 14px;
    font-size: 13px;
  }

  /* Filter bar row: wrap on small screens */
  .filter-bar { padding: 12px; }
}

/* ============================================================
   FOOTER — RESPONSIVE CLASSES
   Used by _footer.html instead of inline grid styles.
   ============================================================ */
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}
.footer-legal {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  text-align: right;
}

@media (max-width: 640px) {
  .footer-inner {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px 16px;
  }
  .footer-legal {
    align-items: flex-start;
    text-align: left;
  }
}

/* ============================================================
   WALLET PAGE — mobile fixes
   ============================================================ */
@media (max-width: 768px) {
  /* Remove double-padding: .main already provides horizontal spacing */
  .wallet-wrap { padding: 0; }
  .wallet-right { width: 100%; min-width: 0; }
}

/* ============================================================
   GENERAL MOBILE IMPROVEMENTS
   ============================================================ */

/* Prevent offers row from overflowing on very narrow phones */
@media (max-width: 360px) {
  .stat-offers-row .stat-label { font-size: 8px; letter-spacing: 0; }
  .stat-offers-row .stat-value { font-size: 17px; }
  .stat-offers-row .stat-card { padding: 12px 6px; }
}

/* Ensure modal is fully usable on phones */
@media (max-width: 480px) {
  .modal-backdrop { padding: 8px; align-items: flex-end; }
  .modal-box { border-radius: var(--radius) var(--radius) 0 0; max-height: 92vh; }
}

/* Table: horizontal scroll with visual hint shadow */
@media (max-width: 640px) {
  .table-wrap {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
}

/* Profile charts: constrain on mobile */
@media (max-width: 640px) {
  .profile-col-right { flex: 1 1 100%; }
}
