:root{
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: "Plus Jakarta Sans", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;

  /* ===== Trade-Int inspired brand ===== */
  --twx-primary: #1d4ed8;      /* blue-700-ish */
  --twx-primary-dark: #1e40af; /* blue-800-ish */
  --twx-primary-soft: rgba(29,78,216,.14);
  --twx-slate: #0f172a;

  --page-bg: #f8fafc;
  --card-radius: 16px;
  --frame-radius: 14px;

  /* navbar is sticky-top → offset sticky table header */
  --sticky-header-top: 58px;
}

html, body{ height: 100%; }

body{
  font-family: var(--sans);
}

body.bg-white{
  background: var(--page-bg) !important;
}

.app-container{
  max-width: 1600px;
  margin-left: auto;
  margin-right: auto;
}

.mono{ font-family: var(--mono); font-variant-numeric: tabular-nums; }

.fw-black{ font-weight: 900 !important; }

.brand-dot{
  width:10px;height:10px;border-radius:50%;
  background: var(--twx-primary);
  box-shadow: 0 0 0 4px var(--twx-primary-soft);
}

/* Navbar polish */
.navbar{
  box-shadow: 0 1px 0 rgba(15,23,42,.06), 0 8px 24px rgba(15,23,42,.04);
}

.navbar .badge{
  border-color: rgba(15,23,42,.12) !important;
}

/* Card polish */
.card{
  border-radius: var(--card-radius);
}

.card.shadow-sm{
  box-shadow: 0 1px 2px rgba(15,23,42,.06), 0 12px 32px rgba(15,23,42,.06) !important;
}

.card .card-body{
  padding: 18px;
}

/* Form controls */
.form-label{
  font-weight: 600;
  font-size: .9rem;
}

.form-control, .form-select{
  border-radius: 12px;
  border-color: rgba(15,23,42,.14);
}

.form-control:focus, .form-select:focus{
  border-color: rgba(29,78,216,.45);
  box-shadow: 0 0 0 .2rem var(--twx-primary-soft);
}

.btn{
  border-radius: 12px;
}

.btn-brand{
  background: var(--twx-primary) !important;
  border-color: var(--twx-primary) !important;
  color: #fff !important;
}

.btn-brand:hover{
  background: var(--twx-primary-dark) !important;
  border-color: var(--twx-primary-dark) !important;
}

/* We keep existing markup but map "success" look to Trade-Int blue */
.btn-success,
.btn-primary,
.twx-btn-primary{
  background: var(--twx-primary) !important;
  border-color: var(--twx-primary) !important;
  color: #fff !important;
  box-shadow: 0 1px 2px rgba(15,23,42,.06), 0 12px 32px rgba(29,78,216,.10);
}

.btn-success:hover,
.btn-primary:hover,
.twx-btn-primary:hover{
  background: var(--twx-primary-dark) !important;
  border-color: var(--twx-primary-dark) !important;
}

.btn-success:focus,
.btn-primary:focus,
.twx-btn-primary:focus{
  box-shadow: 0 0 0 .2rem var(--twx-primary-soft) !important;
}

.btn-outline-primary{
  --bs-btn-color: var(--twx-primary);
  --bs-btn-border-color: rgba(29,78,216,.35);
  --bs-btn-hover-bg: var(--twx-primary);
  --bs-btn-hover-border-color: var(--twx-primary);
  --bs-btn-hover-color: #fff;
}

.twx-primary{ color: var(--twx-primary) !important; }

.twx-muted{ color: rgba(15,23,42,.65) !important; }

/* Utility sizes (landing/auth) */
.twx-btn-lg{ padding: 12px 18px; border-radius: 14px; font-weight: 900; }
.twx-btn-xl{ padding: 14px 22px; border-radius: 14px; font-weight: 900; }

.twx-display{
  font-size: clamp(2.25rem, 5.5vw, 4.6rem);
  line-height: 1.05;
}

.twx-muted{ color: rgba(15,23,42,.65) !important; }

