/* TG Header — no built-in Header Advertisement Slot. */
#tg-global-header{position:sticky;top:0;z-index:9000;width:100%;background:rgba(255,255,255,.97);border-bottom:1px solid var(--tg-border,#e5eaf0);backdrop-filter:blur(12px)}
#tg-global-header,#tg-global-header *{box-sizing:border-box}
/* Two-column Header by default: logo | search/tools. Optional user-created ad is explicit. */
#tg-global-header .tg-brand-row{min-height:128px;display:grid;grid-template-columns:minmax(200px,320px) minmax(0,1fr);align-items:center;gap:24px}
#tg-global-header .tg-brand{grid-column:1;display:flex;align-items:center;justify-self:start;min-width:0;font-weight:800}
#tg-global-header .tg-brand .custom-logo-link{display:inline-flex;align-items:center;max-width:100%}
#tg-global-header .tg-brand img{display:block;width:auto;max-width:320px;max-height:104px;height:auto;object-fit:contain}
#tg-global-header .tg-header-tools{grid-column:2;display:flex;align-items:center;justify-content:flex-end;justify-self:stretch;gap:12px;min-width:0;width:100%;margin:0}
#tg-global-header .tg-header-search{flex:0 1 330px;width:min(330px,100%);min-width:170px;height:52px;border:1px solid var(--tg-border,#e5eaf0);border-radius:999px;display:flex;align-items:center;background:#fff;overflow:hidden}
#tg-global-header .tg-header-search input{min-width:0;flex:1;height:100%;border:0;outline:0;padding:0 0 0 20px;font:inherit;font-size:15px;background:transparent}
#tg-global-header .tg-header-search button{flex:0 0 48px;width:48px;height:100%;border:0;background:transparent;font-size:20px;cursor:pointer;color:var(--tg-primary,#0b2f57)}
#tg-global-header .tg-login{flex:0 0 auto;min-height:52px;display:flex;align-items:center;justify-content:center;gap:7px;padding:0 22px;border:1px solid var(--tg-primary,#0b2f57);border-radius:999px;color:var(--tg-primary,#0b2f57);font-weight:800;font-size:15px;text-decoration:none;white-space:nowrap}
#tg-global-header .tg-login .tg-profile-icon{display:inline-grid;place-items:center;font-size:16px;line-height:1}
#tg-global-header .tg-menu-toggle{display:none;border:0;cursor:pointer}
#tg-global-header .tg-mobile-search-row{display:none!important}

@media (max-width:1280px) and (min-width:981px){
 #tg-global-header .tg-brand-row{grid-template-columns:minmax(180px,250px) minmax(0,1fr);gap:18px;min-height:108px}
 #tg-global-header .tg-brand img{max-width:240px;max-height:82px}
 #tg-global-header .tg-header-search{flex-basis:270px;height:48px}
 #tg-global-header .tg-login{min-height:48px;padding:0 17px}
}

/* Mobile/tablet: logo and search/menu occupy one row without any default ad row. */
@media (max-width:980px){
 #tg-global-header{position:relative;top:auto}
 #tg-global-header .tg-brand-row{width:min(calc(100% - 16px),var(--tg-container,1200px));max-width:100%;min-height:0;margin-inline:auto;padding:8px 0 12px;display:grid!important;grid-template-columns:minmax(105px,150px) minmax(0,1fr)!important;grid-template-rows:auto!important;align-items:center;gap:10px!important}
 #tg-global-header .tg-brand{grid-column:1;grid-row:1;justify-self:start;min-width:0}
 #tg-global-header .tg-brand img{width:auto;max-width:150px;max-height:62px;height:auto}
 #tg-global-header .tg-header-tools{grid-column:2;grid-row:1;justify-self:stretch;display:grid!important;grid-template-columns:minmax(80px,1fr) auto auto;align-items:center;gap:8px!important;min-width:0;width:100%;margin:0!important}
 #tg-global-header .tg-header-search{display:flex!important;width:100%;min-width:0;height:44px;border-radius:14px}
 #tg-global-header .tg-header-search input{padding-left:12px;font-size:13px}
 #tg-global-header .tg-header-search button{flex-basis:40px;width:40px}
 #tg-global-header .tg-login{width:auto;min-width:44px;height:44px;min-height:44px;padding:0 12px;border-radius:12px;font-size:13px;gap:5px}
 #tg-global-header .tg-login .tg-profile-label{display:inline}
 #tg-global-header .tg-login .tg-profile-icon{font-size:17px}
 #tg-global-header .tg-menu-toggle{display:grid!important;place-items:center;width:44px;height:44px;margin:0;padding:0;border-radius:12px;background:var(--tg-primary,#0b2f57);color:#fff;font-size:25px;line-height:1}
}
@media (max-width:620px){
 #tg-global-header .tg-brand-row{grid-template-columns:minmax(96px,132px) minmax(0,1fr)!important;gap:7px!important}
 #tg-global-header .tg-brand img{max-width:132px;max-height:58px}
 #tg-global-header .tg-header-tools{gap:6px!important;grid-template-columns:minmax(64px,1fr) auto auto}
 #tg-global-header .tg-header-search{height:42px}
 #tg-global-header .tg-header-search input{font-size:12px;padding-left:9px}
 #tg-global-header .tg-header-search button{flex-basis:34px;width:34px;font-size:17px}
 #tg-global-header .tg-login,#tg-global-header .tg-menu-toggle{height:42px;min-height:42px}
 #tg-global-header .tg-menu-toggle{width:42px}
}
@media (max-width:480px){
 #tg-global-header .tg-brand-row{grid-template-columns:minmax(88px,118px) minmax(0,1fr)!important;gap:6px!important}
 #tg-global-header .tg-brand img{max-width:118px;max-height:52px}
 #tg-global-header .tg-header-tools{grid-template-columns:minmax(58px,1fr) 42px 42px;gap:5px!important}
 #tg-global-header .tg-login{width:42px;min-width:42px;padding:0}
 #tg-global-header .tg-login .tg-profile-label{display:none}
 #tg-global-header .tg-login .tg-profile-icon{font-size:19px}
}
@media (max-width:360px){
 #tg-global-header .tg-brand-row{grid-template-columns:minmax(78px,102px) minmax(0,1fr)!important;gap:4px!important}
 #tg-global-header .tg-brand img{max-width:102px;max-height:46px}
 #tg-global-header .tg-header-search input{font-size:11px;padding-left:7px}
 #tg-global-header .tg-header-tools{grid-template-columns:minmax(50px,1fr) 40px 40px;gap:4px!important}
 #tg-global-header .tg-login,#tg-global-header .tg-menu-toggle{width:40px;min-width:40px;height:40px;min-height:40px}
}

/* v0.6.1 — desktop-only alignment fix.
 * Keep the right tools anchored to the LEFT edge of their grid column so
 * unused column width does not appear as a blank gap after the ad slot.
 * <=1000px responsive/mobile layout is intentionally untouched.
 */
@media (min-width:1001px){
 #tg-global-header .tg-header-tools{
   justify-content:flex-start;
   justify-self:stretch;
 }
}
