/* =========================================================
   DataSpot GH — Unified Style Sheet (Clean + Mobile-Accurate)
   Fixes included:
   ✅ Real phone matches Inspect better (text autosize off)
   ✅ Pills/buttons wrap to 2 lines (no overflow on long refs)
   ✅ Prevent horizontal overflow site-wide on mobile
   ✅ Chart scrolls inside card (page never widens)  ✅ FIXED
   ✅ Bottom nav safe + page spacing preserved
   ✅ Wallet pill always visible on PC (scroll row) ✅ FIXED
========================================================= */

/* -------------------------
   Reset / Base
------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }

/* ✅ IMPORTANT: stop mobile browsers from auto-resizing text (matches Inspect) */
html{
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

img, video { max-width: 100%; height: auto; display: block; }
table { max-width: 100%; }

:root{
  --blue:#0b4aa2;
  --blue2:#004080;
  --text:#0f172a;
  --muted:#60708a;
  --bg:#f6f8fc;
  --card:#ffffff;
  --line:#eef3ff;
  --line2:#e6eef8;

  --good:#1e6b35;
  --goodBg:#eaf7ee;
  --goodLine:#bde5c8;

  --bad:#8a1f1f;
  --badBg:#fdecec;
  --badLine:#f3b7b7;

  --warn:#0b4aa2;
  --warnBg:#e9f1ff;
  --warnLine:#cfe0ff;

  --shadow: 0 8px 18px rgba(2,23,58,.06);
  --shadow2: 0 18px 50px rgba(2,23,58,.14);
  --radius: 16px;
}

body{
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  line-height: 1.45;
  background: var(--bg);
  color: var(--text);
}

a{ color: inherit; }
.muted{ color: var(--muted); font-weight: 800; font-size: 12px; }

/* -------------------------
   Buttons (generic)
------------------------- */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 900;
  text-decoration:none;
  cursor:pointer;
  white-space: nowrap; /* desktop default */
}

.btn.primary{
  background: var(--blue);
  border-color: var(--blue);
  color:#fff;
}

.btn.outline{
  background:#fff;
  border-color: var(--warnLine);
  color: var(--blue);
}