.twx-bullets{
  display: grid;
  gap: 10px;
}

.twx-bullet{
  position: relative;
  padding-left: 30px;
  font-weight: 700;
  color: rgba(15,23,42,.78);
}

.twx-bullet::before{
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(29,78,216,.12);
  color: var(--twx-primary);
  font-weight: 900;
}

.twx-media{
  border-radius: 24px;
  border: 1px solid rgba(15,23,42,.08);
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(15,23,42,.10);
  background: #fff;
}

.twx-media-inner{ position: relative; }

.twx-media-img{
  width: 100%;
  height: 420px;
  object-fit: cover;
  display: block;
}

@media (max-width: 991.98px){
  .twx-media-img{ height: 320px; }
}

.twx-media-caption{
  position: absolute;
  left: 18px;
  bottom: 18px;
  background: rgba(15,23,42,.78);
  color: #fff;
  padding: 10px 12px;
  border-radius: 14px;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.twx-footer{
  padding: 46px 0;
  margin-top: 18px;
  background: #f8fafc;
  border-top: 1px solid rgba(15,23,42,.08);
}

.twx-footer-logo{
  width: 46px;
  height: 46px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid rgba(15,23,42,.10);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 28px rgba(15,23,42,.06);
}

.twx-footer-h{
  font-weight: 900;
  letter-spacing: .18em;
  text-transform: uppercase;
  font-size: 12px;
  color: rgba(15,23,42,.60);
  margin-bottom: 12px;
}

.twx-footer-a{
  display: block;
  text-decoration: none;
  font-weight: 700;
  color: rgba(15,23,42,.78);
  margin-bottom: 8px;
}

.twx-footer-a:hover{
  color: var(--twx-primary);
}

/* ===== Landing page (Trade-Int inspired) ===== */
.twx-hero{
  position: relative;
  padding: 64px 0 72px;
  background: #fff;
  overflow: hidden;
}

.twx-hero-glow{
  position: absolute;
  top: 0;
  right: -180px;
  width: 640px;
  height: 640px;
  border-radius: 9999px;
  background: rgba(29,78,216,.12);
  filter: blur(120px);
  transform: translateY(-50%);
  z-index: 0;
}

.twx-hero-title{
  position: relative;
  z-index: 1;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.05;
  font-size: clamp(2.25rem, 5.5vw, 4.6rem);
  color: var(--twx-slate);
  margin: 0 0 18px;
}

.twx-hero-subtitle{
  position: relative;
  z-index: 1;
  font-size: clamp(1.05rem, 2.2vw, 1.35rem);
  color: rgba(15,23,42,.65);
  font-weight: 500;
  margin: 0 auto 26px;
}

.twx-searchbox{
  position: relative;
  z-index: 1;
  background: #fff;
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(15,23,42,.10);
  padding: 10px;
}

.twx-search-tabs{
  border-bottom: 1px solid rgba(15,23,42,.08);
  padding: 2px 2px 0;
  gap: 2px;
}

.twx-search-tabs .nav-link{
  border-radius: 12px 12px 0 0;
  font-weight: 800;
  font-size: 13px;
  color: rgba(15,23,42,.55);
}

.twx-search-tabs .nav-link.active{
  color: var(--twx-primary);
  background: transparent;
}

.twx-input{
  height: 52px;
  background: #f1f5f9;
  border: 0;
  font-weight: 600;
}

.twx-input:focus{
  background: #fff;
  border: 1px solid rgba(29,78,216,.30);
}

.twx-search-note{
  padding: 10px 12px 4px;
  text-align: left;
  font-size: 12px;
  color: rgba(15,23,42,.55);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.twx-live-dot{
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background: #22c55e;
  box-shadow: 0 0 0 6px rgba(34,197,94,.14);
}

.twx-stats{
  padding: 46px 0;
  background: var(--twx-primary);
  position: relative;
  overflow: hidden;
}

.twx-stat-value{
  font-weight: 900;
  font-size: clamp(2rem, 4.2vw, 3.2rem);
  color: #fff;
  letter-spacing: -0.02em;
}

.twx-stat-label{
  margin-top: 6px;
  font-weight: 900;
  letter-spacing: .18em;
  text-transform: uppercase;
  font-size: 11px;
  color: rgba(219,234,254,.95);
}

.twx-kicker{
  color: var(--twx-primary);
  font-weight: 900;
  letter-spacing: .22em;
  text-transform: uppercase;
  font-size: 12px;
  margin-bottom: 10px;
}

.twx-h2{
  font-weight: 900;
  color: var(--twx-slate);
  letter-spacing: -0.02em;
  font-size: clamp(1.7rem, 3.5vw, 2.6rem);
  margin-bottom: 10px;
}

.twx-h3{
  font-weight: 900;
  color: var(--twx-slate);
  letter-spacing: -0.01em;
  font-size: 1.25rem;
  margin-bottom: 10px;
}

.twx-feature{
  background: #f8fafc;
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 22px;
  padding: 22px;
  transition: all .25s ease;
}

.twx-feature:hover{
  background: #fff;
  transform: translateY(-2px);
  box-shadow: 0 22px 60px rgba(15,23,42,.10);
}

.twx-feature-bar{
  width: 64px;
  height: 4px;
  border-radius: 9999px;
  background: var(--twx-primary);
  margin-bottom: 14px;
  transition: width .35s ease;
}

.twx-feature:hover .twx-feature-bar{
  width: 100%;
}

.twx-cta{
  background: #1e293b;
  border-radius: 28px;
  position: relative;
  overflow: hidden;
}

.twx-cta::before{
  content: "";
  position: absolute;
  top: -120px;
  right: -120px;
  width: 380px;
  height: 380px;
  border-radius: 9999px;
  background: rgba(59,130,246,.15);
  filter: blur(80px);
}

.twx-cta-inner{
  position: relative;
  padding: 34px 18px;
  text-align: center;
}

.twx-cta-title{
  color: #fff;
  font-weight: 900;
  letter-spacing: -0.02em;
  font-size: clamp(1.45rem, 3.2vw, 2.1rem);
  margin: 0 0 10px;
}

.twx-cta-sub{
  color: rgba(226,232,240,.9);
  font-weight: 600;
  margin: 0 0 18px;
}

.twx-btn-cta{
  background: #fff !important;
  color: #0f172a !important;
  border: 0 !important;
  font-weight: 900;
  padding: 12px 20px;
  border-radius: 14px;
}

.twx-btn-cta:hover{
  background: rgba(255,255,255,.92) !important;
}

/* ===== Auth pages (login/adminx) ===== */
.twx-auth-wrap{
  padding: 28px 12px;
}

.twx-auth-card{
  margin: 0 auto;
  background: #fff;
  border: 1px solid rgba(15,23,42,.10);
  border-radius: 22px;
  box-shadow: 0 24px 60px rgba(15,23,42,.10);
  padding: 22px;
}

.twx-auth-logo{
  width: 48px;
  height: 48px;
  border-radius: 18px;
  background: rgba(29,78,216,.10);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.twx-auth-title{
  font-weight: 900;
  letter-spacing: -0.02em;
  font-size: 18px;
}

.twx-auth-sub{
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(15,23,42,.55);
}

.twx-btn-lg{
  height: 52px;
  font-weight: 900;
}

.btn-outline-secondary, .btn-outline-danger{
  border-color: rgba(15,23,42,.18) !important;
}

/* Pager */
#clientPager .btn{
  border-radius: 10px;
}

/* =========================
   TABLE FRAME + STICKY HEADER
   ========================= */

.table-frame{
  border: 1px solid rgba(15,23,42,.10);
  border-radius: var(--frame-radius);
  background:#fff;
}

/* sticky header: apply to both desktop & mobile */
#tblWrap thead th{
  position: sticky;
  top: var(--sticky-header-top);
  z-index: 4;
  background: #f8fafc;
  box-shadow: 0 1px 0 rgba(15,23,42,.10);
}

/* Table density + nicer separators */
.table{
  margin-bottom: 0;
  --bs-table-striped-bg: rgba(15,23,42,.03);
  --bs-table-hover-bg: rgba(15,23,42,.05);
  border-color: rgba(15,23,42,.10);
}

.table > :not(caption) > * > *{
  padding: .62rem .72rem;
}

.table thead th{
  font-size: 12px;
  letter-spacing: .2px;
  color: rgba(15,23,42,.78);
  vertical-align: middle;
  border-bottom: 1px solid rgba(15,23,42,.10);
}

.table tbody td{
  font-size: 13px;
  vertical-align: top;
  color: rgba(15,23,42,.92);
}

/* Keep numbers stable */
.table .text-end{
  font-variant-numeric: tabular-nums;
}

/* Cell wrap for long text */
.cell-wrap{
  white-space: normal !important;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.25;
}

/* width helpers from JS */
.w-320{ max-width:320px; }
.w-300{ max-width:300px; }

/* =========================
   RESPONSIVE TABLE BEHAVIOR
   - Desktop: show full (no horizontal scroll bar)
   - Tablet/Mobile: horizontal swipe
   ========================= */

@media (min-width: 992px){
  /* On desktop, clip stripes to rounded corners (safe because no horizontal scroll) */
  #tblWrap.table-responsive,
  .table-responsive.table-frame{
    overflow: visible !important;
    touch-action: auto;
  }

  /* slightly tighten wide columns to fit better */
  #tblWrap table thead th:nth-child(4),
  #tblWrap table tbody td:nth-child(4){
    min-width: 280px !important;
    max-width: 280px !important;
  }
  #tblWrap table thead th:nth-child(5),
  #tblWrap table tbody td:nth-child(5),
  #tblWrap table thead th:nth-child(6),
  #tblWrap table tbody td:nth-child(6){
    min-width: 220px !important;
    max-width: 280px !important;
  }

  /* hide mobile hint text on desktop if exists (the line below table) */
  .text-muted.small.mt-2{
    display: none;
  }
}

