:root {
  --hh-bg: #120f0c;
  --hh-bg-soft: #1a120e;
  --hh-surface: #1f1712;
  --hh-surface-2: #251910;
  --hh-border: #3f2a21;
  --hh-border-soft: #322018;
  --hh-text: #f5eee7;
  --hh-text-muted: #c8b5a3;
  --hh-primary: #ffb114;
  --hh-primary-soft: #ffa24a;
  --hh-danger: #ff6b6b;
}

/* Reset-ish */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* === ADMIN LAYOUT (ทุกหน้าที่ใช้ layout.ejs) === */

body {
  background:
    radial-gradient(1100px 700px at 50% -15%, rgba(255, 190, 120, .10), transparent 60%),
    radial-gradient(900px 600px at 105% 20%, rgba(160, 110, 70, .08), transparent 60%),
    radial-gradient(900px 600px at -5% 110%, rgba(140, 95, 60, .06), transparent 60%),
    radial-gradient(circle at top, #2b1d10 0, var(--hh-bg) 60%, #090605 100%);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: var(--hh-text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    repeating-linear-gradient(45deg,
      rgba(255, 255, 255, .015) 0 2px,
      rgba(0, 0, 0, 0) 2px 8px),
    radial-gradient(1200px 800px at 50% -30%,
      rgba(255, 200, 120, .06), transparent 65%);
  opacity: .8;
  /* ปรับ .4-.9 ได้ตามใจ */
}

.app {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
}

/* SIDEBAR */

.sidebar {
  width: 240px;
  padding: 16px 14px;
  background: radial-gradient(circle at top, #2d1d11 0, #130e0a 60%, #0b0806 100%);
  border-right: 1px solid var(--hh-border);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar__logo {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--hh-primary), var(--hh-primary-soft));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #3b250b;
}

.sidebar__text {
  display: flex;
  flex-direction: column;
}

.sidebar__title {
  font-size: 16px;
  font-weight: 700;
}

.sidebar__subtitle {
  font-size: 12px;
  color: var(--hh-text-muted);
}

/* Sidebar admin card */

.sidebar__admin {
  display: flex;
  gap: 10px;
  align-items: center;
  background: rgba(12, 8, 6, 0.9);
  border-radius: 12px;
  padding: 8px 10px;
  border: 1px solid var(--hh-border-soft);
}

.sidebar__avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  object-fit: cover;
}

.sidebar__avatar--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #2a1b11;
  font-weight: 700;
  color: #fbe6bf;
}

.sidebar__admin-info {
  display: flex;
  flex-direction: column;
}

.sidebar__admin-name {
  font-size: 13px;
  font-weight: 600;
}

.sidebar__admin-id {
  font-size: 11px;
  color: var(--hh-text-muted);
}

/* Sidebar admin LINE ID */
.sidebar__admin-id {
  margin-top: 2px;
  display: flex;
  align-items: center;
  column-gap: 4px;
  font-size: 11px;
  color: #e8d9cc;
  max-width: 100%;
}

.sidebar__admin-id-label {
  opacity: 0.85;
}

.sidebar__admin-id-value {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  color: #f5e4c8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sidebar nav */

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: bold;
  color: var(--hh-text-muted);
  text-decoration: none;
  border: 1px solid transparent;
}

.sidebar__link:hover {
  background: rgba(255,255,255,0.02);
  border-color: var(--hh-border-soft);
  color: var(--hh-text);
}

.sidebar__link[disabled="disabled"] {
  filter: brightness(0.5);
  pointer-events: none;
  cursor: default;
}

.sidebar__link-icon {
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
}

.sidebar__link-text {
  flex: 1;
}

.sidebar__link.active {
  background: rgba(255, 177, 20, 0.18);
  border-color: var(--hh-primary);
  color: #ffe9b3;
}

/* Sidebar logout */

.sidebar__logout {
  margin-top: 8px;
}

.sidebar__logout .btn {
  width: 100%;
  justify-content: center;
}

.sidebar__divider {
  margin: 10px 0 6px;
  border-top: 1px solid var(--hh-border-soft);
}

