/* user pill + overlay (match home tone) */
.user-slot{ display:flex; align-items:center; gap:10px; }
.user-pill{
  padding:8px 12px; border-radius:999px; border:1px solid #e5e7eb;
  background:#fff; font-weight:700; cursor:pointer;
}
.user-pill:hover{ background:#f8fafc }
.user-pill .sep{ opacity:.5; margin:0 4px }

/* overlay gate */
.gate-overlay{
  position:fixed; inset:0; z-index:1000;
  background:rgba(15,23,42,.55); backdrop-filter:blur(2px);
  display:flex; align-items:center; justify-content:center;
}
.gate-card{
  width:min(92vw,520px); background:#fff; border:1px solid #e5e7eb;
  border-radius:16px; padding:18px; box-shadow:0 10px 30px rgba(2,6,23,.12);
}
.gate-card h3{ margin:0 0 8px; font-size:20px }
.gate-card p{ margin:0 0 12px; color:#64748b }
.gate-actions{ display:flex; gap:10px; justify-content:flex-end }
.btn{
  padding:10px 14px; border-radius:12px; border:1px solid #e5e7eb; font-weight:700; cursor:pointer; background:#fff;
}
.btn.primary{ color:#000; border:none; background:linear-gradient(135deg,#60a5fa,#34d399) }
.btn.ghost{ background:#fff }

/* …ของเดิม… */
.gate-overlay{
  position:fixed; inset:0; z-index:9999;   /* ดันให้สูงขึ้น */
  background:rgba(15,23,42,.55); backdrop-filter:blur(2px);
  display:flex; align-items:center; justify-content:center;
}

/* === Unify header logo size across pages ======================= */
/* Desktop 28px, Mobile 24px — ใช้ร่วมได้ทุกหน้า */
:root{
  --brand-logo-size-desktop: 36px;
  --brand-logo-size-mobile: 24px;
}

.site-header .brand-logo{
  height: var(--brand-logo-size-desktop) !important;
  width: auto !important;
  display: block;
  vertical-align: middle;
}

/* มือถือให้เล็กลงนิดให้พอดี header */
@media (max-width: 640px){
  .site-header .brand-logo{
    height: var(--brand-logo-size-mobile) !important;
  }
}

/* ===== Global Mobile Header unify (ทุกหน้า) ===== */
@media (max-width: 1024.98px){
  /* เฮดเดอร์มือถือ: สีพื้น/เส้นคั่น/blur เดียวกัน */
  :is(header, .site-header){
    position: sticky; top: 0; z-index: 60;
    background: var(--bg-2, #fff);
    border-bottom: 1px solid var(--ring, #e5e7eb);
    -webkit-backdrop-filter: saturate(140%) blur(6px);
    backdrop-filter: saturate(140%) blur(6px);
    box-shadow: none !important;
  }

  /* จัดเลย์เอาต์: แบรนด์ซ้าย | (ซ่อน nav) | ปุ่มเมนู | ชื่อผู้ใช้ขวา */
  .header-inner{
    display: grid !important;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 8px;
    min-height: 54px;
    padding: 8px 0;
  }
  .nav{ display: none !important; } /* ซ่อนเมนูเดสก์ท็อปบนมือถือ */

  /* ชื่อระบบ/แบรนด์ยาวให้ตัด … */
  .brand, .brand *{
    min-width: 0;
    max-width: 42vw;
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  }

  /* ปุ่มเมนู/ปุ่มบนขวา */
  .menu-btn, .header-btn{
    display: inline-flex !important;
    align-items: center; justify-content: center;
    padding: 8px 12px;
    border: 1px solid var(--ring, #e5e7eb);
    border-radius: 12px;
    background: #fff;
    font-weight: 800; line-height: 1;
  }

  /* โปรไฟล์ชิปด้านขวา — ครอบหลายชื่อคลาสที่ใช้อยู่ */
  .site-header .header-inner :is(.profile-chip, .user-pill, .auth, .header-profile, [class*="profile"]){
    justify-self: end;
    max-width: 56vw;                /* ปรับได้ 50–60vw ตามความยาวชื่อ */
    display: inline-flex !important; align-items: center; gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--ring, #e5e7eb);
    border-radius: 999px;
    background: #fff;
    font-weight: 800;
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
    box-shadow: 0 1px 0 rgba(0,0,0,.02);
  }
  .site-header .header-inner :is(.profile-chip, .user-pill, .auth) .name{
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  }
  .site-header .header-inner :is(.profile-chip, .user-pill, .auth) .meta{
    color: #334155; opacity: .9;
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  }
  .site-header .header-inner :is(.profile-chip, .user-pill, .auth) .meta::before{
    content: "•"; margin: 0 6px 0 4px; opacity: .45;
  }
}

/* ===== Desktop header: enlarge logo/name without growing header ===== */
@media (min-width: 1025px){
  :root{
    --dh-height: 48px; /* keep desktop header visual height */
    --dh-logo-height: var(--brand-logo-size-desktop);
  }

  .site-header{ overflow: visible; }
  .site-header .header-inner{
    min-height: var(--dh-height);
    padding: 0 !important; /* neutralize page-specific vertical padding */
    align-items: center;
    overflow: visible;
  }

  /* Let bigger logo overflow up/down but keep header height the same */
  .site-header .brand-logo{
    height: var(--dh-logo-height) !important;
    margin-top:    calc((var(--dh-height) - var(--dh-logo-height))/2) !important;
    margin-bottom: calc((var(--dh-height) - var(--dh-logo-height))/2) !important;
  }

  /* Optional brand text (if present on some pages) */
  .site-header .brand :is(.brand-text, .brand-name, .label, .title, span, strong){
    font-size: 18px; line-height: 1; /* do not push header height */
  }

  /* User name chip on the right */
  .site-header :is(.user-pill, .profile-chip){
    font-size: 16px; line-height: 1.1; /* safe within 48px header */
  }
}