@media (max-width: 991.98px){
  #tblWrap.table-responsive,
  .table-responsive.table-frame{
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    touch-action: auto; /* allow vertical scroll */
  }

  #tblWrap > table{
    width: max-content;
    min-width: 100%;
  }
}

/* =========================
   MOBILE / TABLET TWEAKS
   ========================= */

@media (max-width: 768px){
  :root{ --sticky-header-top: 56px; }

  .app-container{
    padding-left: 12px;
    padding-right: 12px;
  }

  .card .card-body{ padding: 14px; }
  .form-label{ margin-bottom: .25rem; font-size: .875rem; }

  #clientPager{ flex-wrap: wrap; justify-content: flex-start; gap: .25rem !important; }
  #pageInput{ width: 76px !important; }

  .table thead th{ font-size: 11.5px; }
  .table tbody td{ font-size: 12.5px; }

  /* make touch targets a bit larger */
  .btn{ padding: .5rem .75rem; }
  .btn.btn-sm{ padding: .35rem .55rem; }
}

@media (max-width: 576px){
  /* avoid iOS zoom on focus */
  input, select, textarea, .form-control, .form-select{ font-size: 16px; }

  .navbar-brand{ font-size: 1rem; }
  .brand-dot{ width: 8px; height: 8px; box-shadow: 0 0 0 3px var(--twx-primary-soft); }

  /* keep table usable */
  #tblWrap table thead th:nth-child(4),
  #tblWrap table tbody td:nth-child(4){
    min-width: 240px !important;
    max-width: 240px !important;
  }
  #tblWrap table thead th:nth-child(5),
  #tblWrap table tbody td:nth-child(5),
  #tblWrap table thead th:nth-child(6),
  #tblWrap table tbody td:nth-child(6){
    min-width: 220px !important;
    max-width: 260px !important;
  }
}