.sidebar__logout-btn {
  background: radial-gradient(circle at top, #3a1410 0, #1a0c08 55%, #120806 100%);
  border-color: #ff8a8a;
  color: #ffe4e4;
  box-shadow: 0 8px 18px rgba(0,0,0,0.7);
}

.sidebar__logout-btn:hover {
  filter: brightness(1.05);
  border-color: #ffc2c2;
}


/* MAIN AREA */

.main {
  flex: 1;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.main__header {
  display: flex;
  align-items: center;
  justify-content: space-between;

  margin-bottom: 20px;
}

.main__title {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.02em;
}

.main__content {
  flex: 1;
}

/* GENERIC BUTTONS */

.btn {
  border: none;
  cursor: pointer;
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s ease, transform 0.08s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background: linear-gradient(135deg, var(--hh-primary), var(--hh-primary-soft));
  color: #3b250b;
  border: 1px solid #f9c76a;
  box-shadow: 0 6px 14px rgba(0,0,0,0.45);
}

.btn--primary:hover {
  filter: brightness(1.05);
}

.btn--outline {
  background: transparent;
  color: var(--hh-text);
  border: 1px solid var(--hh-border);
}

.btn--outline:hover {
  border-color: var(--hh-primary);
}

.btn--sm {
  padding: 4px 8px;
  font-size: 12px;
}

.btn:disabled {
  opacity: 0.6;
  cursor: default;
  box-shadow: none;
}

/* TABLE CARD (ใช้หน้า payments + dashboard อื่น ๆ ได้) */

.table-card {
  background: var(--hh-surface);
  border-radius: 14px;
  padding: 16px 18px;
  border: 1px solid var(--hh-border);
  box-shadow: 0 14px 32px rgba(0,0,0,0.7);
}

.table-card__header h2 {
  margin: 0 0 4px;
  font-size: 17px;
}

.table-card__sub {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--hh-text-muted);
}

/* Filter form */

.filter-form {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--hh-surface-2);
  border: 1px solid var(--hh-border);
  font-size: 13px;
}

.filter-form__row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.filter-form__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-form__field label {
  font-size: 12px;
  color: var(--hh-text-muted);
}

.filter-form__field input,
.filter-form__field select {
  min-width: 140px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #4a3527;
  background: #120c09;
  color: var(--hh-text);
  font-size: 13px;
}

.filter-form__field input:focus,
.filter-form__field select:focus {
  outline: none;
  border-color: var(--hh-primary);
}

/* .filter-form__field--submit {
  margin-left: auto;
} */

/* Table */

.table-wrapper {
  margin-top: 10px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th,
.table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--hh-border-soft);
  /* vertical-align: top; */
}

.table th {
  text-align: left;
  font-weight: 600;
  color: #f8e2c5;
  font-size: 12px;
  background: #5b3f2e;
}

.table__empty {
  text-align: center;
  padding: 20px 0;
  color: var(--hh-text-muted);
}

/* table cells */

.table__muted {
  font-size: 12px;
  color: var(--hh-text-muted);
}

.table__player {
  display: flex;
  flex-direction: column;
}

.table__product {
  display: flex;
  gap: 8px;
  align-items: center;
}

.table__product-img {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--hh-border-soft);
}

/* === AUTH / LOGIN PAGE (login.ejs) === */

.auth-body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: radial-gradient(circle at top, #2b1d10 0, var(--hh-bg) 60%, #090605 100%);
  color: var(--hh-text);
}

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  background: rgba(18, 12, 9, 0.96);
  border-radius: 18px;
  padding: 28px 32px;
  border: 1px solid var(--hh-border);
  box-shadow: 0 18px 45px rgba(0,0,0,0.85);
  max-width: 420px;
  width: 100%;
  text-align: left;
}

.auth-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--hh-primary), var(--hh-primary-soft));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  color: #3b250b;
  margin-bottom: 12px;
}

.auth-title {
  margin: 0 0 6px;
  font-size: 24px;
}

.auth-sub {
  margin: 0 0 18px;
  font-size: 14px;
  color: var(--hh-text-muted);
  line-height: 1.5;
}


/* === STATUS BADGE (payments + players history) === */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--hh-text-muted);
  white-space: nowrap;
}

/* map by raw status key (payments) */
.status-badge[data-status="pending"] {
  background: rgba(255, 177, 20, 0.18);
  border-color: rgba(255, 177, 20, 0.85);
  color: #ffdba0;
}

.status-badge[data-status="success"] {
  background: rgb(35, 80, 54, 0.16);
  border-color: rgb(45, 135, 83, 0.8);
  color: #c6f8d5;
}

.status-badge[data-status="paid"] {
  background: rgba(46, 204, 113, 0.16);
  border-color: rgba(46, 204, 113, 0.8);
  color: #c6f8d5;
}

/* manual by admin = เขียวเข้มกว่าเล็กน้อย */
.status-badge[data-status="paid_manual"] {
  background: rgba(39, 124, 174, 0.28);
  border-color: rgba(39, 93, 147, 0.95);
  color: #adf1ff;
}

/* free = โทนเขียวอมฟ้า แยกจาก paid */
.status-badge[data-status="free"] {
  background: rgba(72, 201, 176, 0.26);
  border-color: rgba(72, 201, 176, 0.95);
  color: #c3f7ea;
}

