/* Torfy header: cacheable, no inline payload. */
/* ===== ROOT VARIABLES ===== */
	:root {
		--torfy-header-bg: #0f172a;
		--torfy-header-bg-soft: rgba(255, 255, 255, 0.06);
		--torfy-header-text: #f1f5f9;
		--torfy-header-muted: #94a3b8;
		--torfy-header-border: rgba(255, 255, 255, 0.08);
		--torfy-header-primary: #3b82f6;
		--torfy-header-primary-dark: #2563eb;
		--torfy-header-primary-soft: rgba(59, 130, 246, 0.15);
		--torfy-header-danger: #ef4444;
		--torfy-header-shadow: 0 10px 28px rgba(0, 0, 0, 0.3);
		--torfy-header-radius: 14px;
		--torfy-header-radius-sm: 10px;
	}


@media (min-width: 1000px) {
    .desktop-header, .site-header {
		top: 0;
		z-index: 9990;
		width: 100%;
        position: fixed;
    }
}




	/* ===== BASE HEADER ===== */
	.site-header {
		position: sticky;
		top: 0;
		z-index: 9990;
		width: 100%;
		background: var(--torfy-header-bg);
		border-bottom: 1px solid var(--torfy-header-border);
		box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
		color: var(--torfy-header-text);
	}
	.desktop-header,
	.mobile-header,
	.drawer-menu,
	.drawer-menu-overlay {
		box-sizing: border-box;
	}
	.desktop-header *,
	.mobile-header *,
	.drawer-menu *,
	.drawer-menu-overlay * {
		box-sizing: border-box;
	}

	/* ===== DESKTOP HEADER ===== */
	.desktop-header {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 18px;
		min-height: 72px;
		padding: 12px clamp(18px, 3vw, 42px);
		background: linear-gradient(180deg, rgba(8,13,23,0.94) 0%, rgba(15,23,42,0.88) 100%);
		backdrop-filter: blur(16px) saturate(150%);
		-webkit-backdrop-filter: blur(16px) saturate(150%);
		box-shadow: 0 8px 24px rgba(0,0,0,0.22);
		border-bottom: 1px solid rgba(255,255,255,0.1);
	}
	.desktop-header-left,
	.desktop-header-right,
	.mobile-top-left,
	.mobile-top-right,
	.mobile-bottom-row {
		display: flex;
		align-items: center;
		min-width: 0;
	}
	.desktop-header-left {
		flex: 0 0 auto;
		gap: 14px;
	}
	.desktop-header-center {
		flex: 1 1 auto;
		min-width: 220px;
		max-width: 720px;
	}
	.desktop-header-right {
		flex: 0 0 auto;
		gap: 10px;
	}

	/* ===== BRANDING / LOGO ===== */
	.site-branding {
		display: flex;
		align-items: center;
		min-width: 0;
	}
	.site-branding a {
		color: var(--torfy-header-text);
		font-size: 1.15rem;
		font-weight: 800;
		line-height: 1;
		text-decoration: none;
		letter-spacing: -0.04em;
		white-space: nowrap;
	}
	.site-branding img,
	.site-branding .custom-logo {
		display: block;
		width: auto;
		max-width: 150px;
		max-height: 44px;
		object-fit: contain;
		/* No invert filter – logo appears as uploaded */
	}

	/* ===== BUTTONS ===== */
	.back-button,
	.toggle-menu-btn,
	.search-submit,
	.close-drawer {
		border: 0;
		cursor: pointer;
		-webkit-tap-highlight-color: transparent;
	}
	.back-button {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 38px;
		height: 38px;
		flex: 0 0 38px;
		border-radius: 999px;
		background: var(--torfy-header-bg-soft);
		color: var(--torfy-header-text);
		transition: background 0.18s, transform 0.18s, color 0.18s;
	}
	.back-button:hover {
		background: rgba(59,130,246,0.25);
		color: #fff;
	}
	.back-button:active {
		transform: scale(0.96);
	}
	.back-button svg {
		width: 19px;
		height: 19px;
	}

	/* ===== DELIVERY PILL ===== */
	.header-delivery {
		display: flex;
		flex-direction: column;
		gap: 2px;
		min-width: 0;
		max-width: 210px;
		padding: 8px 10px;
		border-radius: 12px;
		color: var(--torfy-header-text);
		text-decoration: none;
		
		transition: border-color 0.18s, background 0.18s;
	}
	.header-delivery:hover {
		background: rgba(255,255,255,0.1);
		border-color: rgba(255,255,255,0.18);
	}
	.header-delivery span {
		color: var(--torfy-header-muted);
		font-size: 0.68rem;
		font-weight: 700;
		line-height: 1;
		text-transform: uppercase;
		letter-spacing: 0.15em;
	}
	.header-delivery strong {
		display: flex;
		align-items: center;
		gap: 5px;
		min-width: 0;
		color: var(--torfy-header-text);
		font-size: 0.78rem;
		font-weight: 800;
		line-height: 1.15;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}
	.header-delivery svg {
		flex: 0 0 auto;
		color: var(--torfy-header-primary);
	}

	/* ===== SEARCH BAR ===== */
	.header-search {
		width: 100%;
		min-width: 0;
	}
	.header-search form {
		display: flex;
		align-items: center;
		width: 100%;
		min-width: 0;
		height: 44px;
		overflow: hidden;
		border: 1px solid var(--torfy-header-border);
		border-radius: 999px;
		background: rgba(255,255,255,0.07);
		transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
	}
	.header-search form:focus-within {
		background: rgba(255,255,255,0.12);
		border-color: rgba(59,130,246,0.6);
		box-shadow: 0 0 0 4px rgba(59,130,246,0.15);
	}
	.search-category-select {
		width: auto;
		max-width: 150px;
		height: 100%;
		flex: 0 0 auto;
		padding: 0 12px;
		border: 0;
		outline: 0;
		background: transparent;
		color: var(--torfy-header-text);
		font-size: 0.78rem;
		font-weight: 800;
		border-right: 1px solid var(--torfy-header-border);
	}
	.header-search input[type="search"] {
		width: 100%;
		min-width: 0;
		height: 100%;
		padding: 0 14px;
		border: 0;
		outline: 0;
		background: transparent;
		color: var(--torfy-header-text);
		font-size: 0.92rem;
		font-weight: 600;
	}
	.header-search input[type="search"]::placeholder {
		color: #94a3b8;
		font-weight: 600;
	}
	.search-submit {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 48px;
		height: 100%;
		flex: 0 0 48px;
		background: var(--torfy-header-primary);
		color: #fff;
		transition: background 0.18s;
	}
	.search-submit:hover {
		background: var(--torfy-header-primary-dark);
	}
	.search-submit svg {
		width: 18px;
		height: 18px;
	}

	/* ===== ACTION LINKS (Account, Cart) ===== */
	.header-action-link,
	.cart-link,
	.toggle-menu-btn {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		text-decoration: none;
		border-radius: 999px;
		white-space: nowrap;
		transition: background 0.18s, color 0.18s, transform 0.18s;
	}
	.header-action-link {
		flex-direction: column;
		align-items: flex-start;
		min-width: 92px;
		padding: 8px 12px;
		color: var(--torfy-header-text);
	
		line-height: 1.1;
	}
	.header-action-link:hover {
		background: rgba(59,130,246,0.2);
		color: #fff;
	}
	.header-action-link .label {
		color: var(--torfy-header-muted);
		font-size: 0.67rem;
		font-weight: 700;
	}
	.header-action-link span:last-child {
		max-width: 110px;
		overflow: hidden;
		color: inherit;
		font-size: 0.82rem;
		font-weight: 900;
		text-overflow: ellipsis;
	}
	.cart-link {
		gap: 7px;
		min-height: 40px;
		padding: 8px 12px;
		color: var(--torfy-header-text);
		background: var(--torfy-header-bg-soft);
		font-size: 0.86rem;
		font-weight: 900;
	}
	.cart-link:hover {
		background: rgba(59,130,246,0.2);
		color: #fff;
	}
	.cart-icon {
		position: relative;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 24px;
		height: 24px;
	}
	.cart-icon svg {
		width: 23px;
		height: 23px;
	}
	.cart-count {
		position: absolute;
		top: -8px;
		right: -10px;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		min-width: 18px;
		height: 18px;
		padding: 0 5px;
		border: 2px solid rgba(15,23,42,0.8);
		border-radius: 999px;
		background: var(--torfy-header-danger);
		color: #fff;
		font-size: 0.65rem;
		font-weight: 900;
		line-height: 1;
	}
	.toggle-menu-btn {
		min-height: 40px;
		padding: 8px 14px;
		background: var(--torfy-header-primary);
		color: #fff;
		font-size: 0.84rem;
		font-weight: 900;
	}
	.toggle-menu-btn:hover {
		background: var(--torfy-header-primary-dark);
	}
	.toggle-menu-btn:active,
	.cart-link:active,
	.header-action-link:active {
		transform: scale(0.98);
	}

	/* ===== MOBILE HEADER ===== */
	.mobile-header {
		display: none;
		background: var(--torfy-header-bg);
	}
	.mobile-top-row {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 10px;
		padding: 9px 12px 7px;
		border-bottom: 1px solid rgba(255,255,255,0.08);
	}
	.mobile-top-left {
		flex: 1 1 auto;
		gap: 9px;
		overflow: hidden;
	}
	.mobile-top-right {
		flex: 0 0 auto;
		gap: 7px;
	}
	.mobile-bottom-row {
		gap: 8px;
		padding: 8px 12px 10px;
		background: var(--torfy-header-bg);
	}
	.mobile-bottom-row .header-search form {
		height: 40px;
	}
	.mobile-bottom-row .search-category-select {
		max-width: 76px;
		padding: 0 8px;
		font-size: 0.72rem;
	}
	.mobile-bottom-row .search-submit {
		width: 42px;
		flex-basis: 42px;
	}
	.mobile-header .site-branding img,
	.mobile-header .site-branding .custom-logo {
		max-width: 96px;
		max-height: 34px;
		/* No invert */
	}
	.mobile-header .site-branding a {
		max-width: 96px;
		overflow: hidden;
		font-size: 1rem;
		text-overflow: ellipsis;
	}
	.mobile-header .header-delivery {
		max-width: 142px;
		padding: 6px 8px;
		background: transparent;
	}
	.mobile-header .header-delivery span {
		font-size: 0.58rem;
	}
	.mobile-header .header-delivery strong {
		font-size: 0.68rem;
	}
	.mobile-header .header-action-link {
		min-width: 0;
		max-width: 78px;
		padding: 7px 9px;
		background: transparent;
	}

	.mobile-header .header-action-link span:last-child {
		max-width: 62px;
		font-size: 0.73rem;
	}
	.mobile-header .cart-link {
		width: 38px;
		height: 38px;
		min-height: 38px;
		padding: 0;
		background: var(--torfy-header-bg-soft);
	}
	.mobile-header .cart-link > span:not(.cart-count) {
		display: none;
	}
	.mobile-header .toggle-menu-btn {
		width: 40px;
		height: 40px;
		min-height: 40px;
		flex: 0 0 40px;
		padding: 0;
		font-size: 1.05rem;
	}
	.mobile-header .back-button {
		width: 40px;
		height: 40px;
		flex-basis: 40px;
	}

	/* ===== DRAWER ===== */
	.drawer-menu-overlay {
		position: fixed;
		inset: 0;
		z-index: 9997;
		visibility: hidden;
		background: rgba(15,23,42,0.52);
		opacity: 0;
		transition: opacity 0.22s, visibility 0.22s;
	}
	.drawer-menu-overlay.is-open {
		visibility: visible;
		opacity: 1;
	}
	.drawer-menu {
		position: fixed;
		top: 0;
		right: 0;
		z-index: 9998;
		width: min(420px, 92vw);
		height: 100dvh;
		padding: 18px;
		overflow-y: auto;
		background: #0f172a;
		color: var(--torfy-header-text);
		box-shadow: -18px 0 40px rgba(0,0,0,0.5);
		transform: translateX(105%);
		transition: transform 0.24s;
		-webkit-overflow-scrolling: touch;
	}
	.drawer-menu.is-open {
		transform: translateX(0);
	}
	body.torfy-drawer-open {
		overflow: hidden;
	}
	.close-drawer {
		position: absolute;
		top: 14px;
		right: 14px;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 38px;
		height: 38px;
		border-radius: 999px;
		background: var(--torfy-header-bg-soft);
		color: var(--torfy-header-text);
		font-size: 1rem;
		font-weight: 900;
	}
	.close-drawer:hover {
		background: rgba(255,255,255,0.15);
		color: #fff;
	}
	.drawer-header {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 14px;
		padding: 8px 46px 16px 2px;
	}
	.drawer-logo {
		display: block;
		width: auto;
		max-width: 126px;
		max-height: 46px;
		object-fit: contain;
		/* No invert */
	}
	.drawer-logo-text {
		color: var(--torfy-header-text);
		font-size: 1.25rem;
		font-weight: 900;
		text-decoration: none;
		letter-spacing: -0.04em;
	}
	.drawer-my-account-label {
		flex: 0 0 auto;
		padding: 7px 10px;
		border-radius: 999px;
		background: var(--torfy-header-primary-soft);
		color: var(--torfy-header-primary);
		font-size: 0.72rem;
		font-weight: 900;
		text-transform: uppercase;
		letter-spacing: 0.06em;
	}
	.drawer-user-section {
		position: relative;
		display: flex;
		align-items: center;
		gap: 12px;
		padding: 14px;
		border: 1px solid var(--torfy-header-border);
		border-radius: 18px;
		background: linear-gradient(135deg, rgba(30,41,59,0.8) 0%, rgba(15,23,42,0.9) 100%);
	}
	.user-avatar {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 48px;
		height: 48px;
		flex: 0 0 48px;
		overflow: hidden;
		border-radius: 999px;
		background: var(--torfy-header-bg-soft);
		color: var(--torfy-header-primary);
		box-shadow: 0 0 0 1px rgba(59,130,246,0.2);
	}
	.avatar-img {
		width: 48px;
		height: 48px;
		border-radius: 999px;
		object-fit: cover;
	}
	.user-info {
		min-width: 0;
		flex: 1 1 auto;
	}
	.user-name {
		color: var(--torfy-header-text);
		font-size: 0.95rem;
		font-weight: 900;
		line-height: 1.2;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}
	.user-email {
		margin-top: 3px;
		color: var(--torfy-header-muted);
		font-size: 0.78rem;
		font-weight: 600;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}
	.sign-in-link {
		flex: 0 0 auto;
		padding: 8px 12px;
		border-radius: 999px;
		background: var(--torfy-header-primary);
		color: #fff;
		font-size: 0.78rem;
		font-weight: 900;
		text-decoration: none;
	}
	.drawer-actions {
		display: grid;
		grid-template-columns: repeat(2, minmax(0,1fr));
		gap: 10px;
		margin-top: 16px;
	}
	.drawer-action-link {
		display: flex;
		align-items: center;
		gap: 10px;
		min-width: 0;
		padding: 13px 12px;
		border: 1px solid var(--torfy-header-border);
		border-radius: 16px;
		background: rgba(255,255,255,0.04);
		color: var(--torfy-header-text);
		text-decoration: none;
		transition: border-color 0.18s, background 0.18s, color 0.18s, transform 0.18s;
	}
	.drawer-action-link:hover {
		border-color: rgba(59,130,246,0.4);
		background: rgba(59,130,246,0.1);
		color: #fff;
	}
	.drawer-action-link:active {
		transform: scale(0.98);
	}
	.drawer-action-link svg {
		flex: 0 0 auto;
		color: currentColor;
	}
	.drawer-action-link span {
		min-width: 0;
		font-size: 0.82rem;
		font-weight: 900;
		line-height: 1.15;
	}
	.drawer-divider {
		height: 1px;
		margin: 18px 0 12px;
		background: var(--torfy-header-border);
	}
	.drawer-menu-label {
		margin-bottom: 10px;
		color: var(--torfy-header-muted);
		font-size: 0.68rem;
		font-weight: 900;
		text-transform: uppercase;
		letter-spacing: 0.08em;
	}
	.drawer-nav-menu ul,
	.drawer-primary-menu,
	.drawer-support-links {
		margin: 0;
		padding: 0;
		list-style: none;
	}
	.drawer-primary-menu {
		display: grid;
		gap: 6px;
	}
	.drawer-primary-menu a,
	.drawer-support-link,
	.drawer-logout-link {
		display: flex;
		align-items: center;
		gap: 10px;
		min-width: 0;
		padding: 12px 13px;
		border-radius: 14px;
		color: var(--torfy-header-text);
		text-decoration: none;
		font-size: 0.9rem;
		font-weight: 800;
		transition: background 0.18s, color 0.18s;
	}
	.drawer-primary-menu a:hover,
	.drawer-support-link:hover {
		background: rgba(255,255,255,0.08);
		color: var(--torfy-header-primary);
	}
	.drawer-support-links {
		display: grid;
		grid-template-columns: repeat(2, minmax(0,1fr));
		gap: 8px;
	}
	.drawer-support-link {
		border: 1px solid var(--torfy-header-border);
		background: rgba(255,255,255,0.03);
	}
	.support-icon {
		width: 22px;
		flex: 0 0 22px;
		text-align: center;
	}
	.drawer-logout {
		margin-top: 8px;
	}
	.drawer-logout-link {
		justify-content: center;
		border: 1px solid rgba(239,68,68,0.3);
		background: rgba(239,68,68,0.1);
		color: var(--torfy-header-danger);
	}
	.drawer-logout-link:hover {
		background: rgba(239,68,68,0.2);
		color: #f87171;
	}

	/* ===== RESPONSIVE ===== */
	@media (min-width: 769px) {
		.desktop-header { display: flex; }
		.mobile-header { display: none; }
	}
	@media (max-width: 1000px) {
		.site-header {
			position: sticky;
			top: 0;
			z-index: 9990;
		}
		.desktop-header { display: none; }
		.mobile-header { display: block; }
		.drawer-menu {
			width: min(390px, 94vw);
			padding: 16px;
		}
		.drawer-actions {
			grid-template-columns: 1fr;
		}
		.drawer-support-links {
			grid-template-columns: 1fr;
		}
		.drawer-header {
			padding-right: 44px;
		}
	}
	@media (max-width: 380px) {
		.mobile-header .header-delivery {
			max-width: 110px;
		}
		.mobile-header .header-action-link {
			display: none;
		}
		.mobile-bottom-row .search-category-select {
			max-width: 66px;
		}
	}

	/* ===== FIXED MOBILE TOP ROW ===== */
	@media (max-width: 1000px) {
		.site-header {
			position: relative !important;
			z-index: 9990 !important;
			padding-top: 58px !important;
		}
		.mobile-top-row {
			position: fixed !important;
			top: 0 !important;
			left: 0 !important;
			right: 0 !important;
			z-index: 99999 !important;
			width: 100% !important;
			background: linear-gradient(180deg, rgba(8,13,23,0.94) 0%, rgba(15,23,42,0.88) 100%) !important;
			backdrop-filter: blur(16px) saturate(150%) !important;
			-webkit-backdrop-filter: blur(16px) saturate(150%) !important;
			box-shadow: 0 8px 24px rgba(0,0,0,0.22) !important;
			border-bottom: 1px solid rgba(255,255,255,0.10) !important;
		}
		.mobile-bottom-row {
			position: relative !important;
			z-index: 2 !important;
		}
	}
	@media (max-width: 782px) {
		body.admin-bar .mobile-top-row {
			top: 46px !important;
		}
	}