.btn.outline:hover{ background:#f3f7ff; }

/* ✅ mini buttons used in store tables */
.btn-mini{
  padding:8px 10px;
  border-radius:10px;
  border:1px solid var(--warnLine);
  background:#fff;
  color: var(--blue);
  font-weight:900;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  white-space: nowrap; /* desktop default */
  max-width: 100%;
}
.btn-mini.primary{ background: var(--blue); border-color: var(--blue); color:#fff; }
.btn-mini.danger{ border-color: var(--badLine); color: var(--bad); background:#fff; }
.btn-mini.good{ border-color: var(--goodLine); color: var(--good); background: var(--goodBg); }

/* -------------------------
   Alerts / Toasts
------------------------- */
.alert{
  padding: 12px 14px;
  border-radius: 12px;
  margin: 12px 0;
  font-weight: 900;
  border: 1px solid transparent;
}
.alert.success{ background: var(--goodBg); border-color: var(--goodLine); color: var(--good); }
.alert.error{ background: var(--badBg); border-color: var(--badLine); color: var(--bad); }

.toast{
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 9999;
  padding: 12px 14px;
  border-radius: 14px;
  font-weight: 900;
  box-shadow: 0 12px 30px rgba(2,23,58,.18);
  border: 1px solid transparent;
  max-width: 360px;
}
.toast.success{ background: var(--goodBg); border-color: var(--goodLine); color: var(--good); }
.toast.error{ background: var(--badBg); border-color: var(--badLine); color: var(--bad); }

/* =========================================================
   AUTH (Login / Signup)
========================================================= */
.auth-container{
  width: min(520px, calc(100% - 32px));
  margin: 48px auto;
  background: #fff;
  border: 1px solid #e7eef9;
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 12px 32px rgba(2, 23, 58, 0.08);
}

.auth-container h2{
  margin: 0 0 14px;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}

.auth-container form{
  display: grid;
  gap: 12px;
  margin: 8px 0 10px;
}

.auth-container input{
  width: 100%;
  padding: 12px 14px;
  border-radius: 999px;
  border: 1px solid #d7e3f7;
  background: #f8fbff;
  outline: none;
  font-size: 1rem;
}

.auth-container input:focus{
  border-color: #6ea8ff;
  box-shadow: 0 0 0 4px rgba(110, 168, 255, 0.22);
  background: #ffffff;
}

.auth-container button{
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  background: var(--blue);
  color: #fff;
  box-shadow: 0 10px 22px rgba(11, 74, 162, 0.22);
}

.auth-container button:hover{ filter: brightness(0.96); }

.auth-container .error,
.auth-container .success{
  margin: 10px 0 14px;
  padding: 10px 12px;
  border-radius: 999px;
  font-size: 0.95rem;
  border: 1px solid transparent;
  font-weight: 900;
  text-align: center;
}
.auth-container .error{
  background: #fff1f2;
  border-color: #fecdd3;
  color: #9f1239;
}
.auth-container .success{
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: #166534;
}

.auth-container p{
  margin: 10px 0 0;
  font-size: 0.95rem;
  color: #475569;
}
.auth-container a{
  color: var(--blue);
  text-decoration: none;
  font-weight: 800;
}
.auth-container a:hover{ text-decoration: underline; }

@media (max-width: 480px){
  .auth-container{ margin: 22px auto; padding: 18px; border-radius: 16px; }
}

/* =========================================================
   DASHBOARD TOP NAV (dash-topnav)
========================================================= */
.dash-topnav{
  position: sticky;
  top: 0;
  z-index: 50;
  background: #fff;
  border-bottom: 1px solid var(--line2);
}

.dash-wrap{
  max-width: 1140px;
  margin: 0 auto;
  padding: 14px 18px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.dash-brand{
  display:flex;
  align-items:center;
  gap: 10px;
  text-decoration:none;
  color:#0b3b7a;
  min-width: 0;
}

.dash-brand strong{
  display:block;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.1;
}
.dash-brand small{
  display:block;
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
  margin-top: 2px;
}

.dash-mark{
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background:#e9f1ff;
  position:relative;
  overflow:hidden;
  flex: 0 0 34px;
}
.dash-mark::before{
  content:"";
  width:8px;height:18px;background:var(--blue);
  border-radius:3px;
  position:absolute;left:8px;bottom:8px;
  box-shadow: 10px -4px 0 rgba(11,74,162,.75), 20px -10px 0 rgba(11,74,162,.45);
}

/* ✅ FIX: Keep pills visible on PC (no “disappearing” wallet pill) */
.dash-right{
  display:flex;
  gap: 10px;
  align-items:center;
  justify-content:flex-end;

  flex-wrap: nowrap;            /* ✅ no weird wrapping on desktop */
  overflow-x: auto;             /* ✅ scroll if not enough space */
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}
.dash-right::-webkit-scrollbar{ height: 6px; }
.dash-right::-webkit-scrollbar-thumb{ background: rgba(0,0,0,.12); border-radius: 999px; }

/* ✅ Pills */
.dash-pill{
  flex: 0 0 auto;               /* ✅ never shrink away */
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 900;
  font-size: 13px;
  border: 1px solid transparent;

  white-space: normal;
  flex-wrap: wrap;
  line-height: 1.15;
  text-align: center;
  max-width: 100%;
}
.dash-pill.wallet-pill{
  background: var(--goodBg);
  border-color: var(--goodLine);
  color: var(--good);
}
.dash-pill.outline{
  background:#fff;
  border-color: var(--warnLine);
  color: var(--blue);
  text-decoration:none;
}
.dash-pill.outline:hover{ background:#f3f7ff; }

/* ✅ long content inside pills must never push width */
.dash-pill strong{
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* =========================================================
   PAGE LAYOUT + PANELS
========================================================= */
.page-wrap{
  max-width: 1140px;
  margin: 18px auto 90px;
  padding: 0 18px;
}

.panel{
  background:#fff;
  border:1px solid var(--line);
  border-radius: var(--radius);
  padding:16px;
  box-shadow: var(--shadow);
}

.page-head h1{
  margin: 0 0 6px;
  color:#132d52;
  font-size: 22px;
  font-weight: 900;
}
.page-head p{
  margin: 0;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}

/* =========================================================
   GRIDS (summary, cards)
========================================================= */
.sum-grid{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 10px;
}
.sum-card{
  background:#fff;
  border:1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.sum-card span{
  display:block;
  color: var(--muted);
  font-weight: 900;
  font-size: 12px;
  margin-bottom: 6px;
}
.sum-card strong{
  font-size: 20px;
  color:#132d52;
  font-weight: 900;
}
.sum-card.good strong{ color: var(--good); }
.sum-card.warn strong{ color: var(--blue); }

/* =========================================================
   FORMS (profile + filters)
========================================================= */
.form label{
  display:block;
  margin: 10px 0 6px;
  font-weight: 900;
  color:#132d52;
}
.form input[type="text"],
.form input[type="number"],
.form input[type="date"],
.form input[type="file"],
.form select,
.filters input,
.filters select,
textarea{
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #e5e5e5;
  outline: none;
  font-weight: 800;
  background:#fff;
}

.form input:focus,
.filters input:focus,
.filters select:focus,
textarea:focus{
  border-color:#6ea8ff;
  box-shadow: 0 0 0 4px rgba(110, 168, 255, 0.22);
}

.hint{
  display:block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 8px;
  font-weight: 800;
}

/* filters bar used in history pages */
.filters{
  margin-top: 12px;
  background:#fff;
  border:1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  display:flex;
  gap: 10px;
  align-items:flex-end;
  flex-wrap:wrap;
  justify-content:space-between;
}
.filters .group{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:flex-end;
}
.filters label{
  display:block;
  font-weight: 900;
  font-size: 12px;
  color:#132d52;
  margin-bottom: 6px;
}
.filters .btn{
  padding: 12px 14px;
  border-radius: 12px;
  border:1px solid var(--warnLine);
  background:#fff;
  color: var(--blue);
  font-weight: 900;
  cursor:pointer;
  text-decoration:none;
  white-space: nowrap;
}
.filters .btn.primary{
  background: var(--blue);
  border-color: var(--blue);
  color:#fff;
}

/* =========================================================
   TABLES (Desktop + Mobile safe)
========================================================= */
.table-wrap{
  width:100%;
  overflow-x:auto;
  -webkit-overflow-scrolling: touch;
  border:1px solid var(--line);
  border-radius: var(--radius);
  background:#fff;
}

table{
  width:100%;
  border-collapse: collapse;
  min-width: 760px;
}

th, td{
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align:center;
  vertical-align: middle;
}

th{
  background:#f3f7ff;
  color:#132d52;
  font-weight: 900;
}

tr:hover{ background:#f8fbff; }

/* badges/tags */
.badge{
  display:inline-block;
  padding:6px 10px;
  border-radius:999px;
  font-weight: 900;
  font-size: 12px;
  border:1px solid transparent;
  white-space: nowrap;
}
.badge.good{ background: var(--goodBg); border-color: var(--goodLine); color: var(--good); }
.badge.warn{ background: var(--warnBg); border-color: var(--warnLine); color: var(--warn); }
.badge.bad { background: var(--badBg); border-color: var(--badLine); color: var(--bad); }
.badge.mut { background:#f1f5f9; border-color:#e2e8f0; color:#475569; }

.tag{
  display:inline-block;
  padding:6px 10px;
  border-radius:999px;
  font-weight:900;
  font-size:12px;
  background: var(--warnBg);
  border:1px solid var(--warnLine);
  color: var(--blue);

  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.15;
  text-align:center;
  max-width: 100%;
}

/* =========================================================
   PROFILE PAGE
========================================================= */
.profile-wrap{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}
.profile-card{
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  padding: 16px;
  border: 1px solid #f0f0f0;
}
.profile-card h2{
  margin: 0 0 12px;
  color: var(--blue2);
  font-size: 18px;
  font-weight: 900;
}

.profile-preview{
  display:flex;
  gap:14px;
  align-items:center;
}
.avatar{
  width: 80px;
  height: 80px;
  border-radius: 18px;
  overflow:hidden;
  background: #f1f5ff;
  display:flex;
  align-items:center;
  justify-content:center;
  flex: 0 0 80px;
}
.avatar img{ width:100%; height:100%; object-fit: cover; }
.avatar-fallback{ font-size: 30px; }

.profile-meta .big{
  font-size: 18px;
  font-weight: 900;
  color: var(--blue2);
}
.profile-actions{ margin-top: 10px; }

/* =========================================================
   STORE PAGE BRANDING (public store header)
========================================================= */
.store-header{
  max-width: 1100px;
  margin: 12px auto;
  padding: 14px;
}
.store-brand{
  display:flex;
  gap: 12px;
  align-items:center;
}
.store-logo{
  width: 58px;
  height: 58px;
  object-fit: cover;
  border-radius: 14px;
  background: #f1f5ff;
}
.store-logo-fallback{
  width: 58px;
  height: 58px;
  border-radius: 14px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:#f1f5ff;
  font-size: 22px;
}

/* =========================================================
   ✅ DASHBOARD CHART (GLOBAL FIX)
   Use this structure:
   <div class="dash-chart">
     <div class="dash-chart-scroll">
       <svg ...>...</svg>
     </div>
   </div>
========================================================= */
.dash-chart{
  width: 100%;
  max-width: 100%;
  overflow: visible; /* ✅ DO NOT CLIP */
}
.dash-chart-scroll{
  width: 100%;
  overflow-x: auto;                 /* ✅ swipe to view full chart */
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
}
.dash-chart svg{
  width: 700px;                     /* ✅ keep full chart width */
  max-width: none;
  height: auto;
  display:block;
}

/* =========================================================
   BLUE BOTTOM NAV (dashboard pages)
========================================================= */
.footer{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999;
  background: var(--blue);
  border-top: 1px solid rgba(255,255,255,.18);
  display:flex;
  justify-content:space-around;
  gap: 6px;
  padding: 10px 10px 12px;
  box-shadow: 0 -10px 30px rgba(2,23,58,.22);
}

.footer a{
  flex: 1;
  min-width: 0;
  text-decoration:none;
  color: rgba(255,255,255,.78);
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap: 4px;
  padding: 8px 6px;
  border-radius: 14px;
  font-weight: 900;
  font-size: 11px;
  line-height: 1;
  border: 1px solid transparent;
  transition: .15s ease;
}
.footer a .f-ico{ font-size: 16px; line-height: 1; }
.footer a:hover{ background: rgba(255,255,255,.08); }
.footer a.active{
  color:#fff;
  background: rgba(255,255,255,.14);
  border-color: rgba(255,255,255,.22);
}

/* center the bottom nav on wide screens */
@media (min-width: 920px){
  .footer{
    max-width: 560px;
    margin: 0 auto;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 18px 18px 0 0;
  }
}

/* =========================================================
   LANDING PAGE FOOTER (site-footer)
========================================================= */
.site-footer{
  background:#fff;
  border-top:1px solid var(--line2);
  padding:40px 0 18px;
  margin-top: 20px;
}

.site-footer .wrap{
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 18px;
}

.footer-grid{
  display:grid;
  grid-template-columns: 1.3fr 1fr 1fr 1fr;
  gap:24px;
}

.footer-col h4{
  margin:0 0 12px;
  color:#132d52;
  font-weight:900;
  font-size:16px;
}
.footer-col ul{ list-style:none; padding:0; margin:0; }
.footer-col li{ margin-bottom:10px; }
.footer-col a{
  text-decoration:none;
  color:#234a7d;
  font-weight:800;
}
.footer-col a:hover{ text-decoration:underline; }

.footer-text{
  margin-top:10px;
  color: var(--muted);
  line-height:1.6;
  font-size:14px;
  font-weight: 700;
}

.footer-muted{ color:#94a3b8; font-size:13px; font-weight: 700; }

.footer-brand{
  display:flex;
  align-items:center;
  gap:10px;
  font-size:18px;
  color:#0b3b7a;
}
.footer-logo{
  width:34px;height:34px;border-radius:10px;
  background:#e9f1ff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:18px;
}

.footer-bottom{
  margin-top:28px;
  padding-top:16px;
  border-top:1px solid var(--line2);
  text-align:center;
  color:#94a3b8;
  font-size:13px;
  font-weight: 700;
}

/* socials */
.footer-socials{
  margin-top: 12px;
  display:flex;
  gap: 10px;
}
.footer-socials a{ text-decoration:none; }
.soc{
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size: 18px;
  font-weight: 900;
  background: #f1f5ff;
  border: 1px solid #e3ecff;
  color: #1d3e6b;
  transition: transform .15s ease, box-shadow .15s ease;
}
.soc:hover{
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(2, 23, 58, .18);
}
.soc.ig{
  background: linear-gradient(135deg, #f58529, #dd2a7b, #8134af, #515bd4);
  color:#fff;
  border:none;
}

/* =========================================================
   RESPONSIVE (General)
========================================================= */
@media (max-width: 1000px){
  .sum-grid{ grid-template-columns: 1fr; }
  table{ min-width: 720px; }
}

@media (max-width: 900px){
  .profile-wrap{ grid-template-columns: 1fr; }
  .footer-grid{ grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px){
  .page-wrap{ padding: 0 12px; }
  .dash-wrap{ padding: 12px 12px; }
  .dash-pill{ padding: 8px 10px; border-radius: 10px; font-size: 12px; }
  .footer-grid{ grid-template-columns: 1fr; }
}

/* =========================================================
   SITE-WIDE MOBILE SAFETY
========================================================= */
@media (max-width: 640px){
  html, body{ overflow-x: hidden; width: 100%; }

  .panel, .sum-card, .profile-card, td, th, .badge, .tag, .dash-pill, .btn-mini{
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .btn{ white-space: normal; }
}

/* =========================================================
   DASHBOARD MOBILE LAYOUT
========================================================= */
@media (max-width: 768px) {

  html, body { width: 100%; overflow-x: hidden; }

  .dash-wrap{
    width: 100%;
    max-width: 100%;
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  .dash-topnav .dash-wrap{
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }

  .dash-brand{ width: 100%; }

  /* ✅ On mobile we want full-width stacked pills */
  .dash-right{
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    overflow: visible;     /* override desktop scroll row */
  }

  .dash-pill,
  .dash-pill.outline,
  .dash-right a.dash-pill,
  .dash-right button.dash-pill{
    width: 100%;
    max-width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;

    border-radius: 999px;
    flex-wrap: wrap;
    white-space: normal;
    line-height: 1.15;
    text-align: center;
  }

  .btn-mini{
    width: 100%;
    max-width: 100%;
    display: flex;
    justify-content: center;
    white-space: normal;
    flex-wrap: wrap;
    line-height: 1.15;
    text-align: center;
  }

  .footer{
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }
  .footer a{
    min-width: 0;
    padding: 8px 6px;
  }
  .footer a span{
    display: block;
    line-height: 1.1;
    font-size: 11px;
  }
  .footer .f-ico{
    font-size: 18px;
    margin-bottom: 2px;
  }
}

/* Extra-small phones */
@media (max-width: 420px){
  .sum-grid{ grid-template-columns: 1fr; }
}
/* =========================================================
   ✅ FORCE CHART SWIPE ON MOBILE (override global overflow-x hidden)
========================================================= */
.dash-chart{
  overflow: visible !important;
}

.dash-chart-scroll{
  overflow-x: auto !important;
  overflow-y: hidden !important;

  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;            /* allow horizontal swipe */
  overscroll-behavior-x: contain;

  max-width: 100%;
  padding-bottom: 6px;
}

.dash-chart-scroll svg{
  display: block;
  width: 700px !important;        /* wider than phone => scroll */
  max-width: none !important;
}