.status-badge[data-status="expired"],
.status-badge[data-status="canceled"] {
  background: rgba(231, 76, 60, 0.2);
  border-color: rgba(231, 76, 60, 0.9);
  color: #ffb3b3;
}

/* fallback classes (players history whereเรามีแต่ label ภาษาไทย) */
.status-badge--pending {
  background: rgba(255, 177, 20, 0.18);
  border-color: rgba(255, 177, 20, 0.85);
  color: #ffdba0;
}

.status-badge--success {
  background: rgba(46, 204, 113, 0.2);
  border-color: rgba(46, 204, 113, 0.9);
  color: #a6f0c0;
}

.status-badge--danger {
  background: rgba(231, 76, 60, 0.2);
  border-color: rgba(231, 76, 60, 0.9);
  color: #ffb3b3;
}


/* === TOAST === */

.hh-toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
}

.hh-toast {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  background: #1c130f;
  border: 1px solid #3f2a21;
  color: var(--hh-text);
  box-shadow: 0 4px 10px rgba(0,0,0,0.6);
  opacity: 1;
  transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}

.hh-toast--ok {
  border-color: #51d990;
}

.hh-toast--error {
  border-color: #ff9a9a;
}

.hh-toast.is-hide {
  opacity: 0;
  transform: translateY(-4px);
}

/* Simple cards for dashboard/players (เผื่อหน้าอื่นใช้) */

.card {
  background: var(--hh-surface);
  border-radius: 14px;
  padding: 16px 18px;
  border: 1px solid var(--hh-border-soft);
  box-shadow: 0 10px 26px rgba(0,0,0,0.7);
}

.card__title {
  margin: 0 0 6px;
  font-size: 16px;
}

.card__sub {
  margin: 0;
  font-size: 13px;
  color: var(--hh-text-muted);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

/* --- Adjustments: center login content & add spacing --- */
.auth-card {
  text-align: center;
}

.auth-logo {
  margin-left: auto;
  margin-right: auto;
}

.auth-sub {
  text-align: center;
}

.auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  text-decoration: none;
}
.auth-btn:link,
.auth-btn:visited {
  text-decoration: none;
}

/* Dashboard spacing: add gap between top stat cards and welcome block */
.card-grid {
  margin-bottom: 18px;
}

/* If there's a standalone .card after the grid, give it a bit of top margin */
.card-grid + .card {
  margin-top: 4px;
}

/* Dashboard: give more breathing room between stat cards and welcome block */
.page-dashboard .main__content > * + * {
  margin-top: 22px;
}


/* grow field for search input */
.filter-form__field--grow {
  flex: 1 1 220px;
}

.auth-note {
  margin-top: 10px;
  font-size: 12px;
  color: var(--hh-text-muted);
}

.auth-logo--img {
  background: none;
  padding: 0;
}
.auth-logo__img {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: block;
  margin: 0 auto 10px;
}

.auth-alert {
  margin: 8px 0 14px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 154, 154, 0.12);
  border: 1px solid #ff9a9a;
  color: #ffd7d7;
  font-size: 12px;
}

.sidebar__logo--img {
  padding: 0;
  background: none;
}
.sidebar__logo-img {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: block;
  object-fit: cover;
}


a.btn,
.btn,
.auth-btn {
  text-decoration: none !important;
}


.sidebar__notice {
  margin-top: 8px;
  padding: 10px 12px;
  font-size: 13px;
  border-radius: 10px;
  background: rgba(0,0,0,0.35);
  color: var(--hh-text-muted);
  line-height: 1.4;
}


/* === Sales Summary === */
.sales-summary {
  margin-top: 20px;
  margin-bottom: 20px;
}

.sales-summary__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 16px;
}

.sales-summary__card {
  background: rgba(18, 16, 12, 0.9);
  border-radius: 18px;
  border: 1px solid rgba(255, 177, 20, 0.22);
  padding: 16px 18px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.55);
}

.sales-summary__card--main {
  background: radial-gradient(circle at top left, rgb(139 93 0 / 25%), rgb(29 21 14));
}

.sales-summary__card--main .sales-summary__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  /* ไม่ต้องใส่ font-size ตรงนี้ */
}

/* ขนาดตัวหนังสือของ "รายได้รวม" */
.sales-summary__card--main .sales-summary__label {
  font-size: 18px;
  /* ปรับใหญ่/เล็กตรงนี้แทน */
  font-weight: 600;
}

/* badge ช่องทาง ด้านขวา */
.sales-summary__channel {
  font-size: 15px;
  font-weight: 600;
  /* ให้เล็กตายตัวไปเลย */
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #ffdd99;
  white-space: nowrap;
}

.sales-summary__label {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--hh-text-muted);
  margin-bottom: 6px;
}

.sales-summary__value {
  font-size: 28px;
  font-weight: 700;
  color: var(--hh-primary);
  line-height: 1.2;
}

.sales-summary__value--small {
  font-size: 20px;
}

.sales-summary__unit {
  font-size: 16px;
  font-weight: 500;
  color: var(--hh-text);
  margin-left: 4px;
}

.sales-summary__sub {
  margin-top: 8px;
  font-size: 14px;
  color: var(--hh-text);
}

.sales-summary__sub--muted {
  color: var(--hh-text-muted);
}

.sales-summary__meta {
  margin: 4px 0 0;
  padding: 0;
}

.sales-summary__meta > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
  padding: 4px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
}

.sales-summary__meta > div:last-child {
  border-bottom: none;
}

.sales-summary__meta dt {
  color: var(--hh-text-muted);
}

.sales-summary__meta dd {
  margin: 0;
  color: var(--hh-text);
  font-weight: 500;
}

/* ตารางยอดขายรวม */
.table-row--total {
  background: rgba(255, 177, 20, 0.08);
  font-weight: 600;
}

/* ช่องวันที่ให้ icon เป็นสีอ่อน */
.filter-form__field input[type="date"] {
  /* color-scheme: dark; */
  color: var(--hh-text);
}

.filter-form__field input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
}

/* PLAYERS PAGE */

.players-search {
  margin-top: 8px;
}

.players-error {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 107, 107, 0.12);
  border: 1px solid rgba(255, 107, 107, 0.4);
  color: var(--hh-text);
  font-size: 13px;
}

.players-loading {
  margin-top: 20px;
  padding: 24px 18px;
  text-align: center;
  color: var(--hh-text-muted);
}

.players-loading__spinner {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.08);
  border-top-color: var(--hh-primary);
  margin: 0 auto 10px;
  animation: players-spin 0.8s linear infinite;
}

@keyframes players-spin {
  to { transform: rotate(360deg); }
}

.players-info {
  margin-top: 18px;
}

.players-info__inner {
  max-width: 100%;
}

.players-info__header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255,177,20,0.16), rgba(255,162,74,0.32));
  border: 1px solid rgba(249, 199, 106, 0.6);
  box-shadow: 0 10px 26px rgba(0,0,0,0.6);
}

/* Player info avatar */
.players-info__header {
    display: flex;
    align-items: stretch;
    gap: 18px;
    justify-content: flex-start;
}

.players-info__avatar {
  flex-shrink: 0;
  width: 75px;
  height: 75px;
  border-radius: 10px;
  background: radial-gradient(circle at 30% 30%, #ffcf73, #8b5a2b);
  border: 2px solid rgba(255, 201, 120, 0.9);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.players-info__avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.players-info__main {
  min-width: 200px;
}

.players-info__label {
  font-size: 13px;
  opacity: 0.9;
  margin-bottom: 4px;
}

.players-info__name {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.players-info__uid {
  margin-top: 4px;
  font-size: 13px;
  color: var(--hh-text-muted);
}

.players-info__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
}

.players-info__meta-item {
  min-width: 120px;
}

.players-info__meta-label {
  font-size: 12px;
  color: var(--hh-text-muted);
  margin-bottom: 4px;
}

.players-info__meta-value {
  font-size: 15px;
  font-weight: 600;
}

.players-metrics {
  margin-top: 18px;
}

.players-metrics__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.players-metric {
  background: var(--hh-surface-2);
  border-radius: 12px;
  padding: 14px 16px;
  border: 1px solid var(--hh-border-soft);
  box-shadow: 0 10px 24px rgba(0,0,0,0.65);
}

.players-metric__label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--hh-text-muted);
}

.players-metric__icon {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.players-metric__value {
  font-size: 22px;
  font-weight: 700;
}

.players-extra {
  margin-top: 18px;
}

.players-grant {
  margin-top: 18px;
}

.players-grant__card {
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--hh-border-soft);
}

.players-grant__grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px 16px;
}

.players-grant__field label {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
  color: var(--hh-text-muted);
}

.players-grant__field select,
.players-grant__field input[type="number"] {
  width: 100%;
  padding: 7px 8px;
  border-radius: 6px;
  border: 1px solid var(--hh-border-soft);
  background: rgba(0, 0, 0, 0.4);
  color: var(--hh-text);
}

.players-grant__actions {
    margin-top: 12px;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-direction: column-reverse;
}

.players-grant__status {
  font-size: 12px;
  color: var(--hh-text-muted);
  text-align: center;
}

.players-grant__status--ok {
  color: #a6ffb0;
}

.players-grant__status--error {
  color: #ff9a9a;
}

.players-grant--highlight {
  box-shadow: 0 0 0 1px rgba(255, 177, 20, 0.7);
}

/* สกิน select ในบล็อกเพิ่มหมู / ไอเทม ให้ผู้เล่น */
.players-grant__field select {
  width: 100%;
  padding: 6px 32px 6px 10px;
  /* เผื่อช่องให้ลูกศรด้านขวา */
  border-radius: 6px;
  border: 1px solid var(--hh-border-soft);
  background-color: rgba(0, 0, 0, 0.65);
  color: var(--hh-text);
  font-size: 13px;
  line-height: 1.3;
  cursor: pointer;

  /* ตัดสไตล์ select เดิมของ browser ออก */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;

  /* ลูกศรเล็ก ๆ ด้านขวา สีทอง */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath fill='%23ffb114' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 10px 6px;
}

.players-grant__field select:hover {
  background-color: rgba(0, 0, 0, 0.8);
  border-color: var(--hh-border);
}

.players-grant__field select:focus {
  outline: none;
  border-color: var(--hh-primary);
  box-shadow: 0 0 0 1px rgba(255, 177, 20, 0.45);
}

/* dropdown list ด้านใน (บาง browser รองรับ) */
.players-grant__field select option {
  background-color: #1a120e;
  color: var(--hh-text);
}

.players-extra__code {
  margin-top: 10px;
  font-family: "SF Mono", ui-monospace, Menlo, Monaco, Consolas, "Courier New", monospace;
  font-size: 12px;
  background: rgba(0,0,0,0.35);
  border-radius: 8px;
  padding: 10px 12px;
  border: 1px solid var(--hh-border-soft);
  max-height: 220px;
  overflow: auto;
  word-break: break-all;
}

.players-actions {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.players-actions__btn {
  width: 100%;
  justify-content: center;
}

.players-empty {
  margin-top: 26px;
  text-align: center;
  color: var(--hh-text-muted);
}

.players-empty__inner {
  max-width: 420px;
  margin: 0 auto;
}

.players-empty__icon {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin: 0 auto 12px;
}

.players-empty__title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.players-empty__text {
  font-size: 13px;
}


.players-history {
  margin-top: 22px;
}

.players-history__title {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}

.players-history__table-wrapper {
  margin-top: 8px;
}

/* extra button variant for players page */
.btn--danger {
  background: linear-gradient(135deg, var(--hh-danger), #ff9a9a);
  color: #3b1010;
  border: 1px solid #ff9a9a;
  box-shadow: 0 6px 14px rgba(0,0,0,0.5);
}

.btn--danger:hover {
  filter: brightness(1.05);
}

.players-history__table {
  border: 1px solid var(--hh-border-soft);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.65);
}
/* PLAYERS - Topup history colored rows (web/game) */
.players-history__table tbody tr.history-row td {
  transition: background 0.15s ease, transform 0.1s ease;
}

.players-history__table tbody tr.history-row--web td {
  background: rgba(60, 42, 25, 0.95);
}

.players-history__table tbody tr.history-row--game td {
  background: rgba(45, 32, 20, 0.95);
}

.players-history__table tbody tr.history-row:hover td {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.7);
}

/* .players-history__table tbody tr.history-row td:first-child {
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
}

.players-history__table tbody tr.history-row td:last-child {
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
}  */

/* === PAYMENTS TABLE - MOBILE CARDS === */
@media (max-width: 1024px) {
  .table-card {
    padding: 12px 10px;
  }

  .js-payments-table {
    border-collapse: separate;
  }

  .js-payments-table thead {
    display: none;
  }

  .js-payments-table tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .js-payments-table tr {
    display: block;
    /* background: rgba(37, 25, 16, 0.5); */
    background: rgba(24, 17, 11, 0.5);
    border-radius: 12px;
    padding: 8px 10px;
    border: 1px solid var(--hh-border-soft);
    box-shadow: 0 8px 20px rgba(0,0,0,0.75);
  }

  /* .js-payments-table tr:nth-child(odd) {
    background: #24160f;
  } */

  .js-payments-table td {
    display: block;
    padding: 2px 0;
    border-bottom: none;
  }

  /* id + web_user_id แสดงแบบตัวเล็กด้านบน */
  .js-payments-table td:nth-child(1),
  .js-payments-table td:nth-child(2) {
    font-size: 11px;
    color: var(--hh-text-muted);
  }

  .js-payments-table td:nth-child(3) {
    margin-top: 4px;
    margin-bottom: 4px;
  }

  .js-payments-table td:nth-child(4) {
    margin-bottom: 4px;
  }

  /* จำนวน / ยอดบิล / สร้างบิล / หมดอายุ / สถานะ เป็นแบบ label : value */
  .js-payments-table td:nth-child(5),
  .js-payments-table td:nth-child(6),
  .js-payments-table td:nth-child(7),
  .js-payments-table td:nth-child(8),
  .js-payments-table td:nth-child(9) {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    font-size: 12px;
  }

  .js-payments-table td:nth-child(5)::before,
  .js-payments-table td:nth-child(6)::before,
  .js-payments-table td:nth-child(7)::before,
  .js-payments-table td:nth-child(8)::before,
  .js-payments-table td:nth-child(9)::before {
    font-weight: 600;
    color: var(--hh-text-muted);
  }

  .js-payments-table td:nth-child(5)::before { content: "จำนวน"; }
  .js-payments-table td:nth-child(6)::before { content: "ยอดบิล"; }
  .js-payments-table td:nth-child(7)::before { content: "สร้างบิล"; }
  .js-payments-table td:nth-child(8)::before { content: "หมดอายุ"; }
  .js-payments-table td:nth-child(9)::before { content: "สถานะ"; }

  .js-payments-table .js-action-cell {
    margin-top: 6px;
    text-align: right;
  }

  .js-payments-table .btn--sm {
    font-size: 11px;
    padding: 4px 10px;
  }


  /* ID + WUID header row on small screens */
  .js-payments-table tr {
    position: relative;
  }

  .js-payments-table td:nth-child(1) {
    font-size: 11px;
    color: var(--hh-text-muted);
    /* padding-right: 80px; */
  }

  .js-payments-table td:nth-child(2) {
    position: absolute;
    top: 6px;
    right: 10px;
    padding: 0;
    font-size: 11px;
    color: var(--hh-text-muted);
    text-align: right;
  }

  .js-payments-table td:nth-child(2) .table__wuid::before {
    content: "WUID ";
    font-weight: 600;
  }
}

/* ERROR PAGE */
.layout--error {
  background: radial-gradient(circle at top, #3b2415 0, #120d08 55%, #070404 100%);
  min-height: 100vh;
  color: var(--hh-text, #fff);
}

.error-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
}

.error-card {
  max-width: 640px;
  width: 100%;
  background: rgba(12, 8, 5, 0.95);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.8);
  padding: 24px 24px 20px;
}

.error-card__code {
  font-size: 40px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #ffb114;
}

.error-card__title {
  margin-top: 4px;
  font-size: 22px;
  font-weight: 700;
}

.error-card__message {
  margin-top: 8px;
  color: #e8d9cc;
  line-height: 1.5;
}

.error-card__details {
  margin-top: 16px;
  background: #1b120d;
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  padding: 10px 12px;
  max-height: 260px;
  overflow: auto;
  font-size: 12px;
}

.error-card__details summary {
  cursor: pointer;
  font-weight: 600;
  color: #ffdd99;
}

.error-card__details pre {
  margin-top: 8px;
  white-space: pre-wrap;
  word-break: break-all;
}

.error-card__actions {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* ===== Dashboard KPI row (3 ช่องบน) ===== */

.dash-kpi-row {
  margin-top: 1.25rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
}

.dash-kpi-card {
  padding: 0.95rem 1rem;
  border-radius: 0.9rem;
  background: rgba(24, 17, 11, 0.98);
  border: 1px solid rgba(120, 72, 33, 0.55);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.dash-kpi-card__value {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--hh-primary);
  letter-spacing: 0.03em;
}

.dash-kpi-card__unit {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--hh-text);
  /* ขาว */
  opacity: 0.95;
}

.dash-kpi-card__label {
  margin-top: 0.2rem;
  font-size: 0.8rem;
  color: var(--hh-text);
}

/* mobile */
@media (max-width: 768px) {
  .dash-kpi-row {
    grid-template-columns: 1fr;
  }
}

/* ===== Dashboard Country Chart ===== */

.dash-chart-card {
  margin-top: 1.3rem;
  padding: 1.25rem 1.4rem 1.4rem;
  border-radius: 1rem;
  background: rgba(18, 12, 8, 0.98);
  border: 1px solid rgba(75, 53, 33, 0.7);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.dash-chart-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.dash-chart-card__title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
  color: #f9fafb;
}

.dash-chart-card__subtitle {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  color: #e5e7eb;
}

.dash-chart-card__subtitle#ga-summary {
  font-size: 13px;
  line-height: 1.4;
}

.ga-summary__sub {
  opacity: 0.8;
  margin-left: 4px;
}

.dash-chart-card__legend {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: #e5e7eb;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
}

.legend-dot.legend-dot--web {
  background: rgba(229, 161, 64, 0.95);
}

.legend-dot.legend-dot--game {
  background: rgba(61, 201, 167, 0.95);
}

.legend-label {
  opacity: 0.9;
}

.dash-chart-card__body {
  position: relative;
  margin-top: 0.25rem;
  height: 260px;
  /* ให้กราฟมีพื้นที่สูงหน่อย */
}

/* ใช้สีเดียวกับ status paid_manual เพื่อให้ธีมไปในทิศทางเดียวกัน */
.highlight-number {
  font-weight: 600;
  color: #3dd8a7;
}




/* ----- Dashboard line chart (AJAX) ----- */

.dash-chart-card__side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.dash-chart-card__controls {
  font-size: 0.78rem;
  color: #e5e7eb;
}

.dash-chart-card__controls label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dash-chart-card__controls input[type="month"] {
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid #4a3527;
  background: #120c09;
  color: var(--hh-text);
  font-size: 0.78rem;
}

.dash-chart-card__controls input[type="month"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
}

/* ให้ canvas กราฟเต็มพื้นที่ใน card */
.dash-chart-card__body canvas {
  width: 100% !important;
  height: 100% !important;
}

/* loading / empty text */
.dash-chart__loading,
.dash-chart__empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--hh-text-muted);
  pointer-events: none;
}

/* ให้ body ของกราฟรองรับ overlay และมีความสูงขั้นต่ำ */
.dash-chart-card__body {
  position: relative;
  min-height: 260px;
}

/* ทำให้ canvas กราฟเต็ม card */
.dash-chart-card__body canvas {
  width: 100% !important;
  height: 100% !important;
}

/* overlay ตอนโหลดและตอน empty (จะใช้ใน JS) */
.dash-chart__loading,
.dash-chart__empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--hh-text-muted, #9ca3af);
  pointer-events: none;
  text-align: center;
}

/* ฝั่งขวาของหัวการ์ด (legend + month picker) */
.dash-chart-card__side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.dash-chart-card__controls {
  font-size: 0.78rem;
  color: #e5e7eb;
}

.dash-chart-card__controls label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dash-chart-card__controls input[type="month"] {
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid #4a3527;
  background: #120c09;
  color: var(--hh-text);
  font-size: 0.78rem;
}

.dash-chart-card__controls input[type="month"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
}

/* label ของ filter บนกราฟ (ใช้ได้ทั้งเดือนและช่วงวัน) */
.dash-filter-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: #f9fafb;
}

.dash-filter-label__text {
  opacity: 0.9;
}

/* กล่องครอบ select ให้ทรงเหมือน input เดือน */
.dash-filter-select {
  position: relative;
  display: inline-flex;
  align-items: center;
}

/* ตัว select สำหรับช่วงวัน */
.dash-select-range {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  background: rgba(19, 12, 6, 0.95);
  border: 1px solid #4a3527;
  border-radius: 5px;
  padding: 3px 29px 1px 13px;
  font-size: 0.78rem;
  line-height: 1.4;
  color: #f9fafb;

  outline: none;
  cursor: pointer;
}

/* ลูกศรเล็ก ๆ ด้านขวา ให้เหมือน feeling ช่องเดือนที่มีไอคอน */
.dash-select-range {
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='%23f9fafb' d='M1.4 0.8L6 5.4 10.6 0.8 12 2.2 6 8 0 2.2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px 8px;
}

/* ให้ block ควบคุมดูใกล้เคียงกับอันบน */
.dash-chart-card__controls--range {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

/* ==== DASHBOARD LOADING ANIMATIONS ==== */

/* ตัวเลขในการ์ด KPI + หน่วยบาท */
.dash-kpi-card__value {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--hh-primary);
  letter-spacing: 0.03em;
}

.dash-kpi-card__value #kpi-total-web {
  color: #c48937;
}

.dash-kpi-card__value #kpi-total-game {
  color: #c48937;
}

.dash-kpi-card__unit {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--hh-text);
  opacity: 0.95;
}

/* skeleton ตอนโหลด KPI */
.dash-kpi-card__value.is-loading {
  position: relative;
  overflow: hidden;
}

/* ซ่อนทั้งตัวเลขและคำว่า "บาท" ตอนโหลด */
.dash-kpi-card__value.is-loading span {
  opacity: 0;
}

.dash-kpi-card__value.is-loading::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: linear-gradient(90deg,
      rgba(255, 255, 255, 0.05) 0%,
      rgba(255, 255, 255, 0.15) 50%,
      rgba(255, 255, 255, 0.05) 100%);
  animation: hh-skeleton-shimmer 1.2s infinite;
}

@keyframes hh-skeleton-shimmer {
  0% {
    transform: translateX(-60%);
  }

  100% {
    transform: translateX(60%);
  }
}

/* body ของกราฟรองรับ overlay */
.dash-chart-card__body {
  position: relative;
  min-height: 260px;
}

/* canvas กราฟเต็มการ์ด */
.dash-chart-card__body canvas {
  width: 100% !important;
  height: 100% !important;
}

/* overlay ตอนโหลด/ตอน empty */
.dash-chart__loading,
.dash-chart__empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--hh-text-muted, #9ca3af);
  pointer-events: none;
  text-align: center;
}

/* spinner 3 จุดเด้ง ๆ */
.hh-spinner {
  display: flex;
  gap: 6px;
}

.hh-spinner__dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #ffffff;
  opacity: 0.4;
  animation: hh-bounce 0.8s ease-in-out infinite alternate;
}

.hh-spinner__dot:nth-child(2) {
  animation-delay: .15s;
}

.hh-spinner__dot:nth-child(3) {
  animation-delay: .3s;
}

@keyframes hh-bounce {
  0% {
    transform: translateY(0);
    opacity: 0.4;
  }

  100% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* ฝั่งขวา legend + month picker (ถ้ายังไม่ได้เพิ่ม) */
.dash-chart-card__side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.dash-chart-card__controls {
  font-size: 0.78rem;
  color: #e5e7eb;
}

.dash-chart-card__controls label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dash-chart-card__controls input[type="month"] {
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid #4a3527;
  background: #120c09;
  color: var(--hh-text);
  font-size: 0.78rem;
}

.dash-chart-card__controls input[type="month"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
}

/* ให้ปุ่มค้นหา / ล้างค่า เรียงกันไม่ซ้อน */
.filter-form__field--submit .filter-form__actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  /* ระยะห่างระหว่างปุ่ม */
  flex-wrap: wrap;
  /* เผื่อจอแคบให้ตัดบรรทัดสวย ๆ */
}

/* --------------------
   ส่งข้อความ (message-form)
   -------------------- */

.message-form {
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.message-form .form-label {
  font-size: 13px;
  color: #f7cfa2;
  /* สีหัวข้ออ่อน ๆ */
}

/* ช่องกรอกหัวข้อ + เนื้อหา */
.message-form .form-input,
.message-form .form-textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 170, 80, 0.45);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 14px;
  line-height: 1.5;
  outline: none;
  resize: vertical;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background-color 0.15s ease;
}

/* ความสูงเริ่มต้นของ textarea */
.message-form .form-textarea {
  min-height: 90px;
}

/* โฟกัสแล้วให้ดูเด่นขึ้นหน่อย */
.message-form .form-input:focus,
.message-form .form-textarea:focus {
  border-color: #ffb24c;
  background: rgba(0, 0, 0, 0.55);
  box-shadow: 0 0 0 1px rgba(255, 178, 76, 0.45);
}

/* สี placeholder */
.message-form .form-input::placeholder,
.message-form .form-textarea::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

/* แถวปุ่ม + สถานะ */
.message-form .form-actions {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.form-status {
  font-size: 13px;
  color: #f3d29a;
}

.form-status--success {
  color: #7fe29b;
}

.form-status--error {
  color: #ff8484;
}

/* layout ฟอร์มในการ์ดส่งข้อความ */
.dash-chart-card--message .dash-chart-card__body {
  display: flex;
  justify-content: center;
  /* จัดฟอร์มให้อยู่กลางการ์ด */
}

/* ฟอร์มส่งข้อความ */
.message-form {
  width: 100%;
  max-width: 100%;
  /* กว้างขึ้นจากเดิม 520 */
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* กล่อง input / textarea */
.message-form .form-input,
.message-form .form-textarea {
  width: 100%;
  box-sizing: border-box;
  /* กันหลุดขอบ */
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 170, 80, 0.45);
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  font-size: 14px;
  line-height: 1.5;
  outline: none;
  resize: vertical;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background-color 0.15s ease;
}

/* ความสูงเริ่มต้นของ textarea ให้ดูสมดุลกับการ์ด */
.message-form .form-textarea {
  min-height: 120px;
}

/* โฟกัสแล้วให้เด่นขึ้นหน่อย */
.message-form .form-input:focus,
.message-form .form-textarea:focus {
  border-color: #ffb24c;
  background: rgba(0, 0, 0, 0.6);
  box-shadow: 0 0 0 1px rgba(255, 178, 76, 0.45);
}

/* แถวปุ่ม + ข้อความสถานะ */
.message-form .form-actions {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}